Skip to content

Releases: Cevinio/Behat-Laravel-Extension

4.0.0

20 Mar 15:59
e3ca15b
Compare
Choose a tag to compare

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 to LaravelAwareContext->bootstrapLaravelApplication(). The Application $app parameter now uses the proper interface and a second parameter BeforeScenarioTested $event has been added to pass the event as well. The trait LaravelAware has been updated accordingly.
  • A new method LaravelAwareContext->bootstrapLaravelEnvironment(BeforeScenarioTested $event): array has been added (also in the trait LaravelAware). 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 the env() 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() or bootstrapLaravelEnvironment()). This means there is no Application available anymore in the @BeforeSuite and @AfterSuite hooks.
  • Added an optional parameter env_path in behat.yml to set the .env to load.
  • Added an optional parameter bootstrap_path in behat.yml to override the default bootstrap path of bootstrap/app.php.

3.0.0

25 Oct 13:06
f06aabd
Compare
Choose a tag to compare

Updated dependencies:

  • Behat: ^3.11
  • Mink BrowserKit Driver: ^2.1 (switched back friends-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 the LaravelAwareContext. This method will be called after the Laravel Application is created to allow for setting up things like bindings before any @BeforeScenario is run. When using the LaravelAware 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 tainted Application was being used at that point and the test code should be fixed.
  • When the BrowserKitDriver is updated with a new Application, the session is now stopped. This clears the cookies, history, forms and server parameters.

2.0.2

28 Jan 10:04
f0d29b4
Compare
Choose a tag to compare

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

28 Mar 08:39
Compare
Choose a tag to compare

Marked several methods as @internal because they should only be used by this library internally.

2.0.0

16 Mar 01:35
Compare
Choose a tag to compare

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 the Application 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 to LaravelAware.
  • Removed $app property from trait (use $this->app() for pass-through with the LaravelFactory).
  • Removed setApplication() from context interface and trait (replaced with setLaravelFactory() but should only be called from this library).
  • Removed database related traits DatabaseTransactions, MigrateRefresh and Migrator.
  • Removed mailtrap trait MailTrap.
  • Renamed KernelAwareContext to LaravelAwareContext.
  • Removed extension configuration options bootstrap_path and env_path.