Skip to content

Commit 802e6c3

Browse files
committed
Adding test for subdocument updates
1 parent 7d2468b commit 802e6c3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/QueryBuilderTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,18 @@ public function testUnset()
413413
$this->assertFalse(isset($user2['note2']));
414414
}
415415

416+
public function testUpdateSubdocument()
417+
{
418+
DB::collection('users')->insertGetId(array(
419+
'name' => 'John Doe',
420+
'address' => array('country' => 'Belgium')
421+
));
422+
423+
DB::collection('users')->where('name', 'John Doe')->update(array('address.country' => 'England'));
424+
425+
$check = DB::collection('users')->where('name', 'John Doe')->first();
426+
427+
$this->assertEquals('England', $check['address']['country']);
428+
}
429+
416430
}

0 commit comments

Comments
 (0)