mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #128 from sminnee/add-bootstrap-file
NEW: Add bootstrap_file extension parameter.
This commit is contained in:
commit
df828356e7
@ -31,8 +31,8 @@
|
||||
"symfony/translation": "~2.0",
|
||||
"symfony/yaml": "~2.0",
|
||||
"symfony/finder": "~2.0",
|
||||
"silverstripe/testsession": "*",
|
||||
"silverstripe/framework": "^4.0.0"
|
||||
"silverstripe/testsession": "^2.0.0-alpha2",
|
||||
"silverstripe/framework": "^4.0.0-alpha2"
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
|
@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
use Behat\Behat\Console\Processor\InitProcessor as BaseProcessor;
|
||||
use SilverStripe\Core\Manifest\ClassLoader;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a project for Behat usage, creating context files.
|
||||
*/
|
||||
|
@ -10,7 +10,6 @@ use Behat\Mink\Driver\Selenium2Driver;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Assets\Filesystem;
|
||||
|
||||
|
||||
// PHPUnit
|
||||
require_once BASE_PATH . '/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';
|
||||
|
||||
|
@ -57,14 +57,19 @@ class SilverStripeAwareInitializer implements InitializerInterface
|
||||
*/
|
||||
protected $testSessionEnvironment;
|
||||
|
||||
/**
|
||||
* @var string PHP file to included before loading Core.php
|
||||
*/
|
||||
protected $bootstrapFile;
|
||||
|
||||
/**
|
||||
* Initializes initializer.
|
||||
*
|
||||
* @param string $frameworkPath
|
||||
*/
|
||||
public function __construct($frameworkPath)
|
||||
public function __construct($frameworkPath, $bootstrapFile = null)
|
||||
{
|
||||
$this->bootstrap($frameworkPath);
|
||||
$this->bootstrap($frameworkPath, $bootstrapFile);
|
||||
|
||||
file_put_contents('php://stdout', "Creating test session environment" . PHP_EOL);
|
||||
|
||||
@ -187,10 +192,15 @@ class SilverStripeAwareInitializer implements InitializerInterface
|
||||
/**
|
||||
* @param string $frameworkPath Absolute path to 'framework' module
|
||||
*/
|
||||
protected function bootstrap($frameworkPath)
|
||||
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 $frameworkPath . '/Core/Core.php';
|
||||
|
@ -62,6 +62,7 @@ class Extension implements ExtensionInterface
|
||||
if (isset($config['region_map'])) {
|
||||
$container->setParameter('behat.silverstripe_extension.region_map', $config['region_map']);
|
||||
}
|
||||
$container->setParameter('behat.silverstripe_extension.bootstrap_file', $config['bootstrap_file']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,6 +103,9 @@ class Extension implements ExtensionInterface
|
||||
scalarNode('ajax_timeout')->
|
||||
defaultValue(5000)->
|
||||
end()->
|
||||
scalarNode('bootstrap_file')->
|
||||
defaultNull()->
|
||||
end()->
|
||||
arrayNode('ajax_steps')->
|
||||
defaultValue(array(
|
||||
'go to',
|
||||
|
@ -18,6 +18,7 @@ services:
|
||||
class: %behat.silverstripe_extension.context.initializer.class%
|
||||
arguments:
|
||||
- %behat.silverstripe_extension.framework_path%
|
||||
- %behat.silverstripe_extension.bootstrap_file%
|
||||
calls:
|
||||
- [setAjaxSteps, [%behat.silverstripe_extension.ajax_steps%]]
|
||||
- [setAjaxTimeout, [%behat.silverstripe_extension.ajax_timeout%]]
|
||||
|
Loading…
Reference in New Issue
Block a user