function ModuleTest::assertInstanceHandler

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::assertInstanceHandler()
  2. 10 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::assertInstanceHandler()
  3. 11.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::assertInstanceHandler()

Ensure that a certain handler is an instance of a certain table/field.

@internal

1 call to ModuleTest::assertInstanceHandler()
ModuleTest::testViewsGetHandler in core/modules/views/tests/src/Kernel/ModuleTest.php
Tests the ViewsHandlerManager::getHandler() method.

File

core/modules/views/tests/src/Kernel/ModuleTest.php, line 341

Class

ModuleTest
Tests basic functions from the Views module.

Namespace

Drupal\Tests\views\Kernel

Code

public function assertInstanceHandler(ViewsHandlerInterface $handler, string $table, string $field, string $id) : void {
    $table_data = $this->container
        ->get('views.views_data')
        ->get($table);
    $field_data = $table_data[$field][$id];
    $this->assertEquals($handler->getPluginId(), $field_data['id']);
}

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