function FieldPluginBaseTest::providerTestRenderAsExternalLinkWithPathAndTokens

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::providerTestRenderAsExternalLinkWithPathAndTokens()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::providerTestRenderAsExternalLinkWithPathAndTokens()
  3. 10 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::providerTestRenderAsExternalLinkWithPathAndTokens()

Data provider for ::testRenderAsExternalLinkWithPathAndTokens().

Return value

array Test data.

File

core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php, line 719

Class

FieldPluginBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\field\FieldPluginBase[[api-linebreak]] @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

public static function providerTestRenderAsExternalLinkWithPathAndTokens() {
  $data = [];
  $data[] = [
    '{{ foo }}',
    [
      '{{ foo }}' => 'http://www.example.com',
    ],
    '<a href="http://www.example.com">value</a>',
    [
      'context_path' => 'http://www.example.com',
    ],
  ];
  $data[] = [
    '{{ foo }}',
    [
      '{{ foo }}' => '',
    ],
    'value',
    [
      'context_path' => '',
    ],
  ];
  $data[] = [
    '{{ foo }}',
    [
      '{{ foo }}' => '',
    ],
    'value',
    [
      'context_path' => '',
      'alter' => [
        'external' => TRUE,
      ],
    ],
  ];
  $data[] = [
    '{{ foo }}',
    [
      '{{ foo }}' => '/test-path/123',
    ],
    '<a href="/test-path/123">value</a>',
    [
      'context_path' => '/test-path/123',
    ],
  ];
  return $data;
}

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