NodeListBuilderTest.php in Drupal 10
File
core/modules/node/tests/src/Kernel/NodeListBuilderTest.php
View source
<?php
namespace Drupal\Tests\node\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\KernelTests\KernelTestBase;
class NodeListBuilderTest extends KernelTestBase {
protected static $modules = [
'node',
'user',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('node');
}
public function testCacheContexts() {
$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']);
}
}