Skip to content

Commit dd03f13

Browse files
soulcodexRoberto José Garcia Navarro
and
Roberto José Garcia Navarro
authored
Improve mink access, add php unit asserts and update deps (#3)
* Improve composer.json to be packagist ready and create tests dir * Improve README removing unneccesary config reference * fix: Mink access and kernel refresh on each scenario execution * Refactor and fix to not preserve application state on each scenario * Improve application state refresh on each scenario and documentation * chore(release): 1.0.3 * feat: Improve mink access, add php unit asserts and update deps --------- Co-authored-by: Roberto José Garcia Navarro <robertogarcia@ipglobal.es>
1 parent 9c015aa commit dd03f13

9 files changed

+1915
-195
lines changed

CHANGELOG.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
All notable changes to this project will be documented in this file.
55
<!--- END HEADER -->
66

7+
## [1.0.4](https://github.com/soulcodex/laravel-behat/compare/v1.0.3...v1.0.4) (2023-02-26)
8+
9+
### Features
10+
11+
* Improve mink access, add php unit asserts and update deps ([940bf6](https://github.com/soulcodex/laravel-behat/commit/940bf619864f267ea75555f4a9b547cd15a70405))
12+
13+
---
14+
715
## [1.0.3](https://github.com/soulcodex/laravel-behat/compare/0.0.0...v1.0.3) (2023-02-18)
816

917

@@ -22,5 +30,4 @@ All notable changes to this project will be documented in this file.
2230
## [1.0.0](https://github.com/soulcodex/laravel-behat/compare/0.0.0...v1.0.0) (2023-02-03)
2331

2432

25-
---
26-
33+
---

README.md

+44-3
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ final class UserContext extends Context
9494
*/
9595
public function iSendARequestTo(string $url): void
9696
{
97-
$session = $this->session(); // The current mink session
98-
$session->visit($url); // Perform an action using the mink session
97+
$this->visitUrl($url); // Perform an action using the mink session
9998
}
10099
}
101100
```
@@ -104,6 +103,48 @@ Note: Its recommended use from time been
104103

105104
Start writing your features test with Behat. ¡Happy coding!
106105

106+
## Features 🎁
107+
108+
#### 💫 Plug & Play philosophy, just create you context, extends from [base context](src/Addon/Context.php) and start your feature context.
109+
110+
```php
111+
<?php
112+
113+
use Soulcodex\Behat\Addon\Context;
114+
115+
final class MyMarvelousContext extends Context
116+
{
117+
/**
118+
* @Given I do a marvelous action in my application
119+
*/
120+
public function iDoAMarvelousActionInMyApp(): void
121+
{
122+
$this->doMarvelousThings();
123+
}
124+
}
125+
```
126+
127+
#### 💫 Direct access to mink session and shortcut to perform `GET` request to specific url
128+
129+
```php
130+
$this->visitUrl($url); // Perform GET request to specific URI
131+
$this->session(); // Access to the mink session to perform actions
132+
```
133+
134+
#### 💫 Runtime access to the container to get dependencies or do anything
135+
136+
```php
137+
$this->container(); // Get laravel application container access
138+
```
139+
140+
#### 💫 PHPUnit assertions from your context
141+
142+
```php
143+
$this->assertSame(...);
144+
$this->assertEquals(...);
145+
$this->assertInstanceOf(...);
146+
```
147+
107148
## FAQ ❓
108149

109150
### Will be released new functionalities ?
@@ -135,6 +176,6 @@ Xdebug. [Increase the max nesting level](http://xdebug.org/docs/all_settings#max
135176
this [library](https://github.com/marcocesarato/php-conventional-changelog) or another one.
136177
- [ ] Add test coverage for all laravel version matrix using GitHub Actions.
137178
- [ ] Automatize test and package release to packagist.
138-
- [ ] Add usefully traits to give `Plug & Play` tools.
179+
- [ ] Add usefully traits to give `Plug & Play` tools. **⏱ _in progress_**
139180
- [ ] Add `mode` to configuration to let choose between `KernelBrowser (default)` or `SeleniumBrowser` implementation.
140181
- [ ] Create or amplify a base context for `api` and `web` approaches.

composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"license": "MIT",
1313
"authors": [
1414
{
15-
"name": "Roberto Garc\u00eda",
15+
"name": "Roberto Garcia",
1616
"email": "info@soulcodex.es",
1717
"role": "Owner"
1818
}
@@ -35,19 +35,19 @@
3535
"illuminate/contracts": "^8.0|^9.0|^10.0",
3636
"illuminate/support": "^8.0|^9.0|^10.0",
3737
"symfony/http-kernel": "^6.2",
38-
"symfony/event-dispatcher": "^6.2"
38+
"symfony/event-dispatcher": "^6.2",
39+
"phpunit/phpunit": "^9.5|^10.0"
3940
},
4041
"require-dev": {
4142
"marcocesarato/php-conventional-changelog": "^1.16"
4243
},
4344
"scripts": {
4445
"changelog": "conventional-changelog",
45-
"release": "conventional-changelog --commit",
46-
"release:patch": "conventional-changelog --patch --commit",
47-
"release:minor": "conventional-changelog --minor --commit",
48-
"release:major": "conventional-changelog --major --commit"
46+
"release:patch": "conventional-changelog --patch",
47+
"release:minor": "conventional-changelog --minor",
48+
"release:major": "conventional-changelog --major"
4949
},
5050
"minimum-stability": "dev",
5151
"prefer-stable": true,
52-
"version": "1.0.3"
52+
"version": "1.0.4"
5353
}

0 commit comments

Comments
 (0)