/**
  * @param CreateNewRecipeCommand $command
  * @throws RecipeAlreadyExistsException
  */
 public function handle(CreateNewRecipeCommand $command)
 {
     $recipe = $this->recipeFactory->createRecipe($command->name);
     if ($this->recipes->hasRecipeWithName($recipe->getName())) {
         throw new RecipeAlreadyExistsException();
     }
     $this->recipes->add($recipe);
 }
 function it_throws_an_exception_when_recipe_with_same_name_already_exists(Recipes $recipes)
 {
     $recipes->hasRecipeWithName(Argument::type(Name::class))->willReturn(true);
     $command = new CreateNewRecipeCommand();
     $command->name = "Screwdriver";
     $this->shouldThrow(RecipeAlreadyExistsException::class)->during('handle', [$command]);
 }