Jamm\Tester\ResultsPrinter::printFailedTests PHP Метод

printFailedTests() публичный Метод

public printFailedTests ( )
    public function printFailedTests()
    {
        $br = $this->newline;
        $all_tests_successful = true;
        foreach ($this->tests as $test) {
            if (!$test->isSuccessful()) {
                print $br . 'Test ' . $test->getName() . ' is failed.';
                $all_tests_successful = false;
                foreach ($test->getAssertions() as $assertion) {
                    if (!$assertion->isSuccessful()) {
                        print $br . 'Assertion ' . $assertion->getName() . ' is failed.' . $br . 'Expected result: ';
                        var_dump($assertion->getExpectedResult());
                        print 'Actual result: ';
                        var_dump($assertion->getActualResult());
                        $commentary = $assertion->getCommentary();
                        if (!empty($commentary)) {
                            print 'Commentary: ' . $commentary . $br;
                        }
                        print 'Method ' . $assertion->getDebugMethod() . ', line: ' . $assertion->getDebugLine() . ', file: ' . $assertion->getDebugFile() . $br . $this->line_separator . $br;
                    }
                }
            }
            if ($test->hasException()) {
                $exception = $test->getException();
                print $br . 'Exception in test ' . $test->getName() . ': ' . $br . 'Message: ' . $exception->getMessage() . $br . 'Code: ' . $exception->getCode() . $br . 'File: ' . $exception->getFile() . $br . 'Line: ' . $exception->getLine() . $br . 'Trace: ' . $exception->getTraceAsString() . $br;
            }
            $errors = $test->getErrors();
            if (!empty($errors)) {
                print $br . 'Errors in test ' . $test->getName() . ': ';
                foreach ($errors as $error) {
                    print $br . 'Error ' . $error->getCode() . ': "' . $error->getMessage() . '" in file ' . $error->getFilepath() . ', line ' . $error->getLine();
                    if ($this->print_errors_traces && ($trace = $error->getDebugTrace())) {
                        print 'Trace: ' . $br;
                        print_r($trace);
                        print $br;
                    }
                }
            }
        }
        if ($all_tests_successful) {
            print $br . 'All ' . count($this->tests) . ' tests are successful' . $br;
        }
    }