diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Functional/ReadPreferenceTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Functional/ReadPreferenceTest.php index 17847516d6..69347b5256 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Functional/ReadPreferenceTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Functional/ReadPreferenceTest.php @@ -16,7 +16,7 @@ public function setUp() $user = new User(); $user->addGroup(new Group('Test')); $this->dm->persist($user); - $this->dm->flush(); + $this->dm->flush(null, ['w' => 'majority']); $this->dm->clear(); } @@ -31,6 +31,7 @@ public function testHintIsNotSetByDefault() $this->assertArrayNotHasKey(Query::HINT_READ_PREFERENCE_TAGS, $cursor->getHints()); $user = $cursor->getSingleResult(); + $this->assertInstanceOf(User::class, $user); $this->assertInstanceOf('Doctrine\ODM\MongoDB\PersistentCollection', $user->getGroups()); $this->assertArrayNotHasKey(Query::HINT_READ_PREFERENCE, $user->getGroups()->getHints()); @@ -53,6 +54,7 @@ public function testHintIsSetOnQuery($readPreference, array $tags = null) $this->assertReadPreferenceTagsHint($tags, $cursor->getHints()); $user = $cursor->getSingleResult(); + $this->assertInstanceOf(User::class, $user); $this->assertInstanceOf('Doctrine\ODM\MongoDB\PersistentCollection', $user->getGroups()); $this->assertReadPreferenceHint($readPreference, $user->getGroups()->getHints()); @@ -79,6 +81,7 @@ public function testHintIsSetOnCursor($readPreference, array $tags = null) $this->assertReadPreferenceTagsHint($tags, $cursor->getHints()); $user = $cursor->getSingleResult(); + $this->assertInstanceOf(User::class, $user); $this->assertInstanceOf('Doctrine\ODM\MongoDB\PersistentCollection', $user->getGroups()); $this->assertReadPreferenceHint($readPreference, $user->getGroups()->getHints()); @@ -100,8 +103,9 @@ public function testHintIsSetOnPersistentCollection($readPreference, array $tags $this->assertArrayNotHasKey(Query::HINT_READ_PREFERENCE_TAGS, $cursor->getHints()); $user = $cursor->getSingleResult(); - $groups = $user->getGroups(); + $this->assertInstanceOf(User::class, $user); + $groups = $user->getGroups(); $this->assertInstanceOf('Doctrine\ODM\MongoDB\PersistentCollection', $groups); $groups->setHints(array(