You are here

public function FreelinkingManagerTest::parseTargetProvider in Freelinking 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/FreelinkingManagerTest.php \Drupal\Tests\freelinking\Unit\FreelinkingManagerTest::parseTargetProvider()

Provide test parameters and expected values for testParseTarget().

Return value

array An array of test parameters and expected values.

File

tests/src/Unit/FreelinkingManagerTest.php, line 76

Class

FreelinkingManagerTest
Tests the freelinking plugin manager.

Namespace

Drupal\Tests\freelinking\Unit

Code

public function parseTargetProvider() {
  return [
    [
      [
        'dest' => 'nid:2',
        'text' => 'Special title',
        'tooltip' => 'tooltip',
        'other' => [],
      ],
      'nid:2|Special title|tooltip',
    ],
    [
      [
        'dest' => 'nid:2',
        'text' => NULL,
        'tooltip' => NULL,
        'other' => [],
      ],
      'nid:2',
    ],
    [
      [
        'dest' => 'external:http://example.com?id=12345',
        'text' => '1',
        'tooltip' => NULL,
        'other' => [],
      ],
      'external:http://example.com?id=12345|1',
    ],
    [
      [
        'dest' => 'external:http://example.com?id=12345&q=%E2%99%A5#fragment',
        'text' => 'Title',
        'tooltip' => 'Tooltip',
        'arbitrary' => 'value',
        'other' => [
          'Other',
        ],
      ],
      'external:http://example.com?id=12345&q=%E2%99%A5#fragment|Title|Tooltip|arbitrary=value|Other',
    ],
  ];
}