function ViewsHandlerManagerTest::testGetHandlerOverride

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php \Drupal\Tests\views\Unit\ViewsHandlerManagerTest::testGetHandlerOverride()
  2. 8.9.x core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php \Drupal\Tests\views\Unit\ViewsHandlerManagerTest::testGetHandlerOverride()
  3. 10 core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php \Drupal\Tests\views\Unit\ViewsHandlerManagerTest::testGetHandlerOverride()

Tests getHandler() with an override.

File

core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php, line 127

Class

ViewsHandlerManagerTest
Tests the ViewsHandlerManager class.

Namespace

Drupal\Tests\views\Unit

Code

public function testGetHandlerOverride() : void {
    $this->setupMockedFactory();
    $item = [];
    $item['table'] = 'test_table';
    $item['field'] = 'test_field';
    $views_data = [];
    $views_data['test_field']['test']['id'] = 'test_id';
    $this->viewsData
        ->expects($this->once())
        ->method('get')
        ->with('test_table')
        ->willReturn($views_data);
    $plugin = $this->createMock('Drupal\\views\\Plugin\\views\\ViewsHandlerInterface');
    $this->factory
        ->expects($this->once())
        ->method('createInstance')
        ->with('test_override')
        ->willReturn($plugin);
    $result = $this->handlerManager
        ->getHandler($item, 'test_override');
    $this->assertSame($plugin, $result);
}

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