FieldInstanceLabelDescriptionTranslationTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php
- 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php
- 8.9.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php
- 8.9.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php
- 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php
- 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php
Namespace
Drupal\Tests\field\Kernel\Plugin\migrate\source\d7File
-
core/
modules/ field/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ FieldInstanceLabelDescriptionTranslationTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\field\Kernel\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
// cspell:ignore objectid plid textgroup
/**
* Tests the field label and description translation source plugin.
*
* @covers \Drupal\field\Plugin\migrate\source\d7\FieldLabelDescriptionTranslation
* @group migrate_drupal
*/
class FieldInstanceLabelDescriptionTranslationTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'config_translation',
'migrate_drupal',
'field',
];
/**
* {@inheritdoc}
*/
public static function providerSource() {
$test = [];
// The source data.
$test[0]['source_data'] = [
'i18n_string' => [
[
'lid' => 10,
'textgroup' => 'field',
'objectid' => 'story',
'type' => 'field_image',
'property' => 'label',
],
[
'lid' => 11,
'textgroup' => 'field',
'objectid' => 'story',
'type' => 'field_image',
'property' => 'description',
],
[
'lid' => 12,
'textgroup' => 'field',
'objectid' => 'forum',
'type' => 'taxonomy_forums',
'property' => 'label',
],
[
'lid' => 1,
'textgroup' => 'field',
'objectid' => 'story',
'type' => 'field_text',
'property' => 'label',
],
],
'locales_target' => [
[
'lid' => 10,
'translation' => 'fr - story label',
'language' => 'fr',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
[
'lid' => 11,
'translation' => 'fr - story description',
'language' => 'fr',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
[
'lid' => 12,
'translation' => 'zu - term reference',
'language' => 'zu',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
],
'field_config_instance' => [
[
'id' => '2',
'field_id' => '2',
'field_name' => 'field_image',
'entity_type' => 'node',
'bundle' => 'story',
'data' => 'a:0:{}',
'deleted' => '0',
],
[
'id' => '3',
'field_id' => '3',
'field_name' => 'field_image',
'entity_type' => 'node',
'bundle' => 'article',
'data' => 'a:0:{}',
'deleted' => '0',
],
[
'id' => '3',
'field_id' => '4',
'field_name' => 'field_term_reference',
'entity_type' => 'taxonomy_term',
'bundle' => 'trees',
'data' => 'a:0:{}',
'deleted' => '0',
],
],
];
$test[0]['expected_data'] = [
[
'property' => 'label',
'translation' => "fr - story label",
'language' => 'fr',
'lid' => '10',
],
[
'property' => 'description',
'translation' => 'fr - story description',
'language' => 'fr',
'lid' => '11',
],
[
'property' => 'label',
'translation' => 'zu - term reference',
'language' => 'zu',
'lid' => '12',
],
];
return $test;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
FieldInstanceLabelDescriptionTranslationTest | Tests the field label and description translation source plugin. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.