function ViewValidationTest::testInvalidPluginId
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Kernel/Entity/ViewValidationTest.php \Drupal\Tests\views\Kernel\Entity\ViewValidationTest::testInvalidPluginId()
- 10 core/modules/views/tests/src/Kernel/Entity/ViewValidationTest.php \Drupal\Tests\views\Kernel\Entity\ViewValidationTest::testInvalidPluginId()
Tests that the various plugin IDs making up a view display are validated.
Attributes
#[TestWith([
"display_plugin",
])]
#[TestWith([
"display_options",
"pager",
"type",
])]
#[TestWith([
"display_options",
"exposed_form",
"type",
])]
#[TestWith([
"display_options",
"access",
"type",
])]
#[TestWith([
"display_options",
"style",
"type",
])]
#[TestWith([
"display_options",
"row",
"type",
])]
#[TestWith([
"display_options",
"query",
"type",
])]
#[TestWith([
"display_options",
"cache",
"type",
])]
#[TestWith([
"display_options",
"header",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"footer",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"empty",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"arguments",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"sorts",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"fields",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"filters",
"non_existent",
"plugin_id",
])]
#[TestWith([
"display_options",
"relationships",
"non_existent",
"plugin_id",
])]
Parameters
string ...$parents: The array parents of the property of the view's default display which will be set to `non_existent`.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Entity/ ViewValidationTest.php, line 72
Class
- ViewValidationTest
- Tests validation of view entities.
Namespace
Drupal\Tests\views\Kernel\EntityCode
public function testInvalidPluginId(string ...$parents) : void {
$display =& $this->entity
->getDisplay('default');
NestedArray::setValue($display, $parents, 'non_existent');
$property_path = 'display.default.' . implode('.', $parents);
$this->assertValidationErrors([
$property_path => "The 'non_existent' plugin does not exist.",
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.