function ViewsEntitySchemaSubscriberIntegrationTest::setUp

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::setUp()
  2. 8.9.x core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::setUp()
  3. 11.x core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::setUp()

Overrides ViewsKernelTestBase::setUp

File

core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php, line 78

Class

ViewsEntitySchemaSubscriberIntegrationTest
Tests \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber.

Namespace

Drupal\Tests\views\Kernel\EventSubscriber

Code

protected function setUp($import_test_views = TRUE) : void {
    parent::setUp();
    $this->eventDispatcher = $this->container
        ->get('event_dispatcher');
    $this->eventSubscriber = $this->container
        ->get('views.entity_schema_subscriber');
    $this->entityDefinitionUpdateManager = $this->container
        ->get('entity.definition_update_manager');
    $this->entityTypeManager = $this->container
        ->get('entity_type.manager');
    $this->state = $this->container
        ->get('state');
    // Install every entity type's schema that wasn't installed in the parent
    // method.
    foreach (array_diff_key($this->entityTypeManager
        ->getDefinitions(), array_flip([
        'user',
        'entity_test',
    ])) as $entity_type_id => $entity_type) {
        if ($entity_type instanceof ContentEntityTypeInterface) {
            $this->installEntitySchema($entity_type_id);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.