You are here

public function ViewExecutableTest::testValidateNestedLoops in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Tests/ViewExecutableTest.php \Drupal\views\Tests\ViewExecutableTest::testValidateNestedLoops()

Tests that nested loops of the display handlers won't break validation.

File

core/modules/views/src/Tests/ViewExecutableTest.php, line 444
Contains \Drupal\views\Tests\ViewExecutableTest.

Class

ViewExecutableTest
Tests the ViewExecutable class.

Namespace

Drupal\views\Tests

Code

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
    ->assertIdentical(9, $total_error_count);
  $this
    ->assertIdentical(3, count($errors));
}