tests/GameOfLife/Outputs/ImageOutputTest.php
/**
     * Checks whether a new unique game id can be generated.
     *
     * @covers \Output\ImageOutput::getNewGameId()
     */
Checks whether a new unique game id can be generated.
Checks whether a new unique game id can be generated .
public function testCanGetNewGameId()
    {
        $fileSystemHandlerMock = $this->getMockBuilder(\Utils\FileSystem\FileSystemReader::class)
                                      ->getMock();
        if ($fileSystemHandlerMock instanceof \Utils\FileSystem\FileSystemReader)
        {
            setPrivateAttribute($this->output, "fileSystemReader", $fileSystemHandlerMock);
        }
        $fileSystemHandlerMock->expects($this->exactly(3))
                              ->method("getFileList")
                              ->willReturnOnConsecutiveCalls(array(), array("Game_1"), array("Game_1", "Game_2"));
        $this->assertEquals(1, $this->output->getNewGameId("PNG"));
        $this->assertEquals(2, $this->output->getNewGameId("Gif"));
        $this->assertEquals(3, $this->output->getNewGameId("Video"));
    }
public function testCanGetNewGameId ( ) { $ fileSystemHandlerMock = $ this -> getMockBuilder ( \ Utils \ FileSystem \ FileSystemReader :: class ) -> getMock ( ) ; if ( $ fileSystemHandlerMock instanceof \ Utils \ FileSystem \ FileSystemReader ) { setPrivateAttribute ( $ this -> output , " fileSystemReader " , $ fileSystemHandlerMock ) ; } $ fileSystemHandlerMock -> expects ( $ this -> exactly ( 3 ) ) -> method ( " getFileList " ) -> willReturnOnConsecutiveCalls ( array ( ) , array ( " Game_1 " ) , array ( " Game_1 " , " Game_2 " ) ) ; $ this -> assertEquals ( 1 , $ this -> output -> getNewGameId ( " PNG " ) ) ; $ this -> assertEquals ( 2 , $ this -> output -> getNewGameId ( " Gif " ) ) ; $ this -> assertEquals ( 3 , $ this -> output -> getNewGameId ( " Video " ) ) ; }
Checks whether a new unique game id can be generated.
Checks whether a new unique game id can be generated .