tests/GameOfLife/Inputs/BoardEditor/OptionHandler/BoardEditorOptionLoaderTest.php
/**
     * Checks whether options can be successfully loaded.
     *
     * @covers \BoardEditor\OptionHandler\BoardEditorOptionLoader::loadOptions()
     *
     * @throws \Exception
     */
Checks whether options can be successfully loaded.

@throws \Exception
Checks whether options can be successfully loaded . @throws \ Exception
public function testCanLoadOptions()
    {
        $boardEditor = new BoardEditor("test");
        $optionHandler = new BoardEditorOptionHandler($boardEditor);
        $optionLoader = new BoardEditorOptionLoader($optionHandler);
        $fileSystemHandlerMock = $this->getMockBuilder(FileSystemReader::class)
                                      ->getMock();
        if ($fileSystemHandlerMock instanceof FileSystemReader) $optionLoader->setFileSystemHandler($fileSystemHandlerMock);
        $templateDirectory = "testing";
        $fileSystemHandlerMock->expects($this->exactly(1))
            ->method("getFileList")
            ->with($templateDirectory . "/*Option.php")
            ->willReturn(array("ExitOption", "StartOption"));
        $result = $optionLoader->loadOptions($templateDirectory);
        $expectedResult = array(
            "exit" =>  new ExitOption($boardEditor),
            "start" =>new StartOption($boardEditor)
        );
        $this->assertEquals($expectedResult, $result);
    }
public function testCanLoadOptions ( ) { $ boardEditor = new BoardEditor ( " test " ) ; $ optionHandler = new BoardEditorOptionHandler ( $ boardEditor ) ; $ optionLoader = new BoardEditorOptionLoader ( $ optionHandler ) ; $ fileSystemHandlerMock = $ this -> getMockBuilder ( FileSystemReader :: class ) -> getMock ( ) ; if ( $ fileSystemHandlerMock instanceof FileSystemReader ) $ optionLoader -> setFileSystemHandler ( $ fileSystemHandlerMock ) ; $ templateDirectory = " testing " ; $ fileSystemHandlerMock -> expects ( $ this -> exactly ( 1 ) ) -> method ( " getFileList " ) -> with ( $ templateDirectory . " /*Option.php " ) -> willReturn ( array ( " ExitOption " , " StartOption " ) ) ; $ result = $ optionLoader -> loadOptions ( $ templateDirectory ) ; $ expectedResult = array ( " exit " => new ExitOption ( $ boardEditor ) , " start " => new StartOption ( $ boardEditor ) ) ; $ this -> assertEquals ( $ expectedResult , $ result ) ; }
Checks whether options can be successfully loaded.
Checks whether options can be successfully loaded .