tests/GameOfLife/Inputs/UserInputTest.php
/**
     * Checks whether a template can be loaded using the --edit option.
     *
     * @covers \Input\UserInput::fillBoard()
     *
     * @throws \Exception
     */
Checks whether a template can be loaded using the --edit option.

@throws \Exception
Checks whether a template can be loaded using the -- edit option . @throws \ Exception
public function testCanLoadTemplate()
    {
        $this->optionsMock->expects($this->exactly(10))
                          ->method("getOption")
                          ->withConsecutive(array("edit"), array("template"), array("template"), array("templatePosX"),
                                            array("templatePosY"), array("templatePosX"), array("templatePosY"),
                                            array("width"), array("height"), array("invertTemplate"))
                          ->willReturn(true, "unittest", "unittest", null, null, null, null, null, null, null);
        $this->boardEditorMock->expects($this->exactly(1))
                              ->method("launch")
                              ->will($this->returnValue(null));
        if ($this->optionsMock instanceof Getopt) $this->input->fillBoard($this->board, $this->optionsMock);
        $this->assertEquals(1, $this->board->getAmountCellsAlive());
        $this->assertTrue($this->board->getFieldStatus(0, 0));
        $this->assertEquals(2, $this->board->width());
        $this->assertEquals(2, $this->board->height());
    }
public function testCanLoadTemplate ( ) { $ this -> optionsMock -> expects ( $ this -> exactly ( 10 ) ) -> method ( " getOption " ) -> withConsecutive ( array ( " edit " ) , array ( " template " ) , array ( " template " ) , array ( " templatePosX " ) , array ( " templatePosY " ) , array ( " templatePosX " ) , array ( " templatePosY " ) , array ( " width " ) , array ( " height " ) , array ( " invertTemplate " ) ) -> willReturn ( true , " unittest " , " unittest " , null , null , null , null , null , null , null ) ; $ this -> boardEditorMock -> expects ( $ this -> exactly ( 1 ) ) -> method ( " launch " ) -> will ( $ this -> returnValue ( null ) ) ; if ( $ this -> optionsMock instanceof Getopt ) $ this -> input -> fillBoard ( $ this -> board , $ this -> optionsMock ) ; $ this -> assertEquals ( 1 , $ this -> board -> getAmountCellsAlive ( ) ) ; $ this -> assertTrue ( $ this -> board -> getFieldStatus ( 0 , 0 ) ) ; $ this -> assertEquals ( 2 , $ this -> board -> width ( ) ) ; $ this -> assertEquals ( 2 , $ this -> board -> height ( ) ) ; }
Checks whether a template can be loaded using the --edit option.
Checks whether a template can be loaded using the -- edit option .