コード例 #1
0
 protected function createActionDefinitions()
 {
     $actionDefinition1 = new ActionDefinition('test1', 'orderTopic1');
     $actionDefinition1->setEventName('v.action.test1');
     $actionDefinition1->setParameters(array('p1' => 'v1', 'p2' => 'v2'));
     $actionDefinition1->setVersion(2);
     $actionDefinition2 = new ActionDefinition('test2', 'orderTopic2');
     $actionDefinition1->setEventName('v.action.test2');
     $actionDefinition2->setParameters(array('p1' => 'v1', 'p2' => 'v2'));
     $actionDefinition1->setVersion(3);
     return array($actionDefinition1, $actionDefinition2);
 }
コード例 #2
0
 public function testCreateAction()
 {
     $actionDefinition = new ActionDefinition('test', 'v.test');
     $parameters = array('par1' => 'val1', 'par2' => 'val2');
     $actionDefinition->setParameters($parameters);
     $action = $this->handler->createAction($actionDefinition);
     $this->assertInstanceOf('Vespolina\\Entity\\Action\\Action', $action);
     //Assert that parameters where correctly copied to the context
     $context = $action->getContext();
     foreach ($parameters as $key => $value) {
         $contextValue = $context[$key];
         $this->assertEquals($contextValue, $value);
     }
 }