public function testPawn_Move_LegalCoordinates_Forward_UpdatesCoordinates() { $this->_chessBoard->add($this->_testSubject, 6, 3, PieceColorEnum::BLACK()); $this->_testSubject->move(MovementTypeEnum::MOVE(), 6, 2); $this->assertEquals(6, $this->_testSubject->getXCoordinate()); $this->assertEquals(2, $this->_testSubject->getYCoordinate()); }
public function testLimits_The_Number_Of_Pawns() { for ($i = 0; $i < 10; $i++) { $pawn = new Pawn(PieceColorEnum::BLACK()); $row = $i / ChessBoard::MAX_BOARD_WIDTH; $this->_testSubject->add($pawn, 6 + $row, $i % ChessBoard::MAX_BOARD_WIDTH, PieceColorEnum::BLACK()); if ($row < 1) { $this->assertEquals(6 + $row, $pawn->getXCoordinate()); $this->assertEquals($i % ChessBoard::MAX_BOARD_WIDTH, $pawn->getYCoordinate()); } else { $this->assertEquals(-1, $pawn->getXCoordinate()); $this->assertEquals(-1, $pawn->getYCoordinate()); } } }