function ViewExecutableTest::testGetHandlerTypes

Same name and namespace in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::testGetHandlerTypes()
  2. 10 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::testGetHandlerTypes()
  3. 11.x 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 405

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->assertEquals($type, $types[$type]['plural']);
        }
        else {
            $this->assertEquals($type . 's', $types[$type]['plural']);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.