/** * Get action type * * @param ActionInterface $action * * @return null|string */ protected function getRegistryIdentifier($action) { if ($action instanceof ActionInterface && null !== $action->getType()) { return $action->getType(); } if (null !== $this->registryIdentifier) { return $this->registryIdentifier; } return null; }
function it_should_revert_all_actions_registered(ServiceRegistryInterface $registry, PromotionActionInterface $action, PromotionSubjectInterface $subject, PromotionInterface $promotion, ActionInterface $actionModel) { $configuration = []; $registry->get('test_action')->shouldBeCalled()->willReturn($action); $promotion->getActions()->shouldBeCalled()->willReturn([$actionModel]); $actionModel->getType()->shouldBeCalled()->willReturn('test_action'); $actionModel->getConfiguration()->shouldBeCalled()->willReturn($configuration); $action->revert($subject, $configuration, $promotion)->shouldBeCalled(); $subject->removePromotion($promotion)->shouldBeCalled(); $this->revert($subject, $promotion); }
function it_should_revert_all_actions_registered(ServiceRegistryInterface $registry, PromotionActionInterface $action, PromotionSubjectInterface $subject, PromotionInterface $promotion, ActionInterface $actionModel) { $configuration = array(); $registry->get(ActionInterface::TYPE_FIXED_DISCOUNT)->shouldBeCalled()->willReturn($action); $promotion->getActions()->shouldBeCalled()->willReturn(array($actionModel)); $actionModel->getType()->shouldBeCalled()->willReturn(ActionInterface::TYPE_FIXED_DISCOUNT); $actionModel->getConfiguration()->shouldBeCalled()->willReturn($configuration); $action->revert($subject, $configuration, $promotion)->shouldBeCalled(); $subject->removePromotion($promotion)->shouldBeCalled(); $this->revert($subject, $promotion); }