예제 #1
0
파일: Workflow.php 프로젝트: cocur/plum
 /**
  * @param ReaderInterface $reader
  *
  * @return Result
  */
 public function process(ReaderInterface $reader)
 {
     $result = new Result();
     $this->prepareWriters($this->getWriters());
     foreach ($reader as $item) {
         $result->incReadCount();
         try {
             $this->processItem($item, $result);
         } catch (\Exception $e) {
             $result->addException($e);
         }
     }
     $this->finishWriters($this->getWriters());
     return $result;
 }
예제 #2
0
파일: ResultTest.php 프로젝트: cocur/plum
 /**
  * @test
  * @covers Cocur\Plum\Result::incReadCount()
  * @covers Cocur\Plum\Result::getReadCount()
  */
 public function incReadCountShouldIncreaseReadCount()
 {
     $this->result->incReadCount();
     $this->assertEquals(1, $this->result->getReadCount());
 }