2013-10-18 17:00:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\BehatExtension\Compiler;
|
|
|
|
|
2016-09-01 06:22:47 +02:00
|
|
|
use SilverStripe\Dev\SapphireTest;
|
2016-08-10 03:35:13 +02:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
2013-10-18 17:00:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads SilverStripe core. Required to initialize autoloading.
|
|
|
|
*/
|
|
|
|
class CoreInitializationPass implements CompilerPassInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Loads kernel file.
|
|
|
|
*
|
|
|
|
* @param ContainerBuilder $container
|
|
|
|
*/
|
|
|
|
public function process(ContainerBuilder $container)
|
|
|
|
{
|
|
|
|
// Connect to database and build manifest
|
|
|
|
$_GET['flush'] = 1;
|
2017-02-27 22:53:41 +01:00
|
|
|
if (!getenv('SS_ENVIRONMENT_TYPE')) {
|
|
|
|
putenv('SS_ENVIRONMENT_TYPE=dev');
|
|
|
|
}
|
2016-11-01 03:08:28 +01:00
|
|
|
require_once('Core/Core.php');
|
2016-09-01 06:22:47 +02:00
|
|
|
|
2017-02-27 03:49:31 +01:00
|
|
|
// Include bootstrap file
|
|
|
|
$bootstrapFile = $container->getParameter('behat.silverstripe_extension.bootstrap_file');
|
|
|
|
if ($bootstrapFile) {
|
|
|
|
require_once $bootstrapFile;
|
|
|
|
}
|
2015-08-28 06:50:51 +02:00
|
|
|
|
2013-10-18 17:00:07 +02:00
|
|
|
unset($_GET['flush']);
|
|
|
|
|
|
|
|
// Remove the error handler so that PHPUnit can add its own
|
|
|
|
restore_error_handler();
|
|
|
|
}
|
2016-08-10 03:35:13 +02:00
|
|
|
}
|