public function execute(EditProjectAction $action)
 {
     $name = new Name($action->getName());
     $locale = Locale::parse($action->getDefaultLocale());
     $description = $action->getDescription();
     $project = $action->getProject();
     $oldProject = clone $project;
     $project->setName($name);
     $project->setDefaultLocale($locale);
     $project->setDescription($description);
     $this->projectRepository->save($project);
     $this->eventDispatcher->dispatch(EditProjectEvent::NAME, new EditProjectEvent($project, $oldProject));
     return $project;
 }
 function it_should_edit_project(ProjectRepository $projectRepository, EventDispatcherInterface $eventDispatcher, Project $project, EditProjectAction $action)
 {
     $action->getProject()->willReturn($project);
     $action->getName()->willReturn('Foo Bar');
     $action->getDefaultLocale()->willReturn('fr_FR');
     $action->getDescription()->willReturn('Description');
     $project->setName(Argument::exact(new Name('Foo Bar')))->shouldBeCalled();
     $project->setDefaultLocale(Argument::exact(Locale::parse('fr_FR')))->shouldBeCalled();
     $project->setDescription(Argument::exact('Description'))->shouldBeCalled();
     $projectRepository->save($project)->shouldBeCalled();
     $eventDispatcher->dispatch(EditProjectEvent::NAME, Argument::type('Openl10n\\Domain\\Project\\Application\\Event\\EditProjectEvent'))->shouldBeCalled();
     $this->execute($action)->shouldReturn($project);
 }