diff --git a/friends-of-behat/symfony-extension/2.0/behat.yml.dist b/friends-of-behat/symfony-extension/2.0/behat.yml.dist new file mode 100644 index 00000000..5f323f61 --- /dev/null +++ b/friends-of-behat/symfony-extension/2.0/behat.yml.dist @@ -0,0 +1,8 @@ +default: + suites: + default: + contexts: + - App\Tests\Behat\DemoContext + + extensions: + FriendsOfBehat\SymfonyExtension: ~ diff --git a/friends-of-behat/symfony-extension/2.0/config/services_test.yaml b/friends-of-behat/symfony-extension/2.0/config/services_test.yaml new file mode 100644 index 00000000..d0d92b30 --- /dev/null +++ b/friends-of-behat/symfony-extension/2.0/config/services_test.yaml @@ -0,0 +1,7 @@ +services: + _defaults: + autowire: true + autoconfigure: true + + App\Tests\Behat\: + resource: '../tests/Behat/*' diff --git a/friends-of-behat/symfony-extension/2.0/features/demo.feature b/friends-of-behat/symfony-extension/2.0/features/demo.feature new file mode 100644 index 00000000..4d459112 --- /dev/null +++ b/friends-of-behat/symfony-extension/2.0/features/demo.feature @@ -0,0 +1,12 @@ +# This file contains a user story for demonstration only. +# Learn how to get started with Behat and BDD on Behat's website: +# http://behat.org/en/latest/quick_start.html + +Feature: + In order to prove that the Behat Symfony extension is correctly installed + As a user + I want to have a demo scenario + + Scenario: It receives a response from Symfony's kernel + When a demo scenario sends a request to "/" + Then the response should be received diff --git a/friends-of-behat/symfony-extension/2.0/manifest.json b/friends-of-behat/symfony-extension/2.0/manifest.json new file mode 100644 index 00000000..a67322de --- /dev/null +++ b/friends-of-behat/symfony-extension/2.0/manifest.json @@ -0,0 +1,12 @@ +{ + "bundles": { + "FriendsOfBehat\\SymfonyExtension\\Bundle\\FriendsOfBehatSymfonyExtensionBundle": ["test"] + }, + "copy-from-recipe": { + "behat.yml.dist": "behat.yml.dist", + "config/": "%CONFIG_DIR%/", + "features/": "features/", + "tests/": "tests/" + }, + "gitignore": ["/behat.yml"] +} diff --git a/friends-of-behat/symfony-extension/2.0/post-install.txt b/friends-of-behat/symfony-extension/2.0/post-install.txt new file mode 100644 index 00000000..0af3f778 --- /dev/null +++ b/friends-of-behat/symfony-extension/2.0/post-install.txt @@ -0,0 +1,2 @@ + Next for FriendsOfBehat/SymfonyExtension + Run vendor/bin/behat to run the demo tests. diff --git a/friends-of-behat/symfony-extension/2.0/tests/Behat/DemoContext.php b/friends-of-behat/symfony-extension/2.0/tests/Behat/DemoContext.php new file mode 100644 index 00000000..d093ad70 --- /dev/null +++ b/friends-of-behat/symfony-extension/2.0/tests/Behat/DemoContext.php @@ -0,0 +1,48 @@ +kernel = $kernel; + } + + /** + * @When a demo scenario sends a request to :path + */ + public function aDemoScenarioSendsARequestTo(string $path): void + { + $this->response = $this->kernel->handle(Request::create($path, 'GET')); + } + + /** + * @Then the response should be received + */ + public function theResponseShouldBeReceived(): void + { + if ($this->response === null) { + throw new \RuntimeException('No response received'); + } + } +}