function ConfigurableEventHandlerTest::setUp

Overrides RulesKernelTestBase::setUp

File

tests/src/Kernel/ConfigurableEventHandlerTest.php, line 40

Class

ConfigurableEventHandlerTest
Tests events with qualified name.

Namespace

Drupal\Tests\rules\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installSchema('system', [
        'sequences',
    ]);
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installConfig([
        'field',
    ]);
    $this->storage = $this->container
        ->get('entity_type.manager')
        ->getStorage('rules_reaction_rule');
    $entity_type_manager = $this->container
        ->get('entity_type.manager');
    $entity_type_manager->getStorage('node_type')
        ->create([
        'type' => 'page',
    ])
        ->save();
    // Create a field "field_integer".
    FieldStorageConfig::create([
        'field_name' => 'field_integer',
        'type' => 'integer',
        'entity_type' => 'node',
        'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
    ])->save();
    FieldConfig::create([
        'field_name' => 'field_integer',
        'entity_type' => 'node',
        'bundle' => 'page',
    ])->save();
    // Create a "page" node bundle (aka content type) with field_integer.
    $this->node = $entity_type_manager->getStorage('node')
        ->create([
        'title' => 'test',
        'type' => 'page',
    ]);
}