14. Version 1.0 features
• recipes search engine
• recipe drink photos
• ingredients list
• possibility to add new recipes (admin only)
• comments
• social media stufff
17. Feature: Create new drink recipe
Scenario: Create new drink recipe
Scenario: Attempt to create new drink recipe using too many liquids
Scenario: Attempt to create new drink without glass
Scenario: Attempt to add step about pouring to shaker without shaker
Scenario: Attempt to remove significant step from the recipe
18. /**
* @When I decide to create new recipe called :name
*/
public function iDecideToCreateNewRecipeCalled($name)
{
$this->recipe = new Recipe(new Name($name));
}
/**
* @When as first step I add: prepare :name glass with :capacity ml capacity
*/
public function asFirstStepIAddPrepareHighballGlassWithMlCapacity($name, $capacity)
{
$this->recipe->prepareTheGlass(new Name($name), new Capacity($capacity));
}
Modeling by examples
40. <?php
/**
* @When I decide to create new recipe called :name
*/
public function iDecideToCreateNewRecipeCalled($name)
{
$command = new CreateNewRecipeCommand();
$command->name = $name;
$this->commandBus->handle($command);
$this->currentRecipeName = new Name($name);
}
/**
* @When as first step I add: prepare :name glass with :capacity ml capacity
*/
public function asFirstStepIAddPrepareHighballGlassWithMlCapacity($name, $capacity)
{
$command = new AddRecipeStepCommand();
$command->slug = $this->slugGenerator->generateFrom($this->currentRecipeName);
$command->action = RecipeActions::PREPARE_GLASS;
$command->name = $name;
$command->capacity = (int) $capacity;
$this->commandBus->handle($command);
}