PageTest.php

Same filename in this branch
  1. 9 core/modules/system/tests/src/Functional/Batch/PageTest.php
Same filename in other branches
  1. 8.9.x core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
  2. 8.9.x core/modules/system/tests/src/Functional/Batch/PageTest.php
  3. 10 core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
  4. 10 core/modules/system/tests/src/Functional/Batch/PageTest.php
  5. 11.x core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
  6. 11.x core/modules/system/tests/src/Functional/Batch/PageTest.php

Namespace

Drupal\Tests\views\Unit\Plugin\display

File

core/modules/views/tests/src/Unit/Plugin/display/PageTest.php

View source
<?php

namespace Drupal\Tests\views\Unit\Plugin\display;

use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\display\Page;
use Symfony\Component\Routing\Route;

/**
 * @coversDefaultClass \Drupal\views\Plugin\views\display\Page
 * @group views
 */
class PageTest extends UnitTestCase {
    
    /**
     * @covers ::buildBasicRenderable
     */
    public function testBuildBasicRenderable() {
        $route = new Route('/test-view');
        $route->setDefault('view_id', 'test_view');
        $route->setOption('_view_display_plugin_id', 'page');
        $route->setOption('_view_display_show_admin_links', TRUE);
        $result = Page::buildBasicRenderable('test_view', 'page_1', [], $route);
        $this->assertEquals('test_view', $result['#view_id']);
        $this->assertEquals('page', $result['#view_display_plugin_id']);
        $this->assertEquals(TRUE, $result['#view_display_show_admin_links']);
    }
    
    /**
     * @covers ::buildBasicRenderable
     */
    public function testBuildBasicRenderableWithMissingRoute() {
        $this->expectException(\BadFunctionCallException::class);
        Page::buildBasicRenderable('test_view', 'page_1', []);
    }

}

Classes

Title Deprecated Summary
PageTest @coversDefaultClass \Drupal\views\Plugin\views\display\Page @group views

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