You are here

public function FlagBookmarkInstallUninstallTest::testInstallUninstall in Flag 8.4

File

modules/flag_bookmark/tests/src/Kernel/FlagBookmarkInstallUninstallTest.php, line 16

Class

FlagBookmarkInstallUninstallTest
Tests that the Flag bookmark module can be installed and uninstalled.

Namespace

Drupal\Tests\flag_bookmark\Kernel

Code

public function testInstallUninstall() {

  // Provides configuraiton depended on by the view.
  $this
    ->installConfig([
    'system',
  ]);

  // Tables necessary for uninstall.
  $this
    ->installSchema('system', [
    'key_value_expire',
  ]);
  $this
    ->installSchema('user', [
    'users_data',
  ]);

  // Install the Flag bookmark module.
  $this->container
    ->get('module_installer')
    ->install([
    'flag_bookmark',
  ]);
  $this
    ->doTestsOnInstall();

  // Uninstall the Flag bookmark module and ensure it cleans up.
  $this->container
    ->get('module_installer')
    ->uninstall([
    'flag_bookmark',
  ]);
  $this
    ->assertNull(Flag::load('bookmark'));
  $this
    ->assertNull(View::load('flag_bookmark'));

  // Install the Flag bookmark module again.
  $this->container
    ->get('module_installer')
    ->install([
    'flag_bookmark',
  ]);
  $this
    ->doTestsOnInstall();
}