tests/GameOfLife/Outputs/BoardEditorOutputTest.php
/**
     * Checks whether the output looks like expected.
     *
     * @covers \Output\BoardEditorOutput::outputBoard()
     * @covers \Output\BoardEditorOutput::getBoardContentString()
     * @covers \Output\BoardEditorOutput::getRowOutputString()
     */
Checks whether the output looks like expected.
Checks whether the output looks like expected .
public function testCanOutputBoard()
    {
        $testBoard = new Board(5, 5, 3, 1);
        $testBoard->setField(1, 2, true);
        $testBoard->setField(2, 1, true);
        $testBoard->setField(2, 2, true);
        $testBoard->setField(2, 3, true);
        $testBoard->setField(3, 2, true);
        $output = new BoardEditorOutput;
        $expectedOutput = " *╔═════╗\n"
                        . " *║     ║\n"
                        . " *║  o  ║\n"
                        . " *║ ooo ║\n"
                        . " *║  o  ║\n"
                        . " *║     ║\n"
                        . " *╚═════╝\n";
        $this->expectOutputRegex("~.*" . $expectedOutput . ".*~");
        $output->outputBoard($testBoard);
        $expectedOutput = " *    2   \n"
                        . " *╔══╤═╤══╗\n"
                        . " *║  │ │  ║\n"
                        . " *║  │o│  ║\n"
                        . " *║ o│o│o ║\n"
                        . " *╟──┼─┼──╢\n"
                        . " *║  │X│  ║ 3\n"
                        . " *╟──┼─┼──╢\n"
                        . " *║  │ │  ║\n"
                        . " *╚══╧═╧══╝\n";
        $this->expectOutputRegex("~.*" . $expectedOutput . ".*~");
        $output->outputBoard($testBoard, false, 2, 3);
    }
public function testCanOutputBoard ( ) { $ testBoard = new Board ( 5 , 5 , 3 , 1 ) ; $ testBoard -> setField ( 1 , 2 , true ) ; $ testBoard -> setField ( 2 , 1 , true ) ; $ testBoard -> setField ( 2 , 2 , true ) ; $ testBoard -> setField ( 2 , 3 , true ) ; $ testBoard -> setField ( 3 , 2 , true ) ; $ output = new BoardEditorOutput ; $ expectedOutput = "  *╔═════╗\n" . "  *║     ║\n" . "  *║  o  ║\n" . "  *║ ooo ║\n" . "  *║  o  ║\n" . "  *║     ║\n" . "  *╚═════╝\n"; $ this -> expectOutputRegex ( " ~.* " . $ expectedOutput . " .*~ " ) ; $ output -> outputBoard ( $ testBoard ) ; $ expectedOutput = "  *    2    \n " . "  *╔══╤═╤══╗\n" . "  *║  │ │  ║\n" . "  *║  │o│  ║\n" . "  *║ o│o│o ║\n" . "  *╟──┼─┼──╢\n" . "  *║  │X│  ║ 3\n" . "  *╟──┼─┼──╢\n" . "  *║  │ │  ║\n" . "  *╚══╧═╧══╝\n"; $ this -> expectOutputRegex ( " ~.* " . $ expectedOutput . " .*~ " ) ; $ output -> outputBoard ( $ testBoard , false , 2 , 3 ) ; }
Checks whether the output looks like expected.
Checks whether the output looks like expected .
// Without highlighting // With x/y highlighting