public function execute(CreateProjectAction $action)
 {
     $name = new Name($action->getName());
     $slug = new Slug($action->getSlug());
     $locale = Locale::parse($action->getDefaultLocale());
     $description = $action->getDescription();
     $project = $this->projectRepository->createNew($slug);
     $project->setName($name);
     $project->setDefaultLocale($locale);
     $project->setDescription($description);
     $this->projectRepository->save($project);
     $this->eventDispatcher->dispatch(CreateProjectEvent::NAME, new CreateProjectEvent($project));
     return $project;
 }
 function it_should_create_project(ProjectRepository $projectRepository, EventDispatcherInterface $eventDispatcher, Project $project, CreateProjectAction $action)
 {
     $action->getName()->willReturn('Foo bar');
     $action->getSlug()->willReturn('foobar');
     $action->getDefaultLocale()->willReturn('fr_FR');
     $action->getDescription()->willReturn('');
     $projectRepository->createNew(Argument::exact(new Slug('foobar')))->willReturn($project);
     $projectRepository->save($project)->shouldBeCalled();
     $eventDispatcher->dispatch(CreateProjectEvent::NAME, Argument::type('Openl10n\\Domain\\Project\\Application\\Event\\CreateProjectEvent'))->shouldBeCalled();
     $this->execute($action)->shouldReturn($project);
 }