function ViewValidationTest::setUpEnvironment

Overrides ConfigEntityValidationTestBase::setUpEnvironment

File

core/modules/views/tests/src/Kernel/Entity/ViewValidationTest.php, line 38

Class

ViewValidationTest
Tests validation of view entities.

Namespace

Drupal\Tests\views\Kernel\Entity

Code

protected function setUpEnvironment() : void {
  parent::setUpEnvironment();
  $this->entity = View::create([
    'id' => 'test',
    'label' => 'Test',
  ]);
  $this->entity
    ->save();
  // Disable the `broken` handler plugin, which is used as a fallback for
  // non-existent handler plugins. This ensures that when we use an
  // invalid handler plugin ID, we will get the expected validation error.
  // @todo Remove all this when fallback plugin IDs are not longer allowed by
  //   Views' config schema.
  // @see views_test_config.module
  $this->container
    ->get('state')
    ->set(self::DISABLE_BROKEN_HANDLER_STATE, [
    'area',
    'argument',
    'sort',
    'field',
    'filter',
    'relationship',
  ]);
  $this->container
    ->get('plugin.cache_clearer')
    ->clearCachedDefinitions();
}

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