function FilterEntityReferenceTest::testViewContentDependencies
Tests that content dependencies are added to the view.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterEntityReferenceTest.php, line 223
Class
- FilterEntityReferenceTest
- Tests the core Drupal\views\Plugin\views\filter\EntityReference handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testViewContentDependencies() : void {
$view = Views::getView('test_filter_entity_reference');
$value = [
$this->targetNodes[0]
->id(),
$this->targetNodes[3]
->id(),
];
$view->setHandlerOption('default', 'filter', 'field_test_target_id', 'value', $value);
// Dependencies are sorted.
$content_dependencies = [
$this->targetNodes[0]
->getConfigDependencyName(),
$this->targetNodes[3]
->getConfigDependencyName(),
];
sort($content_dependencies);
$this->assertEquals([
'config' => [
'node.type.page',
],
'content' => $content_dependencies,
'module' => [
'node',
'user',
],
], $view->getDependencies());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.