tests/GameOfLife/Inputs/TemplateInputTest.php
/**
     * Checks whether the random input is selected when an invalid input type is selected.
     *
     * @covers \Input\TemplateInput::fillBoard()
     *
     * @throws \Exception
     */
Checks whether the random input is selected when an invalid input type is selected.

@throws \Exception
Checks whether the random input is selected when an invalid input type is selected . @throws \ Exception
public function testCanFallBackToRandomInput()
    {
        $optionsMock = $this->getMockBuilder(Ulrichsg\Getopt::class)
                            ->getMock();
        $optionsMock->expects($this->exactly(5))
                    ->method("getOption")
                    ->withConsecutive(array("template"), array("list-templates"), array("input"), array("input"), array("input"))
                    ->willReturn(null, null, "test", "test", "test");
        $board = new Board(10, 8, 5, true);
        if ($optionsMock instanceof \Ulrichsg\Getopt) $this->input->fillBoard($board, $optionsMock);
        $this->assertGreaterThanOrEqual(0.15, $board->getFillPercentage());
        $this->assertLessThanOrEqual(0.70, $board->getFillPercentage());
    }
public function testCanFallBackToRandomInput ( ) { $ optionsMock = $ this -> getMockBuilder ( Ulrichsg \ Getopt :: class ) -> getMock ( ) ; $ optionsMock -> expects ( $ this -> exactly ( 5 ) ) -> method ( " getOption " ) -> withConsecutive ( array ( " template " ) , array ( " list-templates " ) , array ( " input " ) , array ( " input " ) , array ( " input " ) ) -> willReturn ( null , null , " test " , " test " , " test " ) ; $ board = new Board ( 10 , 8 , 5 , true ) ; if ( $ optionsMock instanceof \ Ulrichsg \ Getopt ) $ this -> input -> fillBoard ( $ board , $ optionsMock ) ; $ this -> assertGreaterThanOrEqual ( 0.15 , $ board -> getFillPercentage ( ) ) ; $ this -> assertLessThanOrEqual ( 0.70 , $ board -> getFillPercentage ( ) ) ; }
Checks whether the random input is selected when an invalid input type is selected.
Checks whether the random input is selected when an invalid input type is selected .