Releases: Cevinio/Behat-Laravel-Extension
Releases · Cevinio/Behat-Laravel-Extension
4.0.0
Updated dependencies:
- PHP:
>=8.1
- Behat:
^3.14
- Mink BrowserKit Driver:
^2.2
- Mink Extension:
^2.6.1
- Laravel:
>=10.0
- Symfony Event Dispatcher: removed (implicit dependency via
behat/behat
) - Symfony Http Kernel: removed (implicit dependency via
laravel/framework
)
Features:
- The method
LaravelAwareContext->initLaravelApplication()
has been renamed toLaravelAwareContext->bootstrapLaravelApplication()
. TheApplication $app
parameter now uses the proper interface and a second parameterBeforeScenarioTested $event
has been added to pass the event as well. The traitLaravelAware
has been updated accordingly. - A new method
LaravelAwareContext->bootstrapLaravelEnvironment(BeforeScenarioTested $event): array
has been added (also in the traitLaravelAware
). The return value should be an associative array of key/value pairs. These key/value pairs will be set in$_SERVER
which in turn is used by theenv()
method used in Laravel configuration files. This allows preparing scenario specific environments/configurations. Original values in$_SERVER
are restored after the scenario is finished. - Listeners on suite level have been removed as they were creating unnecessary overhead and were not playing nicely with contexts (because no context has been initialized at that point, it's not possible to call
bootstrapLaravelApplication()
orbootstrapLaravelEnvironment()
). This means there is noApplication
available anymore in the@BeforeSuite
and@AfterSuite
hooks. - Added an optional parameter
env_path
inbehat.yml
to set the.env
to load. - Added an optional parameter
bootstrap_path
inbehat.yml
to override the default bootstrap path ofbootstrap/app.php
.
3.0.0
Updated dependencies:
- Behat:
^3.11
- Mink BrowserKit Driver:
^2.1
(switched backfriends-of-behat/mink-browserkit-driver
=>behat/mink-browserkit-driver
) - Laravel:
>= 5.8
- Symfony EventDispatcher:
>= 4.4
- Symfony HttpKernel:
>= 4.4
Features:
- Added
initLaravelApplication(Application $application): void
to theLaravelAwareContext
. This method will be called after the LaravelApplication
is created to allow for setting up things like bindings before any@BeforeScenario
is run. When using theLaravelAware
trait this change is backwards compatible. Application
creation and destruction was not fully safe. It has been updated now to create/destroy the application before/after suite setup, before/after scenario setup, and before/after suite teardown. This should be backwards compatible. If it breaks anything, then probably a taintedApplication
was being used at that point and the test code should be fixed.- When the
BrowserKitDriver
is updated with a newApplication
, the session is now stopped. This clears the cookies, history, forms and server parameters.
2.0.2
Updated dependencies:
- PHP:
>= 7.3
- Behat:
^3.10
- Mink BrowserKit driver:
^1.5
Please make sure to switch your Mink related packages over from Behat to Friends of Behat:
behat/mink
=>friends-of-behat/mink
behat/mink-extension
=>friends-of-behat/mink-extension
behat/mink-browserkit-driver
=>friends-of-behat/mink-browserkit-driver
2.0.1
2.0.0
Refactored multiple parts of the extension to resolve bugs and inconsistencies.
Unfortunately some features and configuration options were removed because we do not use them and I wasn't able to test whether they still worked or not. Feel free to submit a PR though to add back small things like configuration options.
Fixes and improvements:
- Laravel 5.8+ compatibility.
- Rebooting the
Application
before every scenario instead of after (solves some inconsistencies particularly around singletons). - Rebooting the
Application
before every suite (when running multiple suites prevent the last scenario or@AfterSuite
from tainting theApplication
during@BeforeSuite
). - Always reboot the
Application
and no longer depends on the Laravel context to be loaded last when using multiple contexts. - Argument resolver no longer crashes if an argument was already resolved (f.ex. by Behat).
- Base URL is now preserved when the
BrowserKitDriver
is reinitialized. - Context interface no longer depends on
getSession()
.
Backwards incompatible changes:
- Renamed trait
App
toLaravelAware
. - Removed
$app
property from trait (use$this->app()
for pass-through with theLaravelFactory
). - Removed
setApplication()
from context interface and trait (replaced withsetLaravelFactory()
but should only be called from this library). - Removed database related traits
DatabaseTransactions
,MigrateRefresh
andMigrator
. - Removed mailtrap trait
MailTrap
. - Renamed
KernelAwareContext
toLaravelAwareContext
. - Removed extension configuration options
bootstrap_path
andenv_path
.