You are here

public function FlagFollowerInstallUninstallTest::testInstallUninstall in Flag 8.4

File

modules/flag_follower/tests/src/Kernel/FlagFollowerInstallUninstallTest.php, line 18

Class

FlagFollowerInstallUninstallTest
Tests that the Flag follower module can be installed and uninstalled.

Namespace

Drupal\Tests\flag_follower\Kernel

Code

public function testInstallUninstall() {

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

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

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

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

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