tests/GameOfLife/FieldTest.php
/**
     * Checks whether the Field can calculate the amount of living and dead neighbor fields.
     *
     * @covers \GameOfLife\Field::numberOfDeadNeighbors()
     * @covers \GameOfLife\Field::numberOfLivingNeighbors()
     * @dataProvider sumNeighborStatusesProvider
     *
     * @param int[] $_fieldCoordinates Coordinates of the field whose neighbours will be checked
     * @param int[][] $_livingNeighborsCoordinates Coordinates of the living neighbor cells
     * @param int $_amountLivingNeighbors Expected amount of living neighbors
     * @param int $_amountDeadNeighbors Expected amount of dead neighbors
     */
Checks whether the Field can calculate the amount of living and dead neighbor fields.

@param int[] $_fieldCoordinates Coordinates of the field whose neighbours will be checked
@param int[][] $_livingNeighborsCoordinates Coordinates of the living neighbor cells
@param int $_amountLivingNeighbors Expected amount of living neighbors
@param int $_amountDeadNeighbors Expected amount of dead neighbors
Checks whether the Field can calculate the amount of living and dead neighbor fields . @param int [] $_fieldCoordinates Coordinates of the field whose neighbours will be checked @param int [] [] $_livingNeighborsCoordinates Coordinates of the living neighbor cells @param int $_amountLivingNeighbors Expected amount of living neighbors @param int $_amountDeadNeighbors Expected amount of dead neighbors
public function testCanSumNeighborStatuses(array $_fieldCoordinates, array $_livingNeighborsCoordinates, int $_amountLivingNeighbors, int $_amountDeadNeighbors)
    {
        $field = new Field($_fieldCoordinates["x"], $_fieldCoordinates["y"], false, $this->board);
        foreach ($_livingNeighborsCoordinates as $livingNeighborCoordinates)
        {
            $this->board->setField($livingNeighborCoordinates["x"], $livingNeighborCoordinates["y"], true);
        }
        $this->assertEquals($_amountLivingNeighbors, $field->numberOfLivingNeighbors());
        $this->assertEquals($_amountDeadNeighbors, $field->numberOfDeadNeighbors());
    }
public function testCanSumNeighborStatuses ( array $ _fieldCoordinates , array $ _livingNeighborsCoordinates , int $ _amountLivingNeighbors , int $ _amountDeadNeighbors ) { $ field = new Field ( $ _fieldCoordinates [ " x " ] , $ _fieldCoordinates [ " y " ] , false , $ this -> board ) ; foreach ( $ _livingNeighborsCoordinates as $ livingNeighborCoordinates ) { $ this -> board -> setField ( $ livingNeighborCoordinates [ " x " ] , $ livingNeighborCoordinates [ " y " ] , true ) ; } $ this -> assertEquals ( $ _amountLivingNeighbors , $ field -> numberOfLivingNeighbors ( ) ) ; $ this -> assertEquals ( $ _amountDeadNeighbors , $ field -> numberOfDeadNeighbors ( ) ) ; }
Checks whether the Field can calculate the amount of living and dead neighbor fields.
Checks whether the Field can calculate the amount of living and dead neighbor fields .