function DevelReinstallCommandTest::testReinstall

Modules are uninstalled and installed again.

File

tests/src/Kernel/DevelReinstallCommandTest.php, line 34

Class

DevelReinstallCommandTest
Tests the devel:reinstall command.

Namespace

Drupal\Tests\devel\Kernel

Code

public function testReinstall() : void {
  // Uninstalling a module deletes its user data.
  $this->installSchema('user', [
    'users_data',
  ]);
  $this->container
    ->get('module_installer')
    ->install([
    'help',
    'syslog',
  ]);
  // This is recorded afresh when a module is installed.
  \Drupal::keyValue('system.schema')->set('help', 1234);
  $tester = $this->runCommand('help, syslog');
  $this->assertSame(Command::SUCCESS, $tester->getStatusCode(), $tester->getDisplay());
  $this->assertStringContainsString('help,syslog reinstalled.', $tester->getDisplay());
  $this->assertTrue(\Drupal::moduleHandler()->moduleExists('help'));
  $this->assertTrue(\Drupal::moduleHandler()->moduleExists('syslog'));
  $this->assertNotSame(1234, \Drupal::keyValue('system.schema')->get('help'));
}