class NodeListBuilderTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Kernel/NodeListBuilderTest.php \Drupal\Tests\node\Kernel\NodeListBuilderTest
- 9 core/modules/node/tests/src/Kernel/NodeListBuilderTest.php \Drupal\Tests\node\Kernel\NodeListBuilderTest
Tests the admin listing fallback when views is not enabled.
@group node
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\node\Kernel\NodeListBuilderTest
Expanded class hierarchy of NodeListBuilderTest
File
- core/
modules/ node/ tests/ src/ Kernel/ NodeListBuilderTest.php, line 13
Namespace
Drupal\Tests\node\KernelView source
class NodeListBuilderTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'user',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('node');
}
/**
* Tests that the correct cache contexts are set.
*/
public function testCacheContexts() {
/** @var \Drupal\Core\Entity\EntityListBuilderInterface $list_builder */
$list_builder = $this->container
->get('entity_type.manager')
->getListBuilder('node');
$build = $list_builder
->render();
$this->container
->get('renderer')
->renderRoot($build);
$this
->assertEqualsCanonicalizing([
'languages:' . LanguageInterface::TYPE_INTERFACE,
'theme',
'url.query_args.pagers:0',
'user.node_grants:view',
'user.permissions',
], $build['#cache']['contexts']);
}
}