View source
<?php
namespace Drupal\Core\Test;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Request;
class TestRunnerKernel extends DrupalKernel {
public static function createFromRequest(Request $request, $class_loader, $environment = 'test_runner', $allow_dumping = TRUE, $app_root = NULL) {
return parent::createFromRequest($request, $class_loader, $environment, $allow_dumping, $app_root);
}
public function __construct($environment, $class_loader, $allow_dumping = FALSE, $app_root = NULL) {
parent::__construct($environment, $class_loader, FALSE, $app_root);
$this->moduleList = [
'system' => 0,
];
$this->moduleData = [
'system' => new Extension($this->root, 'module', 'core/modules/system/system.info.yml', 'system.module'),
];
$extensions = (new ExtensionDiscovery($this->root, FALSE, [], 'ignore_site_path_does_not_exist'))
->scan('module', FALSE);
if (isset($extensions['simpletest'])) {
$this->moduleList['simpletest'] = 0;
$this->moduleData['simpletest'] = $extensions['simpletest'];
}
}
public function boot() {
if (!Settings::getAll()) {
new Settings([
'hash_salt' => 'run-tests',
'container_yamls' => [],
'file_public_path' => 'sites/default/files',
]);
}
restore_error_handler();
restore_exception_handler();
ini_set('display_errors', TRUE);
parent::boot();
$this
->getContainer()
->get('module_handler')
->loadAll();
$test_discovery = new TestDiscovery($this
->getContainer()
->getParameter('app.root'), $this
->getContainer()
->get('class_loader'));
$test_discovery
->registerTestNamespaces();
$this
->getContainer()
->get('stream_wrapper_manager')
->register();
include_once $this
->getAppRoot() . '/core/includes/file.inc';
if (!is_dir('public://simpletest')) {
mkdir('public://simpletest', 0777, TRUE);
}
}
public function discoverServiceProviders() {
parent::discoverServiceProviders();
$this->serviceProviderClasses['app']['Test'] = 'Drupal\\Core\\Installer\\InstallerServiceProvider';
}
}