mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Move bootstrap file up into correct point in application cycle
This commit is contained in:
parent
8b0e0615f6
commit
6024d2bc5d
@ -22,7 +22,11 @@ class CoreInitializationPass implements CompilerPassInterface
|
|||||||
$_GET['flush'] = 1;
|
$_GET['flush'] = 1;
|
||||||
require_once('Core/Core.php');
|
require_once('Core/Core.php');
|
||||||
|
|
||||||
SapphireTest::use_test_manifest();
|
// Include bootstrap file
|
||||||
|
$bootstrapFile = $container->getParameter('behat.silverstripe_extension.bootstrap_file');
|
||||||
|
if ($bootstrapFile) {
|
||||||
|
require_once $bootstrapFile;
|
||||||
|
}
|
||||||
|
|
||||||
unset($_GET['flush']);
|
unset($_GET['flush']);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ use Behat\Behat\Context\Initializer\InitializerInterface;
|
|||||||
use Behat\Behat\Context\ContextInterface;
|
use Behat\Behat\Context\ContextInterface;
|
||||||
use SilverStripe\BehatExtension\Context\SilverStripeAwareContextInterface;
|
use SilverStripe\BehatExtension\Context\SilverStripeAwareContextInterface;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Behat/SilverStripeExtension
|
* This file is part of the Behat/SilverStripeExtension
|
||||||
@ -57,19 +58,19 @@ class SilverStripeAwareInitializer implements InitializerInterface
|
|||||||
*/
|
*/
|
||||||
protected $testSessionEnvironment;
|
protected $testSessionEnvironment;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string PHP file to included before loading Core.php
|
|
||||||
*/
|
|
||||||
protected $bootstrapFile;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes initializer.
|
* Initializes initializer.
|
||||||
*
|
*
|
||||||
* @param string $frameworkPath
|
* @param string $frameworkPath
|
||||||
*/
|
*/
|
||||||
public function __construct($frameworkPath, $bootstrapFile = null)
|
public function __construct($frameworkPath)
|
||||||
{
|
{
|
||||||
$this->bootstrap($frameworkPath, $bootstrapFile);
|
file_put_contents('php://stdout', 'Bootstrapping' . PHP_EOL);
|
||||||
|
|
||||||
|
SapphireTest::start();
|
||||||
|
|
||||||
|
// Remove the error handler so that PHPUnit can add its own
|
||||||
|
restore_error_handler();
|
||||||
|
|
||||||
file_put_contents('php://stdout', "Creating test session environment" . PHP_EOL);
|
file_put_contents('php://stdout', "Creating test session environment" . PHP_EOL);
|
||||||
|
|
||||||
@ -188,25 +189,4 @@ class SilverStripeAwareInitializer implements InitializerInterface
|
|||||||
{
|
{
|
||||||
$this->regionMap = $regionMap;
|
$this->regionMap = $regionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $frameworkPath Absolute path to 'framework' module
|
|
||||||
*/
|
|
||||||
protected function bootstrap($frameworkPath, $bootstrapFile = null)
|
|
||||||
{
|
|
||||||
file_put_contents('php://stdout', 'Bootstrapping' . PHP_EOL);
|
|
||||||
|
|
||||||
// Require a bootstrap file, if provided
|
|
||||||
if ($bootstrapFile) {
|
|
||||||
require_once($bootstrapFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to database and build manifest
|
|
||||||
$_GET['flush'] = 1;
|
|
||||||
require_once('Core/Core.php');
|
|
||||||
unset($_GET['flush']);
|
|
||||||
|
|
||||||
// Remove the error handler so that PHPUnit can add its own
|
|
||||||
restore_error_handler();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ services:
|
|||||||
class: %behat.silverstripe_extension.context.initializer.class%
|
class: %behat.silverstripe_extension.context.initializer.class%
|
||||||
arguments:
|
arguments:
|
||||||
- %behat.silverstripe_extension.framework_path%
|
- %behat.silverstripe_extension.framework_path%
|
||||||
- %behat.silverstripe_extension.bootstrap_file%
|
|
||||||
calls:
|
calls:
|
||||||
- [setAjaxSteps, [%behat.silverstripe_extension.ajax_steps%]]
|
- [setAjaxSteps, [%behat.silverstripe_extension.ajax_steps%]]
|
||||||
- [setAjaxTimeout, [%behat.silverstripe_extension.ajax_timeout%]]
|
- [setAjaxTimeout, [%behat.silverstripe_extension.ajax_timeout%]]
|
||||||
|
Loading…
Reference in New Issue
Block a user