tests/GameOfLife/OptionHandler/OptionParserTest.php
/**
     * Checks whether the optionParser can parse general options.
     *
     * @covers \OptionHandler\OptionParser::__construct()
     * @covers \OptionHandler\OptionParser::parseGeneralOptions()
     */
Checks whether the optionParser can parse general options.
Checks whether the optionParser can parse general options .
public function testCanParseGeneralOptions()
    {
        $this->optionsMock->expects($this->exactly(5))
                          ->method("getOption")
                          ->withConsecutive(array("version"), array("version"), array("help"), array("version"), array("help"))
                          ->willReturn(true, null, true, null, null);
        if ($this->optionsMock instanceof Getopt)
        {
            $this->expectOutputRegex("/.*/");
            $generalOptionCalled = $this->optionParser->parseGeneralOptions($this->optionsMock);
            $this->assertTrue($generalOptionCalled);
            $generalOptionCalled = $this->optionParser->parseGeneralOptions($this->optionsMock);
            $this->assertTrue($generalOptionCalled);
            $generalOptionCalled = $this->optionParser->parseGeneralOptions($this->optionsMock);
            $this->assertFalse($generalOptionCalled);
        }
    }
public function testCanParseGeneralOptions ( ) { $ this -> optionsMock -> expects ( $ this -> exactly ( 5 ) ) -> method ( " getOption " ) -> withConsecutive ( array ( " version " ) , array ( " version " ) , array ( " help " ) , array ( " version " ) , array ( " help " ) ) -> willReturn ( true , null , true , null , null ) ; if ( $ this -> optionsMock instanceof Getopt ) { $ this -> expectOutputRegex ( " /.*/ " ) ; $ generalOptionCalled = $ this -> optionParser -> parseGeneralOptions ( $ this -> optionsMock ) ; $ this -> assertTrue ( $ generalOptionCalled ) ; $ generalOptionCalled = $ this -> optionParser -> parseGeneralOptions ( $ this -> optionsMock ) ; $ this -> assertTrue ( $ generalOptionCalled ) ; $ generalOptionCalled = $ this -> optionParser -> parseGeneralOptions ( $ this -> optionsMock ) ; $ this -> assertFalse ( $ generalOptionCalled ) ; } }
Checks whether the optionParser can parse general options.
Checks whether the optionParser can parse general options .
// Hide output