You are here

public function LinkGeneratorTest::providerTestGenerateHrefs in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::providerTestGenerateHrefs()
  2. 10 core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::providerTestGenerateHrefs()

Provides test data for testing the link method.

Return value

array Returns some test data.

See also

\Drupal\Tests\Core\Utility\LinkGeneratorTest::testGenerateHrefs()

File

core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php, line 91

Class

LinkGeneratorTest
@coversDefaultClass \Drupal\Core\Utility\LinkGenerator @group Utility

Namespace

Drupal\Tests\Core\Utility

Code

public function providerTestGenerateHrefs() {
  return [
    // Test that the url returned by the URL generator is used.
    [
      'test_route_1',
      [],
      FALSE,
      '/test-route-1',
    ],
    // Test that $parameters is passed to the URL generator.
    [
      'test_route_2',
      [
        'value' => 'example',
      ],
      FALSE,
      '/test-route-2/example',
    ],
    // Test that the 'absolute' option is passed to the URL generator.
    [
      'test_route_3',
      [],
      TRUE,
      'http://example.com/test-route-3',
    ],
  ];
}