PhpBench\Tests\Unit\Progress\Logger\PhpBenchLoggerTest::testEndSuiteErrors PHP Метод

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

It should show errors.
public testEndSuiteErrors ( )
    public function testEndSuiteErrors()
    {
        $error1 = $this->prophesize(Error::class);
        $error1->getMessage()->willReturn('MessageOne');
        $error1->getClass()->willReturn('ExceptionOne');
        $error1->getTrace()->willReturn('-- trace --');
        $error2 = $this->prophesize(Error::class);
        $error2->getMessage()->willReturn('MessageTwo');
        $error2->getClass()->willReturn('ExceptionTwo');
        $error2->getTrace()->willReturn('-- trace --');
        $errorStack = $this->prophesize(ErrorStack::class);
        $errorStack->getVariant()->willReturn($this->variant->reveal());
        $errorStack->getIterator()->willReturn(new \ArrayIterator([$error1->reveal(), $error2->reveal()]));
        $this->setUpSummary();
        $this->suite->getErrorStacks()->willReturn([$errorStack]);
        $errorStack->getVariant()->willReturn($this->variant->reveal());
        $this->variant->getSubject()->willReturn($this->subject->reveal());
        $this->subject->getBenchmark()->willReturn($this->benchmark->reveal());
        $this->subject->getName()->willReturn('bar');
        $this->benchmark->getClass()->willReturn('Namespace\\Foo');
        $this->output->writeln(Argument::containingString('1 subjects encountered errors'))->shouldBeCalled();
        $this->output->writeln(Argument::containingString('Namespace\\Foo::bar'))->shouldBeCalled();
        $this->output->writeln(Argument::containingString('ExceptionOne'))->shouldBeCalled();
        $this->output->writeln(Argument::containingString('ExceptionTwo'))->shouldBeCalled();
        $this->output->writeln(Argument::containingString('MessageOne'))->shouldBeCalled();
        $this->output->writeln(Argument::containingString('Two'))->shouldBeCalled();
        $this->output->writeln(Argument::any())->shouldBeCalled();
        $this->logger->endSuite($this->suite->reveal());
    }

Usage Example

Пример #1
0
 /**
  * It should output an empty line at the end of the suite.
  */
 public function testEndSuiteErrors()
 {
     $this->output->write(PHP_EOL)->shouldBeCalled();
     parent::testEndSuiteErrors();
 }