Esempio n. 1
0
        public void When_parse_error_is_formatted_with_no_stack_info_it_will_return_as_message()
        {
            var test = PhpUnitParseErrorParser.Parse("PHP Parse error:  syntax error, unexpected 'return' (T_RETURN)");

            Assert.That(test.Runner, Is.EqualTo(TestRunner.PhpParseError));
            Assert.That(test.Status, Is.EqualTo(TestRunStatus.Failed));
            Assert.That(test.Name, Is.EqualTo("syntax error, unexpected 'return' (T_RETURN)"));
            Assert.That(test.Message, Is.EqualTo("syntax error, unexpected 'return' (T_RETURN)"));
            Assert.That(test.StackTrace.Length, Is.EqualTo(0));
        }
Esempio n. 2
0
        public void When_parse_error_is_formatted_with_no_stacktrace_but_with_position_in_error_text_this_is_added_to_stacktrace()
        {
            var test = PhpUnitParseErrorParser.Parse("PHP Parse error:  syntax error, unexpected 'return' (T_RETURN) in /home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php on line 8");

            Assert.That(test.Runner, Is.EqualTo(TestRunner.PhpParseError));
            Assert.That(test.Status, Is.EqualTo(TestRunStatus.Failed));
            Assert.That(test.Name, Is.EqualTo("syntax error, unexpected 'return' (T_RETURN) in /home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php on line 8"));
            Assert.That(test.Message, Is.EqualTo("syntax error, unexpected 'return' (T_RETURN) in /home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php on line 8"));
            Assert.That(test.StackTrace.Length, Is.EqualTo(1));
        }
Esempio n. 3
0
        public void When_parse_error_is_wrongly_formatted_it_will_return_a_test_of_type_any_with_all_output()
        {
            var test = PhpUnitParseErrorParser.Parse("some error");

            Assert.That(test.Runner, Is.EqualTo(TestRunner.PhpParseError));
            Assert.That(test.Status, Is.EqualTo(TestRunStatus.Failed));
            Assert.That(test.Name, Is.EqualTo("some error"));
            Assert.That(test.Message, Is.EqualTo("some error"));
            Assert.That(test.StackTrace.Length, Is.EqualTo(0));
        }
Esempio n. 4
0
        public void When_parse_error_is_formatted_as_parse_stack_it_will_return_test_of_type_any_with_stacktrace()
        {
            var test = PhpUnitParseErrorParser.Parse(getParseError());

            Assert.That(test.Runner, Is.EqualTo(TestRunner.PhpParseError));
            Assert.That(test.Status, Is.EqualTo(TestRunStatus.Failed));
            Assert.That(test.Name, Is.EqualTo("syntax error, unexpected 'return' (T_RETURN) in /home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php on line 8"));
            Assert.That(test.Message, Is.EqualTo("syntax error, unexpected 'return' (T_RETURN) in /home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php on line 8"));
            Assert.That(test.StackTrace.Length, Is.EqualTo(15));
            Assert.That(test.StackTrace[0].Method, Is.EqualTo(""));
            Assert.That(test.StackTrace[0].File, Is.EqualTo("/home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php"));
            Assert.That(test.StackTrace[0].LineNumber, Is.EqualTo(8));
            Assert.That(test.StackTrace[0].ToString(), Is.EqualTo("/home/ack/src/tmp/SymfonyTest/src/Acme/DemoBundle/Utility/Parser.php:8"));
            Assert.That(test.StackTrace[1].Method, Is.EqualTo("{main}()"));
            Assert.That(test.StackTrace[1].File, Is.EqualTo("/usr/bin/phpunit"));
            Assert.That(test.StackTrace[1].LineNumber, Is.EqualTo(0));
            Assert.That(test.StackTrace[12].Method, Is.EqualTo("ReflectionMethod->invokeArgs()"));
            Assert.That(test.StackTrace[12].File, Is.EqualTo("/usr/share/php/PHPUnit/Framework/TestCase.php"));
            Assert.That(test.StackTrace[12].LineNumber, Is.EqualTo(942));
        }