Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / serialization / tests / src / Kernel / NormalizerTestBase.php
1 <?php
2
3 namespace Drupal\Tests\serialization\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\field\Entity\FieldConfig;
7 use Drupal\field\Entity\FieldStorageConfig;
8
9 /**
10  * Helper base class to set up some test fields for serialization testing.
11  */
12 abstract class NormalizerTestBase extends KernelTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['serialization', 'system', 'field', 'entity_test', 'text', 'filter', 'user'];
20
21   protected function setUp() {
22     parent::setUp();
23
24     $this->installEntitySchema('entity_test_mulrev');
25     $this->installEntitySchema('user');
26     $this->installConfig(['field']);
27     \Drupal::service('router.builder')->rebuild();
28     \Drupal::moduleHandler()->invoke('rest', 'install');
29
30     // Auto-create a field for testing.
31     FieldStorageConfig::create([
32       'entity_type' => 'entity_test_mulrev',
33       'field_name' => 'field_test_text',
34       'type' => 'text',
35       'cardinality' => 1,
36       'translatable' => FALSE,
37     ])->save();
38     FieldConfig::create([
39       'entity_type' => 'entity_test_mulrev',
40       'field_name' => 'field_test_text',
41       'bundle' => 'entity_test_mulrev',
42       'label' => 'Test text-field',
43       'widget' => [
44         'type' => 'text_textfield',
45         'weight' => 0,
46       ],
47     ])->save();
48   }
49
50 }