src/Reporter/Terminal.php
protected function _reportFailure($log)
    {
        $this->_indent++;
        $type = $log->type();
        switch ($type) {
            case "failed":
                foreach ($log->children() as $expectation) {
                    if ($expectation->type() !== 'failed') {
                        continue;
                    }

                    $data = $expectation->data();
                    $isExternal = isset($data['external']) && $data['external'];

                    if ($isExternal) {
                        $this->write("expectation failed in ", 'red');
                    } else {
                        $this->write("expect->{$expectation->matcherName()}() failed in ", 'red');
                    }

                    $this->write("`{$expectation->file()}` ");
                    $this->write("line {$expectation->line()}", 'red');
                    $this->write("\n\n");

                    if ($isExternal) {
                        $this->write($data['description']);
                        $this->write("\n\n");
                    } else {
                        $this->_reportDiff($expectation);
                    }
                }
                break;
            case "errored":
                $backtrace = Debugger::backtrace(['trace' => $log->exception()]);
                $trace = reset($backtrace);
                $file = $trace['file'];
                $line = $trace['line'];

                $this->write("an uncaught exception has been thrown in ", 'magenta');
                $this->write("`{$file}` ");
                $this->write("line {$line}", 'magenta');
                $this->write("\n\n");

                $this->write('message:', 'yellow');
                $this->_reportException($log->exception());
                $this->prefix($this->format(' ', 'n;;magenta') . ' ');
                $this->write(Debugger::trace(['trace' => $backtrace]));
                $this->prefix('');
                $this->write("\n\n");
                break;
        }
        $this->_indent--;
    }
protected function _reportFailure($log)
    {
        $this->_indent++;
        $type = $log->type();
        switch ($type) {
            case "failed":
                foreach ($log->children() as $expectation) {
                    if ($expectation->type() !== 'failed') {
                        continue;
                    }

                    $data = $expectation->data();
                    $isExternal = isset($data['external']) && $data['external'];

                    if ($isExternal) {
                        $this->write("expectation failed in ", 'red');
                    } else {
                        $this->write("expect->{$expectation->matcherName()}() failed in ", 'red');
                    }

                    $this->write("`{$expectation->file()}` ");
                    $this->write("line {$expectation->line()}", 'red');
                    $this->write("\n\n");

                    if ($isExternal) {
                        $this->write($data['description']);
                        $this->write("\n\n");
                    } else {
                        $this->_reportDiff($expectation);
                    }
                }
                break;
            case "errored":
                $backtrace = Debugger::backtrace(['trace' => $log->exception()]);
                $trace = reset($backtrace);
                $file = $trace['file'];
                $line = $trace['line'];

                $this->write("an uncaught exception has been thrown in ", 'magenta');
                $this->write("`{$file}` ");
                $this->write("line {$line}", 'magenta');
                $this->write("\n\n");

                $this->write('message:', 'yellow');
                $this->_reportException($log->exception());
                $this->prefix($this->format(' ', 'n;;magenta') . ' ');
                $this->write(Debugger::trace(['trace' => $backtrace]));
                $this->prefix('');
                $this->write("\n\n");
                break;
        }
        $this->_indent--;
    }
protected function _reportFailure ( $ log ) { $ this -> _indent ++ ; $ type = $ log -> type ( ) ; switch ( $ type ) { case "failed" : foreach ( $ log -> children ( ) as $ expectation ) { if ( $ expectation -> type ( ) !== 'failed' ) { continue ; } $ data = $ expectation -> data ( ) ; $ isExternal = isset ( $ data [ 'external' ] ) && $ data [ 'external' ] ; if ( $ isExternal ) { $ this -> write ( "expectation failed in " , 'red' ) ; } else { $ this -> write ( "expect->{$expectation->matcherName()}() failed in " , 'red' ) ; } $ this -> write ( "`{$expectation->file()}` " ) ; $ this -> write ( "line {$expectation->line()}" , 'red' ) ; $ this -> write ( "\n\n" ) ; if ( $ isExternal ) { $ this -> write ( $ data [ 'description' ] ) ; $ this -> write ( "\n\n" ) ; } else { $ this -> _reportDiff ( $ expectation ) ; } } break ; case "errored" : $ backtrace = Debugger :: backtrace ( [ 'trace' => $ log -> exception ( ) ] ) ; $ trace = reset ( $ backtrace ) ; $ file = $ trace [ 'file' ] ; $ line = $ trace [ 'line' ] ; $ this -> write ( "an uncaught exception has been thrown in " , 'magenta' ) ; $ this -> write ( "`{$file}` " ) ; $ this -> write ( "line {$line}" , 'magenta' ) ; $ this -> write ( "\n\n" ) ; $ this -> write ( 'message:' , 'yellow' ) ; $ this -> _reportException ( $ log -> exception ( ) ) ; $ this -> prefix ( $ this -> format ( ' ' , 'n;;magenta' ) . ' ' ) ; $ this -> write ( Debugger :: trace ( [ 'trace' => $ backtrace ] ) ) ; $ this -> prefix ( '' ) ; $ this -> write ( "\n\n" ) ; break ; } $ this -> _indent -- ; }
Print an expectation report.

@param object $log An specification log.
Print an expectation report .