Ejemplo n.º 1
0
 /** 
  * @test 
  * */
 public function playingInvalidStoneDoesNotRemoveStoneFromPlayer()
 {
     $game = $this->getMockGame();
     $player = new Player($game, 1, 'player 1');
     $player->addStones([new Stone(1, 1), new Stone(4, 1)]);
     $play = new Play(4, new Stone(4, 1), Table::SIDE_LEFT);
     $this->assertPlayerHasStone($player, new Stone(4, 1));
     $this->expectedThatInvalidMoveIsThrown($game);
     $this->expectThatAddMoveIsCalled($game, $player, $play, self::ONCE);
     $invalidMoveExceptionThrown = false;
     try {
         $player->play(new Play(4, new Stone(4, 1), Table::SIDE_LEFT));
     } catch (InvalidMoveException $e) {
         $this->assertPlayerHasStone($player, new Stone(4, 1));
         $invalidMoveExceptionThrown = true;
     }
     $this->assertTrue($invalidMoveExceptionThrown, 'expected InvalidMoveException to be thrown');
 }