public function testExecute() { $action = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Action\\ActionInterface')->disableOriginalConstructor()->getMockForAbstractClass(); $action->expects($this->exactly(2))->method('execute')->with($this->testContext); $condition = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Condition\\ConditionInterface')->disableOriginalConstructor()->getMockForAbstractClass(); $condition->expects($this->never())->method('isAllowed'); $this->assembler->expects($this->once())->method('assemble')->with($this->testConfiguration)->will($this->returnValue($action)); $this->configurableAction->initialize($this->testConfiguration); $this->configurableAction->setCondition($condition); // run twice to test cached action $this->configurableAction->execute($this->testContext); $this->configurableAction->execute($this->testContext); }
/** * {@inheritdoc} */ protected function executeAction($context) { $array = $this->getArray($context); $hasKey = $this->hasKey(); foreach ($array as $key => $value) { if ($hasKey) { $this->setKey($context, $key); } $this->setValue($context, $value); $this->configurableAction->execute($context); if ($hasKey) { $this->setKey($context, null); } $this->setValue($context, null); } }