Skip to content

Commit

Permalink
Improve mink access, add php unit asserts and update deps (#3)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
soulcodex and Roberto José Garcia Navarro authored Feb 26, 2023
1 parent 9c015aa commit dd03f13
Show file tree
Hide file tree
Showing 9 changed files with 1,915 additions and 195 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
All notable changes to this project will be documented in this file.
<!--- END HEADER -->

## [1.0.4](https://github.com/soulcodex/laravel-behat/compare/v1.0.3...v1.0.4) (2023-02-26)

### Features

* Improve mink access, add php unit asserts and update deps ([940bf6](https://github.com/soulcodex/laravel-behat/commit/940bf619864f267ea75555f4a9b547cd15a70405))

---

## [1.0.3](https://github.com/soulcodex/laravel-behat/compare/0.0.0...v1.0.3) (2023-02-18)


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


---

---
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ final class UserContext extends Context
*/
public function iSendARequestTo(string $url): void
{
$session = $this->session(); // The current mink session
$session->visit($url); // Perform an action using the mink session
$this->visitUrl($url); // Perform an action using the mink session
}
}
```
Expand All @@ -104,6 +103,48 @@ Note: Its recommended use from time been

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

## Features 🎁

#### 💫 Plug & Play philosophy, just create you context, extends from [base context](src/Addon/Context.php) and start your feature context.

```php
<?php
use Soulcodex\Behat\Addon\Context;
final class MyMarvelousContext extends Context
{
/**
* @Given I do a marvelous action in my application
*/
public function iDoAMarvelousActionInMyApp(): void
{
$this->doMarvelousThings();
}
}
```

#### 💫 Direct access to mink session and shortcut to perform `GET` request to specific url

```php
$this->visitUrl($url); // Perform GET request to specific URI
$this->session(); // Access to the mink session to perform actions
```

#### 💫 Runtime access to the container to get dependencies or do anything

```php
$this->container(); // Get laravel application container access
```

#### 💫 PHPUnit assertions from your context

```php
$this->assertSame(...);
$this->assertEquals(...);
$this->assertInstanceOf(...);
```

## FAQ ❓

### Will be released new functionalities ?
Expand Down Expand Up @@ -135,6 +176,6 @@ Xdebug. [Increase the max nesting level](http://xdebug.org/docs/all_settings#max
this [library](https://github.com/marcocesarato/php-conventional-changelog) or another one.
- [ ] Add test coverage for all laravel version matrix using GitHub Actions.
- [ ] Automatize test and package release to packagist.
- [ ] Add usefully traits to give `Plug & Play` tools.
- [ ] Add usefully traits to give `Plug & Play` tools. **⏱ _in progress_**
- [ ] Add `mode` to configuration to let choose between `KernelBrowser (default)` or `SeleniumBrowser` implementation.
- [ ] Create or amplify a base context for `api` and `web` approaches.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "MIT",
"authors": [
{
"name": "Roberto Garc\u00eda",
"name": "Roberto Garcia",
"email": "[email protected]",
"role": "Owner"
}
Expand All @@ -35,19 +35,19 @@
"illuminate/contracts": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0",
"symfony/http-kernel": "^6.2",
"symfony/event-dispatcher": "^6.2"
"symfony/event-dispatcher": "^6.2",
"phpunit/phpunit": "^9.5|^10.0"
},
"require-dev": {
"marcocesarato/php-conventional-changelog": "^1.16"
},
"scripts": {
"changelog": "conventional-changelog",
"release": "conventional-changelog --commit",
"release:patch": "conventional-changelog --patch --commit",
"release:minor": "conventional-changelog --minor --commit",
"release:major": "conventional-changelog --major --commit"
"release:patch": "conventional-changelog --patch",
"release:minor": "conventional-changelog --minor",
"release:major": "conventional-changelog --major"
},
"minimum-stability": "dev",
"prefer-stable": true,
"version": "1.0.3"
"version": "1.0.4"
}
Loading

0 comments on commit dd03f13

Please sign in to comment.