comparison core/modules/field/tests/src/Kernel/FieldCrudTest.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
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\Core\Entity\EntityStorageException; 5 use Drupal\Core\Entity\EntityStorageException;
7 use Drupal\Core\Field\FieldException; 6 use Drupal\Core\Field\FieldException;
8 use Drupal\entity_test\Entity\EntityTest; 7 use Drupal\entity_test\Entity\EntityTest;
9 use Drupal\field\Entity\FieldStorageConfig; 8 use Drupal\field\Entity\FieldStorageConfig;
10 use Drupal\field\Entity\FieldConfig; 9 use Drupal\field\Entity\FieldConfig;
41 40
42 public function setUp() { 41 public function setUp() {
43 parent::setUp(); 42 parent::setUp();
44 43
45 $this->fieldStorageDefinition = [ 44 $this->fieldStorageDefinition = [
46 'field_name' => Unicode::strtolower($this->randomMachineName()), 45 'field_name' => mb_strtolower($this->randomMachineName()),
47 'entity_type' => 'entity_test', 46 'entity_type' => 'entity_test',
48 'type' => 'test_field', 47 'type' => 'test_field',
49 ]; 48 ];
50 $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition); 49 $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition);
51 $this->fieldStorage->save(); 50 $this->fieldStorage->save();
197 196
198 /** 197 /**
199 * Test creating a field with custom storage set. 198 * Test creating a field with custom storage set.
200 */ 199 */
201 public function testCreateFieldCustomStorage() { 200 public function testCreateFieldCustomStorage() {
202 $field_name = Unicode::strtolower($this->randomMachineName()); 201 $field_name = mb_strtolower($this->randomMachineName());
203 \Drupal::state()->set('field_test_custom_storage', $field_name); 202 \Drupal::state()->set('field_test_custom_storage', $field_name);
204 203
205 $field_storage = FieldStorageConfig::create([ 204 $field_storage = FieldStorageConfig::create([
206 'field_name' => $field_name, 205 'field_name' => $field_name,
207 'entity_type' => 'entity_test', 206 'entity_type' => 'entity_test',