Exemple #1
0
 /**
  * @test
  * @covers Cocur\Plum\Result::addException()
  * @covers Cocur\Plum\Result::getExceptions()
  * @covers Cocur\Plum\Result::getErrorCount()
  */
 public function addExceptionShouldAddException()
 {
     $exception = new \Exception();
     $this->result->addException($exception);
     $this->assertContains($exception, $this->result->getExceptions());
     $this->assertEquals(1, $this->result->getErrorCount());
 }
Exemple #2
0
 /**
  * @param mixed  $item
  * @param Result $result
  *
  * @return void
  */
 protected function processItem($item, Result $result)
 {
     $written = false;
     foreach ($this->pipeline as $element) {
         if ($element[0] === self::PIPELINE_TYPE_FILTER) {
             if ($element[1]->filter($item) === false) {
                 return;
             }
         } else {
             if ($element[0] === self::PIPELINE_TYPE_CONVERTER) {
                 $item = $this->convertItem($item, $element[1], $element[2]);
             } else {
                 if ($element[0] === self::PIPELINE_TYPE_WRITER) {
                     if ($this->writeItem($item, $element[1], $element[2]) === true) {
                         $result->incWriteCount();
                         $written = true;
                     }
                 }
             }
         }
     }
     if ($written === true) {
         $result->incItemWriteCount();
     }
 }