You are here

public function FieldLinkTest::testCanonicalizeUri in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php \Drupal\Tests\link\Unit\Plugin\migrate\process\FieldLinkTest::testCanonicalizeUri()
  2. 9 core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php \Drupal\Tests\link\Unit\Plugin\migrate\process\FieldLinkTest::testCanonicalizeUri()

Tests the url transformations in the FieldLink process plugin.

@dataProvider canonicalizeUriDataProvider

File

core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php, line 21

Class

FieldLinkTest
@group Link

Namespace

Drupal\Tests\link\Unit\Plugin\migrate\process

Code

public function testCanonicalizeUri($url, $expected, $configuration = []) {
  $link_plugin = new FieldLink($configuration, '', [], $this
    ->createMock(MigrationInterface::class));
  $transformed = $link_plugin
    ->transform([
    'url' => $url,
    'title' => '',
    'attributes' => serialize([]),
  ], $this
    ->createMock(MigrateExecutableInterface::class), $this
    ->getMockBuilder(Row::class)
    ->disableOriginalConstructor()
    ->getMock(), NULL);
  $this
    ->assertEquals($expected, $transformed['uri']);
}