PhpBench\Tests\Benchmark\RunnerTest::testHandleExceptions PHP Метод

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

It should handle nested exceptions.
    public function testHandleExceptions()
    {
        $subject = new SubjectMetadata($this->benchmark->reveal(), 'name', 0);
        $this->benchmark->getSubjects()->willReturn([$subject]);
        TestUtil::configureBenchmarkMetadata($this->benchmark);
        $this->executor->execute(Argument::type('PhpBench\\Benchmark\\Metadata\\SubjectMetadata'), Argument::type('PhpBench\\Model\\Iteration'), $this->executorConfig)->shouldBeCalledTimes(1)->willThrow(new \Exception('Foobar', null, new \InvalidArgumentException('Barfoo')));
        $suite = $this->runner->run(new RunnerContext(__DIR__));
        $errorStacks = $suite->getErrorStacks();
        $this->assertCount(1, $errorStacks);
        $errorStack = iterator_to_array(reset($errorStacks));
        $this->assertCount(2, $errorStack);
        $this->assertEquals('Exception', $errorStack[0]->getClass());
        $this->assertEquals('InvalidArgumentException', $errorStack[1]->getClass());
        $this->assertEquals('Foobar', $errorStack[0]->getMessage());
        $this->assertEquals('Barfoo', $errorStack[1]->getMessage());
    }