Skip to content

Commit

Permalink
Adding in array test
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Jul 29, 2013
1 parent 07b0932 commit 92754b8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/QueryTest.php
Expand Up @@ -11,6 +11,7 @@ public function setUp() {}
public function tearDown()
{
DB::collection('users')->truncate();
DB::collection('items')->truncate();
}

public function testCollection()
Expand Down Expand Up @@ -67,4 +68,23 @@ public function testSubKey()
$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));
}

}

0 comments on commit 92754b8

Please sign in to comment.