Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Commit

Permalink
Fix caching issues avoiding page rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
guncha25 committed May 29, 2017
1 parent 5cfa410 commit 63231f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 48 deletions.
27 changes: 16 additions & 11 deletions src/Codeception/Module/DrupalBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\user\Entity\User;
use Symfony\Component\HttpFoundation\Request;
use Codeception\TestDrupalKernel;
use Drupal\Core\DrupalKernel;
use Faker\Factory as Faker;

/**
Expand All @@ -34,11 +34,21 @@ public function __construct(ModuleContainer $container, $config = null) {
],
(array)$config
);
$autoloader = require $this->config['drupal_root'] . '/autoload.php';
$kernel = new TestDrupalKernel('prod',$autoloader, $this->config['drupal_root']);

$_SERVER['SERVER_PORT'] = null;
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['SERVER_SOFTWARE'] = null;
$_SERVER['HTTP_USER_AGENT'] = null;
$_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] . 'index.php';
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['SCRIPT_FILENAME'] = $this->config['drupal_root'] . '/index.php';
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$kernel->terminate($request, $response);
$autoloader = require $this->config['drupal_root'] . '/autoload.php';
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel->boot();
$kernel->prepareLegacyRequest($request);
parent::__construct($container);
}

Expand Down Expand Up @@ -68,13 +78,9 @@ public function _afterSuite() {
if (\Drupal::moduleHandler()->isLoaded('dblog')) {
// Load any database log entries of level WARNING or more serious.
$query = \Drupal::database()->select('watchdog', 'w');
$query->fields('w', ['type', 'severity', 'message', 'variables']);
$php_notices = $query->andConditionGroup()
$query->fields('w', ['type', 'severity', 'message', 'variables'])
->condition('severity', RfcLogLevel::NOTICE, '<=')
->condition('type', 'php');
$group = $query->orConditionGroup()
->condition($php_notices);
$query->condition($group);
$result = $query->execute();
foreach ($result as $row) {
// Build a readable message and declare a failure.
Expand Down Expand Up @@ -137,5 +143,4 @@ public function deleteUser($username) {
}
}


}
37 changes: 0 additions & 37 deletions src/Codeception/TestDrupalKernel.php

This file was deleted.

0 comments on commit 63231f2

Please sign in to comment.