tests/GameOfLife/OptionHandler/OptionParserTest.php
/**
     * Checks whether input options are parsed correctly.
     *
     * @param String $_optionParseFunction The function that will be tested
     * @param array $_returnValueMaps The return values for "getOption" in the format array("optionName", "returnValue")
     * @param String $_expectedClass The expected input class that is returned from parsing the input options
     * @param String[] $_excludeClasses The excluded classes
     * @param array $_linkedOptions The linked options array
     *
     * @dataProvider parseClassOptionsProvider()
     * @covers \OptionHandler\OptionParser::parseInputOptions()
     * @covers \OptionHandler\OptionParser::parseOutputOptions()
     * @covers \OptionHandler\OptionParser::parseRuleOptions()
     * @covers \OptionHandler\OptionParser::parseClassOptions()
     */
Checks whether input options are parsed correctly.


Checks whether input options are parsed correctly .
public function testCanParseClassOptions(String $_optionParseFunction, array $_returnValueMaps, String $_expectedClass, array $_excludeClasses, array $_linkedOptions = array())
    {
        $this->optionsMock->expects($this->exactly(count($_returnValueMaps)))
                          ->method("getOption")
                          ->willReturnmap($_returnValueMaps);
        if (count($_excludeClasses) > 0)
        {
            $this->parentOptionHandlerMock->expects($this->exactly(1))
                                          ->method("excludeClasses")
                                          ->willReturn($_excludeClasses);
        }
        $this->parentOptionHandlerMock->expects($this->atMost(1))
                                      ->method("linkedOptions")
                                      ->willReturn($_linkedOptions);
        if ($this->optionsMock instanceof Getopt)
        {
            $input = $this->optionParser->$_optionParseFunction($this->optionsMock);
            $this->assertInstanceOf($_expectedClass, $input);
        }
    }
public function testCanParseClassOptions ( String $ _optionParseFunction , array $ _returnValueMaps , String $ _expectedClass , array $ _excludeClasses , array $ _linkedOptions = array ( ) ) { $ this -> optionsMock -> expects ( $ this -> exactly ( count ( $ _returnValueMaps ) ) ) -> method ( " getOption " ) -> willReturnmap ( $ _returnValueMaps ) ; if ( count ( $ _excludeClasses ) > 0 ) { $ this -> parentOptionHandlerMock -> expects ( $ this -> exactly ( 1 ) ) -> method ( " excludeClasses " ) -> willReturn ( $ _excludeClasses ) ; } $ this -> parentOptionHandlerMock -> expects ( $ this -> atMost ( 1 ) ) -> method ( " linkedOptions " ) -> willReturn ( $ _linkedOptions ) ; if ( $ this -> optionsMock instanceof Getopt ) { $ input = $ this -> optionParser -> $ _optionParseFunction ( $ this -> optionsMock ) ; $ this -> assertInstanceOf ( $ _expectedClass , $ input ) ; } }
Checks whether input options are parsed correctly.
Checks whether input options are parsed correctly .