public function testItReportsErrorToAllErrorProcessorsEvenIfOneFails() { $processorOne = $this->getMockForAbstractClass('EcomDev_LayoutCompiler_Contract_ErrorProcessorInterface'); $processorTwo = $this->getMockForAbstractClass('EcomDev_LayoutCompiler_Contract_ErrorProcessorInterface'); $processorThree = $this->getMockForAbstractClass('EcomDev_LayoutCompiler_Contract_ErrorProcessorInterface'); $this->trait->addErrorProcessor($processorOne); $this->trait->addErrorProcessor($processorTwo); $this->trait->addErrorProcessor($processorThree); $testException = new RuntimeException('Test exception'); $processorOne->expects($this->once())->method('processException')->with($testException)->willReturnSelf(); $processorTwo->expects($this->once())->method('processException')->with($testException)->willThrowException(new RuntimeException('Test exception')); $processorThree->expects($this->once())->method('processException')->with($testException)->willReturnSelf(); $this->assertSame($this->trait, $this->trait->reportException($testException)); }
/** * Creates an instance of error processor * * @param EcomDev_LayoutCompiler_Contract_ErrorProcessorAwareInterface|null $forObject * @return EcomDev_LayoutCompiler_Contract_ErrorProcessorInterface */ private function createErrorProcessor($forObject = null) { $errorProcessor = $this->getMockForAbstractClass($this->errorProcessorInterface); if ($forObject !== null && $forObject instanceof EcomDev_LayoutCompiler_Contract_ErrorProcessorAwareInterface) { $forObject->addErrorProcessor($errorProcessor); } return $errorProcessor; }