public function execute(EditTranslationPhraseAction $action)
 {
     $key = $action->getKey();
     $locale = $action->getLocale();
     $phrase = $key->getPhrase($locale);
     if (null === $phrase) {
         $phrase = $this->translationRepository->createNewPhrase($key, $locale);
     }
     $phrase->setText($action->getText());
     $phrase->setApproved($action->isApproved());
     $this->translationRepository->savePhrase($phrase);
     return $phrase;
 }
 function it_should_edit_translation(TranslationRepository $translationRepository, EventDispatcherInterface $eventDispatcher, Key $key, Phrase $phrase, EditTranslationPhraseAction $action)
 {
     $locale = Locale::parse('en');
     $action->getKey()->willReturn($key);
     $action->getLocale()->willReturn($locale);
     $action->getText()->willReturn('foobar');
     $action->isApproved()->willReturn(true);
     $key->hasPhrase($locale)->willReturn(true);
     $key->getPhrase($locale)->willReturn($phrase);
     $phrase->setText('foobar')->shouldBeCalled();
     $phrase->setApproved(true)->shouldBeCalled();
     $translationRepository->savePhrase($phrase)->shouldBeCalled();
     $this->execute($action)->shouldReturn($phrase);
 }