/** * Tests that a source is scheduled for processing if it's unlinked. */ public function testScheduleSourceProcessOnSourceUnlinked() { $this->listener->expects($this->once())->method('isSourceModified')->will($this->returnValue(false)); $this->sourceProcessor->expects($this->once())->method('isLinked')->will($this->returnValue(false)); $this->eventDispatcher->expects($this->once())->method('dispatch')->with($this->equalTo(IoEvents::SOURCE_PROCESS)); $this->listener->onFlush($this->getOnFlushEventArgs(new SourceMock(12345))); $this->listener->postFlush(new PostFlushEventArgs($this->entityManager)); }
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($this->getPayload($executor, $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]); }