コード例 #1
0
 function it_should_create_language(LanguageRepository $languageRepository, EventDispatcherInterface $eventDispatcher, Project $project, Language $language, CreateLanguageAction $action)
 {
     $action->getProject()->willReturn($project);
     $action->getLocale()->willReturn('fr_FR');
     $languageRepository->createNew($project, Argument::exact(Locale::parse('fr_FR')))->willReturn($language);
     $languageRepository->save($language)->shouldBeCalled();
     $this->execute($action)->shouldReturn($language);
 }
コード例 #2
0
 public function execute(CreateLanguageAction $action)
 {
     $project = $action->getProject();
     $locale = Locale::parse($action->getLocale());
     $language = $this->languageRepository->createNew($project, $locale);
     $this->languageRepository->save($language);
     return $language;
 }