diff --git a/core/modules/system/lib/Drupal/system/Tests/System/FloodTest.php b/core/modules/system/lib/Drupal/system/Tests/System/FloodTest.php index b3e8662..550fd89 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/FloodTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/FloodTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\System; use Drupal\simpletest\WebTestBase; +use Symfony\Component\HttpFoundation\Request; /** * Functional tests for the flood control mechanism. @@ -55,7 +56,10 @@ function testMemoryBackend() { $window_expired = -1; $name = 'flood_test_cleanup'; - $flood = new \Drupal\Core\Flood\MemoryBackend($this->kernel->getContainer()->get('request')); + // MemoryBackend needs a request object injected. + $request = Request::create('http://example.com/'); + $request->server->set('REMOTE_ADDR', '3.3.3.3'); + $flood = new \Drupal\Core\Flood\MemoryBackend($request); // Register expired event. $flood->register($name, $window_expired); // Verify event is not allowed. diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php index 74c9923..31fcf04 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php @@ -11,6 +11,7 @@ use Drupal\simpletest\WebTestBase; use Exception; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\HttpFoundation\Request; /** * Perform end-to-end tests of the upgrade path. @@ -43,6 +44,12 @@ * Prepares the appropriate session for the release of Drupal being upgraded. */ protected function prepareD8Session() { + // We need an IP when storing sessions + // so add a dummy request in the container. + $request = Request::create('http://example.com/'); + $request->server->set('REMOTE_ADDR', '3.3.3.3'); + $this->container->set('request', $request); + // Generate and set a D7-compatible session cookie. $this->curlInitialize(); $sid = drupal_hash_base64(uniqid(mt_rand(), TRUE) . drupal_random_bytes(55));