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