Commit 92754b8e authored by Jens Segers's avatar Jens Segers

Adding in array test

parent 07b09321
...@@ -11,6 +11,7 @@ class QueryTest extends PHPUnit_Framework_TestCase { ...@@ -11,6 +11,7 @@ class QueryTest extends PHPUnit_Framework_TestCase {
public function tearDown() public function tearDown()
{ {
DB::collection('users')->truncate(); DB::collection('users')->truncate();
DB::collection('items')->truncate();
} }
public function testCollection() public function testCollection()
...@@ -67,4 +68,23 @@ class QueryTest extends PHPUnit_Framework_TestCase { ...@@ -67,4 +68,23 @@ class QueryTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('John Doe', $users[0]['name']); $this->assertEquals('John Doe', $users[0]['name']);
} }
public function testInArray()
{
$item1 = array(
'tags' => array('tag1', 'tag2', 'tag3', 'tag4')
);
$item2 = array(
'tags' => array('tag2')
);
DB::collection('items')->insert(array($item1, $item2));
$items = DB::collection('items')->where('tags', 'tag2')->get();
$this->assertEquals(2, count($items));
$items = DB::collection('items')->where('tags', 'tag1')->get();
$this->assertEquals(1, count($items));
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment