function AutocompleteTest::setUp

Overrides RulesKernelTestBase::setUp

File

tests/src/Kernel/Engine/AutocompleteTest.php, line 27

Class

AutocompleteTest
Tests that data selector autocomplete results work correctly.

Namespace

Drupal\Tests\rules\Kernel\Engine

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    // The global CurrentUserContext doesn't work properly without a
    // fully-installed user module.
    // @see https://www.drupal.org/project/rules/issues/2989417
    $this->container
        ->get('module_handler')
        ->loadInclude('user', 'install');
    user_install();
    $entity_type_manager = $this->container
        ->get('entity_type.manager');
    $entity_type_manager->getStorage('node_type')
        ->create([
        'type' => 'page',
    ])
        ->save();
    // Create a multi-value integer field for testing.
    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();
}