You are here

public function LinkAreaTest::testLinkArea in Views link area 8

Tests the area handler.

@dataProvider providerTestLinkArea

Parameters

$options:

$expected_text:

$expected_link:

bool $no_dest:

File

tests/src/Kernel/Plugin/LinkTest.php, line 74

Class

LinkAreaTest
Tests the page display plugin.

Namespace

Drupal\Tests\views_linkarea\Kernel\Plugin

Code

public function testLinkArea($options, $expected_text, $expected_link, $no_dest = TRUE) {
  if ($no_dest) {

    // Set destination query string to off.
    $options['destination'] = 0;
  }
  $view = Views::getView('test_entity_linkarea');
  $display = $view
    ->getDisplay();
  $plugin = Views::pluginManager('area')
    ->createInstance('linkarea');

  // Initialize the plugin.
  $plugin
    ->init($view, $display, $options);
  $build = $plugin
    ->render();
  $this
    ->assertEquals($expected_text, $build['#title']);
  $this
    ->assertEquals($expected_link, $build['#url']
    ->toString());
}