/** * @dataProvider conditions */ public function testGameNotLoaded($isUserAnon, $cookieValue) { // starting conditions $scavengerHunt = new ScavengerHunt(); $scavengerHunt->setGame(null); $mockedUser = $this->getMock('User', array('isAnon', 'getName')); $mockedUser->expects($this->any())->method('isAnon')->will($this->returnValue(self::MOCK_USER_NAME)); $mockedUser->expects($this->any())->method('getName')->will($this->returnValue(self::MOCK_USER_NAME)); $this->mockClass('User', $mockedUser); $_COOKIE[$scavengerHunt->getHuntIdKey()] = $cookieValue; // mocks $oFakeGame = $this->getFakeGame(); // test $oFinalGame = $scavengerHunt->getActiveGame(); if (empty($cookieValue)) { $this->assertEmpty($oFinalGame); } else { $this->assertNotEmpty($oFinalGame); $oFakeGameID = $oFinalGame->getId(); $this->assertEquals($oFakeGameID, $oFinalGame->getId()); } }