tests/GameOfLife/Inputs/BoardEditor/OptionHandler/BoardEditorOptionHandlerTest.php
/**
     * Checks whether the option handler can successfully call the option parser.
     *
     * @covers \BoardEditor\OptionHandler\BoardEditorOptionHandler::parseInput()
     *
     * @throws \Exception
     */
Checks whether the option handler can successfully call the option parser.

@throws \Exception
Checks whether the option handler can successfully call the option parser . @throws \ Exception
public function testCanCallOptions()
    {
        $optionParserMock = $this->getMockBuilder(BoardEditorOptionParser::class)
                                 ->disableOriginalConstructor()
                                 ->getMock();
        $options = array("hello", "option", "this", "is", "my", "personal", "test");
        $boardEditor = new BoardEditor("test");
        $optionHandler = new BoardEditorOptionHandler($boardEditor);
        if ($optionParserMock instanceof BoardEditorOptionParser) $optionHandler->setOptionParser($optionParserMock);
        $optionHandler->setOptions($options);
        $input = "Hello, my option";
        $optionParserMock->expects($this->exactly(1))
                         ->method("callOption")
                         ->with($input)
                         ->willReturn(true);
        $this->assertTrue($optionHandler->parseInput($input));
    }
public function testCanCallOptions ( ) { $ optionParserMock = $ this -> getMockBuilder ( BoardEditorOptionParser :: class ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ options = array ( " hello " , " option " , " this " , " is " , " my " , " personal " , " test " ) ; $ boardEditor = new BoardEditor ( " test " ) ; $ optionHandler = new BoardEditorOptionHandler ( $ boardEditor ) ; if ( $ optionParserMock instanceof BoardEditorOptionParser ) $ optionHandler -> setOptionParser ( $ optionParserMock ) ; $ optionHandler -> setOptions ( $ options ) ; $ input = " Hello, my option " ; $ optionParserMock -> expects ( $ this -> exactly ( 1 ) ) -> method ( " callOption " ) -> with ( $ input ) -> willReturn ( true ) ; $ this -> assertTrue ( $ optionHandler -> parseInput ( $ input ) ) ; }
Checks whether the option handler can successfully call the option parser.
Checks whether the option handler can successfully call the option parser .