public function testProcess() { $this->processor1->expects($this->any())->method('supports')->will($this->returnValue(true)); $this->processor1->expects($this->any())->method('isLinked')->will($this->returnValue(true)); $this->processor1->expects($this->once())->method('process'); $this->processor2->expects($this->any())->method('supports')->will($this->returnValue(true)); $this->processor2->expects($this->any())->method('isLinked')->will($this->returnValue(true)); $this->processor2->expects($this->once())->method('process'); $this->delegate->process(new SourceMock(123)); }
public function testProcessException() { $executor = new SourceProcessExecutor($this->manager, $this->processor, new NullLogger()); $source = new SourceMock(12345); $this->manager->expects($this->once())->method('findById')->will($this->returnValue($source)); $this->processor->expects($this->once())->method('isLinked')->will($this->returnValue(false)); $this->processor->expects($this->once())->method('process')->will($this->throwException(new SourceProcessException('Foobar'))); $this->assertFalse($executor->execute($executor->getObjectPayload($source))); $messages = $source->getMessages(); $this->assertInternalType('array', $messages); $this->assertArrayHasKey('process', $messages); $this->assertArrayHasKey(LogLevel::ERROR, $messages['process']); $this->assertContains('Foobar', $messages['process'][LogLevel::ERROR]); }
/** * @param SourceInterface $entity * * @return boolean */ protected function isSourceLinked($entity) { return $this->sourceProcessor->isLinked($entity); }