public function FieldLinkTest::testCanonicalizeUriSerialized in Drupal 10
Same name and namespace in other branches
- 8 core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php \Drupal\Tests\link\Unit\Plugin\migrate\process\FieldLinkTest::testCanonicalizeUriSerialized()
- 9 core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php \Drupal\Tests\link\Unit\Plugin\migrate\process\FieldLinkTest::testCanonicalizeUriSerialized()
Tests the attributes that are deeply serialized are discarded.
File
- core/
modules/ link/ tests/ src/ Unit/ Plugin/ migrate/ process/ FieldLinkTest.php, line 111
Class
- FieldLinkTest
- @group Link
Namespace
Drupal\Tests\link\Unit\Plugin\migrate\processCode
public function testCanonicalizeUriSerialized() {
$link_plugin = new FieldLink([], '', [], $this
->createMock(MigrationInterface::class));
$migrate_executable = $this
->createMock(MigrateExecutableInterface::class);
$row = new Row();
$transformed = $link_plugin
->transform([
'url' => '',
'title' => '',
'attributes' => serialize(serialize([
'not too deep',
])),
], $migrate_executable, $row, NULL);
$this
->assertEquals([
'not too deep',
], $transformed['options']['attributes']);
$transformed = $link_plugin
->transform([
'url' => '',
'title' => '',
'attributes' => serialize(serialize(serialize([
'too deep',
]))),
], $migrate_executable, $row, NULL);
$this
->assertEmpty($transformed['options']['attributes']);
}