You are here

public function ViewExecutableTest::testGetHandlerTypes in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::testGetHandlerTypes()

Tests ViewExecutable::getHandlerTypes().

File

core/modules/views/tests/src/Kernel/ViewExecutableTest.php, line 402

Class

ViewExecutableTest
Tests the ViewExecutable class.

Namespace

Drupal\Tests\views\Kernel

Code

public function testGetHandlerTypes() {
  $types = ViewExecutable::getHandlerTypes();
  foreach ([
    'field',
    'filter',
    'argument',
    'sort',
    'header',
    'footer',
    'empty',
  ] as $type) {
    $this
      ->assertTrue(isset($types[$type]));

    // @todo The key on the display should be footers, headers and empties
    //   or something similar instead of the singular, but so long check for
    //   this special case.
    if (isset($types[$type]['type']) && $types[$type]['type'] == 'area') {
      $this
        ->assertEqual($types[$type]['plural'], $type);
    }
    else {
      $this
        ->assertEqual($types[$type]['plural'], $type . 's');
    }
  }
}