コード例 #1
0
ファイル: ArenaTest.php プロジェクト: iannsp/phpwar
 /**
  * @test
  * @depends arena_tiles_can_be_returned_and_inpected
  * @depends new_game_should_contain_only_empty_tiles
  * @TODO Rename Method: `play` is better explained as `setPointContent`.
  * @TODO Extract Method: `setPointContent` should belongs to Cartesian\Plane.
  */
 public function occupation_of_a_tile_on_a_rulesless_game()
 {
     $arenaLimits = new Geometry\Cartesian\Point(4, 4);
     $scoreStrategy = array('Hit' => '\\Iannsp\\PhpWar\\Game\\Score\\Neibor');
     $arena = new Arena($arenaLimits, $scoreStrategy);
     $tileToBeOccupied = new Move(0, 1);
     $alice = 'A';
     $arena->play($alice, $tileToBeOccupied);
     $gameCurrentStatus = $arena->stats();
     $this->assertCount(2, $gameCurrentStatus, 'Status of the game should return two information: empty tiles and Alice\'s tiles.');
     $this->assertArrayHasKey('.', $gameCurrentStatus, 'The number of empty tiles identifier should be an index of the array returned on the game status.');
     $this->assertArrayHasKey($alice, $gameCurrentStatus, 'The number of Alice\'s tiles identifier should be an index of the array returned on the game status.');
     $this->assertEquals(15, $gameCurrentStatus['.'], 'Number of empty tiles should be the total of tiles available, minus Alice\'s tile (taken from her previous move).');
     $this->assertEquals(1, $gameCurrentStatus[$alice], 'Alice\'s owned tiles should be, since she made only one move.');
 }