You are here

public function DevelModulesReinstallTest::testDevelReinstallModules in Devel 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DevelModulesReinstallTest.php \Drupal\Tests\devel\Functional\DevelModulesReinstallTest::testDevelReinstallModules()
  2. 8.2 tests/src/Functional/DevelModulesReinstallTest.php \Drupal\Tests\devel\Functional\DevelModulesReinstallTest::testDevelReinstallModules()
  3. 4.x tests/src/Functional/DevelModulesReinstallTest.php \Drupal\Tests\devel\Functional\DevelModulesReinstallTest::testDevelReinstallModules()

Reinstall modules.

File

tests/src/Functional/DevelModulesReinstallTest.php, line 41

Class

DevelModulesReinstallTest
Tests reinstall modules.

Namespace

Drupal\Tests\devel\Functional

Code

public function testDevelReinstallModules() {

  // Minimal profile enables only dblog, block and node.
  $modules = [
    'dblog',
    'block',
  ];

  // Needed for compare correctly the message.
  sort($modules);
  $this
    ->drupalGet('devel/reinstall');

  // Prepare field data in an associative array
  $edit = [];
  foreach ($modules as $module) {
    $edit["reinstall[{$module}]"] = TRUE;
  }
  $this
    ->drupalPostForm('devel/reinstall', $edit, t('Reinstall'));
  $this
    ->assertText(t('Uninstalled and installed: @names.', [
    '@names' => implode(', ', $modules),
  ]));
}