/**
  * {@inheritdoc}
  */
 public function filter($collection)
 {
     if (empty($this->locators)) {
         return $collection;
     }
     foreach ($collection as $key => $action) {
         if ($action instanceof TimelineInterface) {
             $action = $action->getAction();
         }
         $entry = new Entry($action, $key);
         $entry->build();
         $this->addComponents($entry->getComponents());
     }
     return $this->hydrateComponents($collection);
 }
Beispiel #2
0
 public function testBuild()
 {
     $this->if($this->mockClass('\\Spy\\Timeline\\Model\\ActionInterface', '\\Mock'))->if($this->mockClass('\\Spy\\Timeline\\Model\\ActionComponentInterface', '\\Mock'))->if($this->mockClass('\\Spy\\Timeline\\Model\\ComponentInterface', '\\Mock'))->and($component1 = new \Mock\ComponentInterface())->and($component1->getMockController()->getHash = 'hashOA')->and($component2 = new \Mock\ComponentInterface())->and($component2->getMockController()->getHash = 'hashoir')->and($component3 = new \Mock\ComponentInterface())->and($component3->getMockController()->getData = 'already set')->and($actionComponent1 = new \Mock\ActionComponentInterface())->and($actionComponent1->getMockController()->getComponent = $component1)->and($actionComponent2 = new \Mock\ActionComponentInterface())->and($actionComponent2->getMockController()->getComponent = $component2)->and($actionComponent3 = new \Mock\ActionComponentInterface())->and($actionComponent3->getMockController()->getComponent = $component2)->and($action = new \Mock\ActionInterface())->and($action->getMockController()->getActionComponents = array($actionComponent1, $actionComponent2, $actionComponent3))->and($entry = new TestedModel($action, 'key'))->when($entry->build())->array($entry->getComponents())->isIdenticalTo(array('hashOA' => $component1, 'hashoir' => $component2));
 }