You are here

public function ViewsHandlerManagerTest::testGetHandlerNoOverride in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php \Drupal\Tests\views\Unit\ViewsHandlerManagerTest::testGetHandlerNoOverride()

Tests getHandler() without an override.

File

core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php, line 158
Contains \Drupal\Tests\views\Unit\ViewsHandlerManagerTest.

Class

ViewsHandlerManagerTest
Tests the ViewsHandlerManager class.

Namespace

Drupal\Tests\views\Unit

Code

public function testGetHandlerNoOverride() {
  $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
    ->getMock('Drupal\\views\\Plugin\\views\\ViewsHandlerInterface');
  $this->factory
    ->expects($this
    ->once())
    ->method('createInstance')
    ->with('test_id')
    ->willReturn($plugin);
  $result = $this->handlerManager
    ->getHandler($item);
  $this
    ->assertSame($plugin, $result);
}