FieldDefaultTokenKernelTestBase.php in Field default token 8
File
tests/src/Kernel/FieldDefaultTokenKernelTestBase.php
View source
<?php
namespace Drupal\Tests\field_default_token\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\KernelTests\KernelTestBase;
abstract class FieldDefaultTokenKernelTestBase extends KernelTestBase {
protected $entityTypeId;
protected $bundle;
protected $fieldName = 'field_default_token_test';
public static $modules = [
'field',
'field_default_token',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema($this->entityTypeId);
FieldStorageConfig::create([
'field_name' => $this->fieldName,
'entity_type' => $this->entityTypeId,
'type' => 'string',
])
->save();
}
protected function createField() {
return FieldConfig::create([
'field_name' => $this->fieldName,
'entity_type' => $this->entityTypeId,
'bundle' => $this->bundle ?: $this->entityTypeId,
]);
}
}