function it_should_edit_translation(TranslationRepository $translationRepository, EventDispatcherInterface $eventDispatcher, Resource $resource, Key $key, CreateTranslationKeyAction $action) { $action->getResource()->willReturn($resource); $action->getIdentifier()->willReturn('foobar'); $translationRepository->createNewKey($resource, Argument::type('Openl10n\\Domain\\Translation\\Value\\StringIdentifier'))->willReturn($key); $translationRepository->saveKey($key)->shouldBeCalled(); $this->execute($action)->shouldReturn($key); }
public function execute(CreateTranslationKeyAction $action) { $resource = $action->getResource(); $identifier = new StringIdentifier($action->getIdentifier()); $key = $this->translationRepository->createNewKey($resource, $identifier); $this->translationRepository->saveKey($key); return $key; }