function HandlerBaseTest::testGetEntityTypeForFieldOnBaseTable

Same name and namespace in other branches
  1. 11.x core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldOnBaseTable()
  2. 9 core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldOnBaseTable()
  3. 8.9.x core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldOnBaseTable()
  4. main core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldOnBaseTable()

@covers ::getEntityType

File

core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php, line 32

Class

HandlerBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\HandlerBase[[api-linebreak]] @group Views

Namespace

Drupal\Tests\views\Unit\Plugin

Code

public function testGetEntityTypeForFieldOnBaseTable() : void {
  $handler = new TestHandler([], 'test_handler', []);
  $handler->init($this->executable, $this->display);
  $this->view
    ->expects($this->any())
    ->method('get')
    ->with('base_table')
    ->willReturn('test_entity_type_table');
  $this->viewsData
    ->expects($this->any())
    ->method('get')
    ->with('test_entity_type_table')
    ->willReturn([
    'table' => [
      'entity type' => 'test_entity_type',
    ],
  ]);
  $handler->setViewsData($this->viewsData);
  $this->assertEquals('test_entity_type', $handler->getEntityType());
}

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