class PathParentCacheContextTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php \Drupal\Tests\Core\Cache\Context\PathParentCacheContextTest
- 10 core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php \Drupal\Tests\Core\Cache\Context\PathParentCacheContextTest
- 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php \Drupal\Tests\Core\Cache\Context\PathParentCacheContextTest
@coversDefaultClass \Drupal\Core\Cache\Context\PathParentCacheContext
@group Cache
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Cache\Context\PathParentCacheContextTest implements \Drupal\Tests\UnitTestCase
Expanded class hierarchy of PathParentCacheContextTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ PathParentCacheContextTest.php, line 14
Namespace
Drupal\Tests\Core\Cache\ContextView source
class PathParentCacheContextTest extends UnitTestCase {
/**
* @covers ::getContext
*
* @dataProvider providerTestGetContext
*/
public function testGetContext($original_path, $context) {
$request_stack = new RequestStack();
$request = Request::create($original_path);
$request_stack->push($request);
$cache_context = new PathParentCacheContext($request_stack);
$this->assertSame($cache_context->getContext(), $context);
}
/**
* Provides a list of paths and expected cache contexts.
*/
public function providerTestGetContext() {
return [
[
'/some/path',
'some',
],
[
'/some/other-path',
'some',
],
[
'/some/other/path',
'some/other',
],
[
'/some/other/path?q=foo&b=bar',
'some/other',
],
[
'/some',
'',
],
[
'/',
'',
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.