You are here

protected function Update360Test::setUp in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/Update360Test.php \Drupal\Tests\lightning_media\Functional\Update360Test::setUp()

Overrides WebTestBase::setUp() for update testing.

The main difference in this method is that rather than performing the installation via the installer, a database is loaded. Additional work is then needed to set various things such as the config directories and the container that would normally be done via the installer.

Overrides UpdatePathTestBase::setUp

File

tests/src/Functional/Update360Test.php, line 52

Class

Update360Test
Tests the update to Lightning Media 3.6.0.

Namespace

Drupal\Tests\lightning_media\Functional

Code

protected function setUp() {
  parent::setUp();

  // Remove Lightning Dev from the restored database.
  $this
    ->config('core.extension')
    ->clear('module.lightning_dev')
    ->save();
  $this->container
    ->get('keyvalue')
    ->get('system.schema')
    ->delete('lightning_dev');

  // Create a content type so we can test that content roles are correctly
  // updated.
  $this
    ->drupalCreateContentType([
    'type' => 'test',
  ]);

  // Install Lightning Roles so we can ensure that content authoring
  // permissions are updated too.
  \Drupal::service('module_installer')
    ->install([
    'lightning_roles',
  ]);

  // Installing Lightning Roles will create the roles as we ship them, so we
  // need to revoke the new permissions before the test.
  $permissions = [
    'access ckeditor_media_browser entity browser pages',
  ];
  user_role_revoke_permissions('media_creator', $permissions);
  user_role_revoke_permissions('media_manager', $permissions);
  user_role_revoke_permissions('test_creator', $permissions);
}