You are here

protected function ViewExecutableTest::setupBaseViewAndDisplay in Zircon Profile 8

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

Setups a view executable and default display.

Return value

array Returns the view executable and default display.

10 calls to ViewExecutableTest::setupBaseViewAndDisplay()
ViewExecutableTest::testAddHandler in core/modules/views/tests/src/Unit/ViewExecutableTest.php
@covers ::addHandler
ViewExecutableTest::testAddHandlerWithEntityField in core/modules/views/tests/src/Unit/ViewExecutableTest.php
@covers ::addHandler
ViewExecutableTest::testAttachDisplays in core/modules/views/tests/src/Unit/ViewExecutableTest.php
@covers ::attachDisplays
ViewExecutableTest::testBuildThemeFunctions in core/modules/views/tests/src/Unit/ViewExecutableTest.php
@covers ::buildThemeFunctions
ViewExecutableTest::testSetCurrentPageBeforePreRender in core/modules/views/tests/src/Unit/ViewExecutableTest.php
@covers ::setCurrentPage @covers ::getCurrentPage

... See full list

File

core/modules/views/tests/src/Unit/ViewExecutableTest.php, line 437
Contains \Drupal\Tests\views\Unit\ViewExecutableTest.

Class

ViewExecutableTest
@coversDefaultClass \Drupal\views\ViewExecutable @group views

Namespace

Drupal\Tests\views\Unit

Code

protected function setupBaseViewAndDisplay() {
  $config = array(
    'id' => 'test_view',
    'tag' => 'OnE, TWO, and three',
    'display' => [
      'default' => [
        'id' => 'default',
        'display_plugin' => 'default',
        'display_title' => 'Default',
      ],
    ],
  );
  $storage = new View($config, 'view');
  $view = new ViewExecutable($storage, $this->user, $this->viewsData, $this->routeProvider);
  $display = $this
    ->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
    ->disableOriginalConstructor()
    ->getMock();
  $display->display = $config['display']['default'];
  $view->current_display = 'default';
  $view->display_handler = $display;
  $view->displayHandlers = $this->displayHandlers;
  $view->displayHandlers
    ->expects($this
    ->any())
    ->method('get')
    ->with('default')
    ->willReturn($display);
  $view->displayHandlers
    ->expects($this
    ->any())
    ->method('has')
    ->with('default')
    ->willReturn(TRUE);
  return array(
    $view,
    $display,
  );
}