public function FieldPluginBaseTest::providerTestRenderAsExternalLinkWithPathAndTokens in Drupal 8
Same name and namespace in other branches
- 9 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 636  - Contains \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest.
 
Class
- FieldPluginBaseTest
 - @coversDefaultClass \Drupal\views\Plugin\views\field\FieldPluginBase @group views
 
Namespace
Drupal\Tests\views\Unit\Plugin\fieldCode
public function providerTestRenderAsExternalLinkWithPathAndTokens() {
  $data = [];
  $data[] = [
    '{{ foo }}',
    [
      '{{ foo }}' => 'http://www.drupal.org',
    ],
    '<a href="http://www.drupal.org">value</a>',
    [
      'context_path' => 'http://www.drupal.org',
    ],
  ];
  $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;
}