function DevelModulesReinstallTest::testDevelReinstallModules

Same name in other branches
  1. 5.x tests/src/Functional/DevelModulesReinstallTest.php \Drupal\Tests\devel\Functional\DevelModulesReinstallTest::testDevelReinstallModules()

Reinstall modules.

File

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

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, 'Reinstall');
    $this->assertSession()
        ->pageTextContains('Uninstalled and installed: ' . implode(', ', $modules) . '.');
}