You are here

protected function FieldEntityLinkTest::setUpFixtures in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/FieldEntityLinkTest.php \Drupal\views\Tests\Handler\FieldEntityLinkTest::setUpFixtures()

Sets up the configuration and schema of views and views_test_data modules.

Because the schema of views_test_data.module is dependent on the test using it, it cannot be enabled normally.

Overrides ViewKernelTestBase::setUpFixtures

File

core/modules/views/src/Tests/Handler/FieldEntityLinkTest.php, line 50
Contains \Drupal\views\Tests\Handler\FieldEntityLinkTest.

Class

FieldEntityLinkTest
Tests the core Drupal\views\Plugin\views\field\EntityOperations handler.

Namespace

Drupal\views\Tests\Handler

Code

protected function setUpFixtures() {
  parent::setUpFixtures();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installConfig([
    'user',
  ]);

  // Create some test entities.
  for ($i = 0; $i < 5; $i++) {
    EntityTest::create([
      'name' => $this
        ->randomString(),
    ])
      ->save();
  }

  // Create and admin user.
  $this->adminUser = $this
    ->createUser([
    'view test entity',
  ], FALSE, TRUE);
  Role::load(AccountInterface::ANONYMOUS_ROLE)
    ->grantPermission('view test entity')
    ->save();
}