X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Ffield%2Ftests%2Fsrc%2FKernel%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FFieldOptionTranslationTest.php;fp=web%2Fcore%2Fmodules%2Ffield%2Ftests%2Fsrc%2FKernel%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FFieldOptionTranslationTest.php;h=8503a3f581fa8b652227a61400b50c8de1f3f233;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=0000000000000000000000000000000000000000;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php b/web/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php new file mode 100644 index 000000000..8503a3f58 --- /dev/null +++ b/web/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php @@ -0,0 +1,242 @@ + 'field_test_text_single_checkbox', + 'type' => 'text', + 'global_settings' => 'a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:10:"Off\\nHello";s:18:"allowed_values_php";s:0:"";}', + 'required' => 0, + 'multiple' => 0, + 'db_storage' => 1, + 'module' => 'text', + ], + [ + 'field_name' => 'field_test_integer_selectlist', + 'type' => 'number_integer', + 'global_settings' => 'a:6:{s:6:"prefix";s:0:"";s:6:"suffix";s:0:"";s:3:"min";s:0:"";s:3:"max";s:0:"";s:14:"allowed_values";s:22:"1234\\n2341\\n3412\\n4123";s:18:"allowed_values_php";s:0:"";}', + 'required' => 0, + 'multiple' => 0, + 'db_storage' => 1, + 'module' => 'text', + ], + ]; + $test[0]['source_data']['content_node_field_instance'] = [ + [ + 'field_name' => 'field_test_text_single_checkbox', + 'type_name' => 'story', + 'weight' => 1, + 'label' => 'Text Single Checkbox Field', + 'widget_type' => 'optionwidgets_onoff', + 'description' => 'An example text field using a single on/off checkbox.', + 'widget_module' => 'optionwidgets', + 'widget_active' => 1, + 'required' => 1, + 'active' => 1, + 'global_settings' => 'a:0;', + 'widget_settings' => 'a:0;', + 'display_settings' => 'a:0;', + ], + [ + 'field_name' => 'field_test_integer_selectlist', + 'type_name' => 'story', + 'weight' => 1, + 'label' => 'Integer Select List Field', + 'widget_type' => 'optionwidgets_select', + 'description' => 'An example integer field using a select list.', + 'widget_module' => 'optionwidgets', + 'widget_active' => 1, + 'required' => 1, + 'active' => 1, + 'global_settings' => 'a:0;', + 'widget_settings' => 'a:0;', + 'display_settings' => 'a:0;', + ], + ]; + + $test[0]['source_data']['i18n_strings'] = [ + [ + 'lid' => 10, + 'objectid' => 'field_test_text_single_checkbox', + 'type' => 'field', + 'property' => 'option_0', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 11, + 'objectid' => 'field_test_text_single_checkbox', + 'type' => 'field', + 'property' => 'option_1', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 20, + 'objectid' => 'field_test_integer_selectlist', + 'type' => 'field', + 'property' => 'option_1234', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 21, + 'objectid' => 'field_test_integer_selectlist', + 'type' => 'field', + 'property' => 'option_4123', + 'objectindex' => 0, + 'format' => 0, + ], + ]; + $test[0]['source_data']['locales_target'] = [ + [ + 'lid' => 10, + 'translation' => "fr - Hello", + 'language' => 'fr', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 11, + 'translation' => 'fr - Goodbye', + 'language' => 'fr', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 20, + 'translation' => "fr - 4444", + 'language' => 'fr', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 21, + 'translation' => 'fr - 5555', + 'language' => 'fr', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + ]; + + $test[0]['expected_results'] = [ + [ + 'field_name' => 'field_test_text_single_checkbox', + 'type' => 'text', + 'widget_type' => 'optionwidgets_onoff', + 'global_settings' => [ + 'allowed_values' => 'Off\nHello', + 'allowed_values_php' => '', + 'max_length' => '', + 'text_processing' => '0', + ], + 'db_columns' => '', + 'property' => 'option_0', + 'objectid' => 'field_test_text_single_checkbox', + 'language' => 'fr', + 'translation' => 'fr - Hello', + 'objectindex' => 0, + 'format' => 0, + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'field_name' => 'field_test_text_single_checkbox', + 'type' => 'text', + 'widget_type' => 'optionwidgets_onoff', + 'global_settings' => [ + 'allowed_values' => 'Off\nHello', + 'allowed_values_php' => '', + 'max_length' => '', + 'text_processing' => '0', + ], + 'db_columns' => '', + 'property' => 'option_1', + 'objectid' => 'field_test_text_single_checkbox', + 'language' => 'fr', + 'translation' => 'fr - Goodbye', + 'objectindex' => 0, + 'format' => 0, + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'field_name' => 'field_test_integer_selectlist', + 'type' => 'number_integer', + 'widget_type' => 'optionwidgets_select', + 'global_settings' => [ + 'allowed_values' => '1234\n2341\n3412\n4123', + 'max' => '', + 'min' => '', + 'prefix' => '', + 'suffix' => '', + 'allowed_values_php' => '', + ], + 'db_columns' => '', + 'property' => 'option_1234', + 'objectid' => 'field_test_integer_selectlist', + 'language' => 'fr', + 'translation' => 'fr - 4444', + 'objectindex' => 0, + 'format' => 0, + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'field_name' => 'field_test_integer_selectlist', + 'type' => 'number_integer', + 'widget_type' => 'optionwidgets_select', + 'global_settings' => [ + 'allowed_values' => '1234\n2341\n3412\n4123', + 'max' => '', + 'min' => '', + 'prefix' => '', + 'suffix' => '', + 'allowed_values_php' => '', + ], + 'db_columns' => '', + 'property' => 'option_4123', + 'objectid' => 'field_test_integer_selectlist', + 'language' => 'fr', + 'translation' => 'fr - 5555', + 'objectindex' => 0, + 'format' => 0, + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + ]; + return $test; + } + +}