comparison core/modules/field/tests/src/Kernel/TranslationTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\field\Kernel; 3 namespace Drupal\Tests\field\Kernel;
4 4
5 use Drupal\Component\Utility\Unicode;
6 use Drupal\field\Entity\FieldConfig; 5 use Drupal\field\Entity\FieldConfig;
7 use Drupal\language\Entity\ConfigurableLanguage; 6 use Drupal\language\Entity\ConfigurableLanguage;
8 use Drupal\field\Entity\FieldStorageConfig; 7 use Drupal\field\Entity\FieldStorageConfig;
9 8
10 /** 9 /**
17 class TranslationTest extends FieldKernelTestBase { 16 class TranslationTest extends FieldKernelTestBase {
18 17
19 /** 18 /**
20 * Modules to enable. 19 * Modules to enable.
21 * 20 *
22 * node is required because the tests alter the node entity type. 21 * The node module is required because the tests alter the node entity type.
23 * 22 *
24 * @var array 23 * @var array
25 */ 24 */
26 public static $modules = ['language', 'node']; 25 public static $modules = ['language', 'node'];
27 26
73 protected function setUp() { 72 protected function setUp() {
74 parent::setUp(); 73 parent::setUp();
75 74
76 $this->installConfig(['language']); 75 $this->installConfig(['language']);
77 76
78 $this->fieldName = Unicode::strtolower($this->randomMachineName()); 77 $this->fieldName = mb_strtolower($this->randomMachineName());
79 78
80 $this->entityType = 'entity_test'; 79 $this->entityType = 'entity_test';
81 80
82 $this->fieldStorageDefinition = [ 81 $this->fieldStorageDefinition = [
83 'field_name' => $this->fieldName, 82 'field_name' => $this->fieldName,
138 } 137 }
139 $this->assertTrue($result, format_string('%language translation correctly handled.', ['%language' => $langcode])); 138 $this->assertTrue($result, format_string('%language translation correctly handled.', ['%language' => $langcode]));
140 } 139 }
141 140
142 // Test default values. 141 // Test default values.
143 $field_name_default = Unicode::strtolower($this->randomMachineName() . '_field_name'); 142 $field_name_default = mb_strtolower($this->randomMachineName() . '_field_name');
144 $field_storage_definition = $this->fieldStorageDefinition; 143 $field_storage_definition = $this->fieldStorageDefinition;
145 $field_storage_definition['field_name'] = $field_name_default; 144 $field_storage_definition['field_name'] = $field_name_default;
146 $field_storage = FieldStorageConfig::create($field_storage_definition); 145 $field_storage = FieldStorageConfig::create($field_storage_definition);
147 $field_storage->save(); 146 $field_storage->save();
148 147