Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function flow(NodeInterface $node)
 {
     $collection = new NodeCollection();
     foreach ($this->items as $flow) {
         $collection->add($flow->flow($node));
     }
     return $collection;
 }
Beispiel #2
0
 public function testBuildingAFlowWhenALoggerIsSetWillSetTheLoggerOnTheChild()
 {
     $logger = m::mock(LoggerInterface::class);
     $this->builder->setLogger($logger);
     $logger->shouldReceive('log')->times(2);
     $flow = $this->builder->buildFlow('first');
     $collection = new NodeCollection();
     $node = m::mock(NodeInterface::class);
     $collection->add($node);
     $first = $flow->flow($collection);
     static::assertEquals($node, $first);
 }
Beispiel #3
0
 /**
  * @param mixed $value
  *
  * @return $this
  */
 public function add($value)
 {
     if (!$value instanceof FileNodeInterface) {
         throw new InvalidArgumentException("The specified value does not implement FileNodeInterface");
     }
     return parent::add($value);
 }
Beispiel #4
0
 public function testCloneWillCloneTheChildObjects()
 {
     $first = m::mock(NodeInterface::class);
     $second = m::mock(NodeInterface::class);
     $collection = new NodeCollection([$first, $second]);
     $collection2 = $collection->getClone();
     static::assertNotSame($collection, $collection2);
     static::assertEquals($collection->count(), $collection2->count());
     for ($i = 0; $i < $collection->count(); $i++) {
         static::assertNotSame($collection->getAll()[$i], $collection2->getAll()[$i]);
     }
 }