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 628

Class

FieldPluginBaseTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21field%21FieldPluginBase.php/class/FieldPluginBase/11.x" title="Base class for views fields." class="local">\Drupal\views\Plugin\views\field\FieldPluginBase</a> @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.