Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.

Commit c8dc8a0

Browse files
author
Rodrigue Villetard
authored
feat: Update readme with packagist (#4)
1 parent 9cf01b4 commit c8dc8a0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ But, when you are testing a stateless system, chiefly an API, then the resulting
1515

1616
## Installation
1717

18-
> @TODO: Publish on packagist when ready.
19-
> for now use the private repo composer method https://getcomposer.org/doc/05-repositories.md#using-private-repositories
18+
19+
```bash
20+
composer require gorghoa/scenariostate-behat-extension @RC
21+
```
22+
23+
Then update your project’s `behat.yml` config file by loading the extension:
24+
25+
```yaml
26+
default:
27+
extensions:
28+
Gorghoa\ScenarioStateBehatExtension\ServiceContainer\ScenarioStateExtension: ~
29+
```
2030
2131
## Usage
2232
@@ -32,10 +42,13 @@ Let’s say a feature like this:
3242

3343
Scenario: Monkey gives a banana to another monkey
3444
When bonobo takes a banana
35-
And gives this banana to "gorilla"
45+
And bonobo gives this banana to "gorilla"
3646

3747
```
3848

49+
See the “**this** banana”? What we want during the second step execution is a reference to the exact banana the bonobo initially took. This behat extension will help us to propagate the banana refence amongst steps.
50+
51+
3952
### Provide state fragment
4053

4154
To share a piece of state with all other scenario’s steps, your contexts need to implement the `Gorghoa\ScenarioStateBehatExtension\Context\ScenarioStateAwareContext` interface.
@@ -101,6 +114,7 @@ The easiest way to consume state fragments provided to the scenario’s state, i
101114
*/
102115
public function giveBananaToGorilla($monkey, $scenarioBanana, Bonobo $scenarioBonobo)
103116
{
117+
// (note that PHPUnit is here only given as an example, feel free to use any asserter you want)
104118
PHPUnit_Framework_Assert::assertEquals($monkey, 'gorilla');
105119
PHPUnit_Framework_Assert::assertEquals($scenarioBanana, 'Yammy Banana');
106120
PHPUnit_Framework_Assert::assertEquals($scenarioBonobo->getName(), 'Gerard');

0 commit comments

Comments
 (0)