tests/Application/ConsoleApplicationTest.php
/**
     * Test running application with parse errors in test file.
     */
Test running application with parse errors in test file.
Test running application with parse errors in test file .
public function testParseErrors()
    {
        $testfilePath = FilePath::parse(__DIR__ . '/../Helpers/WebunitTests/parse-error.webunit');
        $consoleApplication = new ConsoleApplication(['webunit', $testfilePath->__toString()], $this->httpClient);
        ob_start();
        $result = $consoleApplication->run();
        $output = ob_get_contents();
        ob_end_clean();
        self::assertSame(4, $result);
        self::assertSame(
            'Webunit v' . ConsoleApplication::WEBUNIT_VERSION . PHP_EOL .
            "$testfilePath:4: Invalid argument: Invalid Url argument \"FooBar\" for \"get\": Url \"FooBar\" is invalid: Scheme is missing." . PHP_EOL .
            "$testfilePath:5: Syntax error: Invalid command \"baz\"." . PHP_EOL .
            "$testfilePath:7: Invalid argument: Status code -1 must be in range 100-599 for assert \"assert-status-code\"." . PHP_EOL .
            "$testfilePath:9: Missing variable: Missing variable value for \"set\" in \"FOO\"." . PHP_EOL .
            "$testfilePath:10: Invalid variable: Invalid variable name \"{Bar}\" for \"set-default\" in \"{Bar} = Baz\"." . PHP_EOL .
            "$testfilePath:12: Extra argument: \"BAZ\". No arguments are allowed for assert \"assert-empty\"." . PHP_EOL .
            "$testfilePath:15: Duplicate modifier: Modifier \"!\" is duplicated for assert \"assert-empty\"." . PHP_EOL .
            "\033[41m\033[1;37mParsing failed.\033[0m" . PHP_EOL,
            $output
        );
    }
public function testParseErrors ( ) { $ testfilePath = FilePath :: parse ( __DIR__ . '/../Helpers/WebunitTests/parse-error.webunit' ) ; $ consoleApplication = new ConsoleApplication ( [ 'webunit' , $ testfilePath -> __toString ( ) ] , $ this -> httpClient ) ; ob_start ( ) ; $ result = $ consoleApplication -> run ( ) ; $ output = ob_get_contents ( ) ; ob_end_clean ( ) ; self :: assertSame ( 4 , $ result ) ; self :: assertSame ( 'Webunit v' . ConsoleApplication :: WEBUNIT_VERSION . PHP_EOL . " $ testfilePath :4: Invalid argument: Invalid Url argument  \" FooBar \"  for  \" get \" : Url  \" FooBar \"  is invalid: Scheme is missing. " . PHP_EOL . " $ testfilePath :5: Syntax error: Invalid command  \" baz \" . " . PHP_EOL . " $ testfilePath :7: Invalid argument: Status code -1 must be in range 100-599 for assert  \" assert-status-code \" . " . PHP_EOL . " $ testfilePath :9: Missing variable: Missing variable value for  \" set \"  in  \" FOO \" . " . PHP_EOL . " $ testfilePath :10: Invalid variable: Invalid variable name  \" {Bar} \"  for  \" set-default \"  in  \" {Bar} = Baz \" . " . PHP_EOL . " $ testfilePath :12: Extra argument:  \" BAZ \" . No arguments are allowed for assert  \" assert-empty \" . " . PHP_EOL . " $ testfilePath :15: Duplicate modifier: Modifier  \" ! \"  is duplicated for assert  \" assert-empty \" . " . PHP_EOL . " \033 [41m \033 [1;37mParsing failed. \033 [0m " . PHP_EOL , $ output ) ; }
Test running application with parse errors in test file.
Test running application with parse errors in test file .