This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fixtures-demo $ vendor/bin/behat --tags="@add-products" | |
| @product @add-products | |
| Feature: | |
| In order to offer a large choice of products | |
| As a product seller | |
| I want to add products | |
| Background: | |
| Given the fixtures file "add-products.yaml" is loaded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** .... */ | |
| class AddProductAction | |
| { | |
| /** .... */ | |
| public function __invoke(Request $request) | |
| { | |
| $payload = json_decode($request->getContent(), true); | |
| $category = $this->productCategoryRepository->find($payload['category']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| use Behat\Behat\Context\Context; | |
| use Behat\Symfony2Extension\Context\KernelAwareContext; | |
| use Symfony\Component\HttpKernel\KernelInterface; | |
| use Symfony\Component\PropertyAccess\PropertyAccessorInterface; | |
| class FeatureContext implements Context, KernelAwareContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| use Behat\Gherkin\Node\PyStringNode; | |
| use Behatch\Context\RestContext as BehatchRestContext; | |
| class RestContext extends BehatchRestContext | |
| { | |
| use SharedContextTrait; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @product @add-products | |
| Feature: | |
| In order to offer a large choice of products | |
| As a product seller | |
| I want to add products | |
| Background: | |
| Given the fixtures file "add-products.yaml" is loaded | |
| Scenario: Add a product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| namespace App\Action; | |
| use Symfony\Component\HttpFoundation\Request; | |
| class AddProductAction | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @product @list-products | |
| Feature: | |
| In order to select products | |
| As a customer | |
| I want to see the products available | |
| Background: | |
| Given the fixtures file "list-products.yaml" is loaded | |
| Scenario: List all products |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App\Entity\ProductCategory: | |
| category_tools: | |
| name: 'tools' | |
| category_lighting: | |
| name: 'lighting' | |
| App\Entity\Product: | |
| tools_products_{1..10}: | |
| name: '<firstName()>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Action; | |
| // use statements omitted for concision | |
| class ListProductsAction | |
| { | |
| // Properties & constructor omitted for concision | |
| public function __invoke(Request $request): JsonResponse |