function CurrentPathStackTest::testRequestNothingElseReferencesIsReleased

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Path/CurrentPathStackTest.php \Drupal\Tests\Core\Path\CurrentPathStackTest::testRequestNothingElseReferencesIsReleased()

Tests that a request nothing else references is released.

Code that matches many synthetic requests against the router in one process, such as re-tracking entity usage from drush, would otherwise keep every one of them for the life of the process.

File

core/tests/Drupal/Tests/Core/Path/CurrentPathStackTest.php, line 45

Class

CurrentPathStackTest
Tests Drupal\Core\Path\CurrentPathStack.

Namespace

Drupal\Tests\Core\Path

Code

public function testRequestNothingElseReferencesIsReleased() : void {
  $stack = new CurrentPathStack(new RequestStack());
  $request = Request::create('/node/1');
  $stack->setPath('/node/1', $request);
  $reference = \WeakReference::create($request);
  unset($request);
  $this->assertNull($reference->get());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.