예제 #1
0
 /**
  * @param string $type                 type
  * @param string $component            component
  * @param string $actionComponentClass actionComponentClass
  *
  * @return void
  */
 public function addComponent($type, $component, $actionComponentClass)
 {
     parent::addComponent($type, $component, $actionComponentClass);
     if ('subject' === $type && $component instanceof ComponentInterface) {
         // useful for actionManager->getSubjectActions()
         $this->subject = $this->getComponent('subject');
     }
 }
예제 #2
0
 public function testGetSubject()
 {
     // this is almost the same test than getComponent
     $this->if($action = new TestedModel())->variable($action->getComponent('subject'))->isNull()->when($action->addComponent('subject', 'chuckNorris', '\\Spy\\Timeline\\Model\\ActionComponent'))->string($action->getComponent('subject'))->isEqualTo('chuckNorris')->if($this->mockClass('\\Spy\\Timeline\\Model\\ComponentInterface', '\\Mock'))->and($component = new \Mock\ComponentInterface())->when($action->addComponent('subject', $component, '\\Spy\\Timeline\\Model\\ActionComponent'))->object($action->getComponent('subject'))->isIdenticalTo($component);
 }