Exemplo n.º 1
0
 public function testGetGameBuildWhenStorageEmpty()
 {
     $expectedGame = GameWithPlayerAndOneWorker::getGame();
     /** @var Session | \PHPUnit_Framework_MockObject_MockObject $sessionStub */
     $sessionStub = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->setMethods(['get', 'set'])->getMock();
     $sessionStub->expects($this->exactly(1))->method('get')->with('game')->willReturn(false);
     $storage = new SessionStorage($sessionStub);
     $method = new \ReflectionMethod(GameController::class, 'getGame');
     $method->setAccessible(true);
     $actualGame = $method->invokeArgs($this->getMock(GameController::class, [], [], '', false), [$storage, GameWithPlayerAndOneWorker::getBuilder()]);
     $this->assertEquals(serialize($expectedGame), serialize($actualGame));
 }
Exemplo n.º 2
0
 public function isStartedProvider()
 {
     $startedGame = GameWithPlayerAndOneWorker::getGame();
     $startedGame->start();
     return [[$startedGame, true], [GameWithoutCharacters::get(), false]];
 }