You are here

public function ViewExecutableTest::testBuildThemeFunctions 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::testBuildThemeFunctions()

@covers ::buildThemeFunctions

File

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

Class

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

Namespace

Drupal\Tests\views\Unit

Code

public function testBuildThemeFunctions() {

  /** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */

  /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject $display */
  list($view, $display) = $this
    ->setupBaseViewAndDisplay();
  unset($view->display_handler);
  $expected = [
    'test_hook__test_view',
    'test_hook',
  ];
  $this
    ->assertEquals($expected, $view
    ->buildThemeFunctions('test_hook'));
  $view->display_handler = $display;
  $expected = [
    'test_hook__test_view__default',
    'test_hook__default',
    'test_hook__one',
    'test_hook__two',
    'test_hook__and_three',
    'test_hook__test_view',
    'test_hook',
  ];
  $this
    ->assertEquals($expected, $view
    ->buildThemeFunctions('test_hook'));

  //Change the name of the display plugin and make sure that is in the array.
  $view->display_handler->display['display_plugin'] = 'default2';
  $expected = [
    'test_hook__test_view__default',
    'test_hook__default',
    'test_hook__one',
    'test_hook__two',
    'test_hook__and_three',
    'test_hook__test_view__default2',
    'test_hook__default2',
    'test_hook__test_view',
    'test_hook',
  ];
  $this
    ->assertEquals($expected, $view
    ->buildThemeFunctions('test_hook'));
}