tests/Application/ConsoleApplicationTest.php
/**
     * Test running application with failed test suite.
     */
Test running application with failed test suite.
Test running application with failed test suite .
public function testFailedTestSuite()
    {
        $testfilePath = FilePath::parse(__DIR__ . '/../Helpers/WebunitTests/fail.webunit');
        $consoleApplication = new ConsoleApplication(['webunit', $testfilePath->__toString()], $this->httpClient);
        ob_start();
        $result = $consoleApplication->run();
        $output = ob_get_contents();
        ob_end_clean();
        self::assertSame(5, $result);
        self::assertSame(
            'Webunit v' . ConsoleApplication::WEBUNIT_VERSION . PHP_EOL .
            "..\033[41m\033[1;37mF\033[0m\e[41m\e[1;37mF\e[0m" . PHP_EOL .
            "$testfilePath:4: Test failed: https://example.com/foo: Content \"This is Foo page.\" contains \"foo\" (case insensitive)." . PHP_EOL .
            "$testfilePath:6: Test failed: https://example.com/foobar: Status code 404 was returned." . PHP_EOL .
            "\033[41m\033[1;37m2 tests failed.\033[0m" . PHP_EOL,
            $output
        );
    }
public function testFailedTestSuite ( ) { $ testfilePath = FilePath :: parse ( __DIR__ . '/../Helpers/WebunitTests/fail.webunit' ) ; $ consoleApplication = new ConsoleApplication ( [ 'webunit' , $ testfilePath -> __toString ( ) ] , $ this -> httpClient ) ; ob_start ( ) ; $ result = $ consoleApplication -> run ( ) ; $ output = ob_get_contents ( ) ; ob_end_clean ( ) ; self :: assertSame ( 5 , $ result ) ; self :: assertSame ( 'Webunit v' . ConsoleApplication :: WEBUNIT_VERSION . PHP_EOL . " .. \033 [41m \033 [1;37mF \033 [0m \e [41m \e [1;37mF \e [0m " . PHP_EOL . " $ testfilePath :4: Test failed: https://example.com/foo: Content  \" This is Foo page. \"  contains  \" foo \"  (case insensitive). " . PHP_EOL . " $ testfilePath :6: Test failed: https://example.com/foobar: Status code 404 was returned. " . PHP_EOL . " \033 [41m \033 [1;37m2 tests failed. \033 [0m " . PHP_EOL , $ output ) ; }
Test running application with failed test suite.
Test running application with failed test suite .