The bootstrap_file parameter specifies a PHP file that will be included
between Constants.php (which is included by the composer autoloader)
and Core.php (which is included by SilverStripeAwareInitializer).
The goal of this setting is to provide a bit more flexibility about how
behat test environments are set up. It’s the logical companion of
PHPUnit’s bootstrap property.
TestSessionEnvironment by default will create a temporary database for
use with behat tests, but this may not be required.
e.g. in your behat.yml:
```
default:
...
extensions:
...
SilverStripe\BehatExtension\Extension:
create_temp_database: false
```
applyState() used to persist in memory, which could lead
to outdated state depending on execution flow between CLI
and web requests. Since state is now in a JSON object,
it also fixes the array access.
This change is designed to be merged in at the same time as the matching
testsession PR (silverstripe-labs/silverstripe-testsession#7) is merged in, as
it relies on changes introduced in that PR to function.
This updates the behat-extension to use the new file-based capabilities of the
testsession module. Instead of creating a temp database, it will create an
entire testsession in the initializer, and then continue on as per normal. When
Behat runs end, the cleanup code will completely remove the testsession state,
instead of just removing the temp database. This may mean in the future that
you can hook into the TestSessionEnvironment via extensions, and connect to
other test services during a testsession, then cleanup after yourself on ending
a test session.
API CHANGES:
- Remove SilverStripeAwareInitializer::initializeTempDb()
- Remove SilverStripeAwareInitializer::deleteTempDb()
Removed framework_host since its no longer necessary due to the changed execution logic.
Unfortunately had to subclass the existing Mink Extension class since we can't influence
its config persistence from our own extensions (with a completely separate ContainerBuilder).
Also restructured README to be more focused on execution rather
than diving into deep config concerns early on.
- Moved all extension-specific conf into its own configuration namespace
- Described configuration via PHP, and added default values
- Removed boilerplate config from README
- Made screenshot_path optional
- Configurable ajax_timeout settings
Note: The DI system plus the initializer+context combo requires insane amounts of code duplication,
will need to be looked at more closely (very little docs on that level of Behat extension available).