tests/GameOfLife/Rules/CustomRuleTest.php
/**
     * Checks whether the rule can add its options to the option list.
     *
     * @covers \Rule\CustomRule::addOptions()
     */
Checks whether the rule can add its options to the option list.
Checks whether the rule can add its options to the option list .
public function testCanAddOptions()
    {
        $optionsMock = $this->getMockBuilder(\Ulrichsg\Getopt::class)
                            ->getMock();
        $expectedOptionList = array
        (
            array(null, "rulesString", Getopt::REQUIRED_ARGUMENT, "CustomRule - Rule string in the format <stayAlive>/<birth> or <stayAlive>G<stayAlive/birth>"),
            array(null, "rulesBirth", Getopt::REQUIRED_ARGUMENT, "CustomRule - The amounts of cells which will rebirth a dead cell as a single string"),
            array(null, "rulesStayAlive", Getopt::REQUIRED_ARGUMENT, "CustomRule - The amounts of cells which will keep a living cell alive")
        );
        $optionsMock->expects($this->exactly(1))
                    ->method("addOptions")
                    ->with($expectedOptionList);
        $rule = new CustomRule();
        if ($optionsMock instanceof \Ulrichsg\Getopt) $rule->addOptions($optionsMock);
    }
public function testCanAddOptions ( ) { $ optionsMock = $ this -> getMockBuilder ( \ Ulrichsg \ Getopt :: class ) -> getMock ( ) ; $ expectedOptionList = array ( array ( null , " rulesString " , Getopt :: REQUIRED_ARGUMENT , " CustomRule - Rule string in the format <stayAlive>/<birth> or <stayAlive>G<stayAlive/birth> " ) , array ( null , " rulesBirth " , Getopt :: REQUIRED_ARGUMENT , " CustomRule - The amounts of cells which will rebirth a dead cell as a single string " ) , array ( null , " rulesStayAlive " , Getopt :: REQUIRED_ARGUMENT , " CustomRule - The amounts of cells which will keep a living cell alive " ) ) ; $ optionsMock -> expects ( $ this -> exactly ( 1 ) ) -> method ( " addOptions " ) -> with ( $ expectedOptionList ) ; $ rule = new CustomRule ( ) ; if ( $ optionsMock instanceof \ Ulrichsg \ Getopt ) $ rule -> addOptions ( $ optionsMock ) ; }
Checks whether the rule can add its options to the option list.
Checks whether the rule can add its options to the option list .