Skip to content

Commit 1ec1e2a

Browse files
committed
Adding subkey test
1 parent 86f22ab commit 1ec1e2a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: tests/QueryTest.php

+24
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,28 @@ public function testFind()
4242
$this->assertEquals('John Doe', $user['name']);
4343
}
4444

45+
public function testSubKey()
46+
{
47+
$user1 = array(
48+
'name' => 'John Doe',
49+
'address' => array(
50+
'country' => 'Belgium',
51+
'city' => 'Ghent'
52+
)
53+
);
54+
55+
$user2 = array(
56+
'name' => 'Jane Doe',
57+
'address' => array(
58+
'country' => 'France',
59+
'city' => 'Paris'
60+
)
61+
);
62+
63+
DB::collection('users')->insert(array($user1, $user2));
64+
65+
$users = DB::collection('users')->where('address.country', 'Belgium')->get();
66+
$this->assertEquals(1, count($users));
67+
}
68+
4569
}

0 commit comments

Comments
 (0)