public function ViewExecutableTest::testValidateNestedLoops in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::testValidateNestedLoops()
- 10 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::testValidateNestedLoops()
Tests that nested loops of the display handlers won't break validation.
File
- core/
modules/ views/ tests/ src/ Kernel/ ViewExecutableTest.php, line 465
Class
- ViewExecutableTest
- Tests the ViewExecutable class.
Namespace
Drupal\Tests\views\KernelCode
public function testValidateNestedLoops() {
$view = View::create([
'id' => 'test_validate_nested_loops',
]);
$executable = $view
->getExecutable();
$executable
->newDisplay('display_test');
$executable
->newDisplay('display_test');
$errors = $executable
->validate();
$total_error_count = array_reduce($errors, function ($carry, $item) {
$carry += count($item);
return $carry;
});
// Assert that there were 9 total errors across 3 displays.
$this
->assertSame(9, $total_error_count);
$this
->assertCount(3, $errors);
}