public function MigrateEmbedMediaTokenToEntityEmbedTest::providerEntityEmbedTransform in Media Migration 8
Data provider for ::testMediaTokenToEntityEmbedTransform().
Return value
array The test cases.
File
- tests/
src/ Functional/ MigrateEmbedMediaTokenToEntityEmbedTest.php, line 95
Class
- MigrateEmbedMediaTokenToEntityEmbedTest
- Tests the transformation of embed image media tokens to entity embed.
Namespace
Drupal\Tests\media_migration\FunctionalCode
public function providerEntityEmbedTransform() {
$default_attributes = [
'data-embed-button' => 'media',
'data-entity-embed-display' => 'view_mode:media.wysiwyg',
'data-entity-type' => 'media',
'alt' => 'Different alternative text about blue.png in the test article',
'title' => 'Different title copy for blue.png in the test article',
'data-align' => 'center',
];
$test_cases = [
'"ID" reference method, non-defined destination format plugin ID, preexisting media types' => [
'reference_method' => 'id',
'destination_filter' => NULL,
'expected_embed_html_attributes' => [
0 => [
'data-entity-id' => '1',
] + $default_attributes,
1 => [
'data-entity-type' => 'media',
'data-entity-id' => '7',
'data-entity-embed-display' => 'view_mode:media.full',
'data-embed-button' => 'media',
'alt' => 'A yellow image',
'title' => 'This is a yellow image',
],
],
'Preexisting media types' => TRUE,
],
'"ID" reference method, "entity_embed" destination format plugin ID, preexisting media types' => [
'reference_method' => 'id',
'destination_filter' => 'entity_embed',
'expected_embed_html_attributes' => [
0 => [
'data-entity-id' => '1',
] + $default_attributes,
1 => [
'data-entity-type' => 'media',
'data-entity-id' => '7',
'data-entity-embed-display' => 'view_mode:media.full',
'data-embed-button' => 'media',
'alt' => 'A yellow image',
'title' => 'This is a yellow image',
],
],
'Preexisting media types' => TRUE,
],
'"UUID" reference method, non-defined destination format plugin ID, preexisting media types' => [
'reference_method' => 'uuid',
'destination_filter' => NULL,
'expected_embed_html_attributes' => [
0 => [
'data-entity-uuid' => TRUE,
] + $default_attributes,
1 => [
'data-entity-type' => 'media',
'data-entity-uuid' => TRUE,
'data-entity-embed-display' => 'view_mode:media.full',
'data-embed-button' => 'media',
'alt' => 'A yellow image',
'title' => 'This is a yellow image',
],
],
'Preexisting media types' => TRUE,
],
'"UUID" reference method, "entity_embed" destination format plugin ID, preexisting media types' => [
'reference_method' => 'uuid',
'destination_filter' => 'entity_embed',
'expected_embed_html_attributes' => [
0 => [
'data-entity-uuid' => TRUE,
] + $default_attributes,
1 => [
'data-entity-type' => 'media',
'data-entity-uuid' => TRUE,
'data-entity-embed-display' => 'view_mode:media.full',
'data-embed-button' => 'media',
'alt' => 'A yellow image',
'title' => 'This is a yellow image',
],
],
'Preexisting media types' => TRUE,
],
];
// Add 'no initial media types' test cases.
$test_cases_without_media_types = [];
foreach ($test_cases as $test_case_label => $test_case) {
$without_media_label = preg_replace('/preexisting media types$/', 'no media types', $test_case_label);
$test_case['Preexisting media types'] = FALSE;
$test_cases_without_media_types[$without_media_label] = $test_case;
}
$test_cases += $test_cases_without_media_types;
return $test_cases;
}