function NonStableModulesTest::testDeprecatedAndExperimentalConfirmForm
Tests installing deprecated and experimental modules at the same time.
@group legacy
File
- 
              core/
modules/ system/ tests/ src/ Functional/ Module/ NonStableModulesTest.php, line 357  
Class
- NonStableModulesTest
 - Tests the installation of deprecated and experimental modules.
 
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testDeprecatedAndExperimentalConfirmForm() : void {
  $edit = [];
  $edit["modules[deprecated_module][enable]"] = TRUE;
  $edit["modules[experimental_module_test][enable]"] = TRUE;
  $this->drupalGet('admin/modules');
  $this->submitForm($edit, 'Install');
  // The module should not be enabled and there should be a warning and a
  // list of the deprecated modules with only this one.
  $assert = $this->assertSession();
  $assert->pageTextNotContains('Deprecated module has been installed.');
  $assert->pageTextContains('Deprecated modules are modules that may be removed from the next major release of Drupal core. Use at your own risk.');
  $assert->pageTextContains('The Deprecated module module is deprecated');
  $more_information_link = $assert->elementExists('named', [
    'link',
    'The Deprecated module module is deprecated. (more information)',
  ]);
  $this->assertEquals('http://example.com/deprecated', $more_information_link->getAttribute('href'));
  // The module should not be enabled and there should be a warning and a
  // list of the experimental modules with only this one.
  $assert->pageTextNotContains('Experimental Test has been installed.');
  $assert->pageTextContains('Experimental modules are provided for testing purposes only.');
  $assert->pageTextContains('The following module is experimental: Experimental Test');
  // There should be a warning about enabling experimental and deprecated
  // modules, but no warnings about solitary experimental or deprecated
  // modules.
  $this->assertSession()
    ->pageTextContains('Are you sure you wish to install experimental and deprecated modules?');
  $this->assertSession()
    ->pageTextNotContains('Are you sure you wish to install experimental modules?');
  $this->assertSession()
    ->pageTextNotContains('Are you sure you wish to install deprecated modules?');
  // There should be no message about enabling dependencies.
  $assert->pageTextNotContains('You must install');
  // Enable the module and confirm that it worked.
  $this->submitForm([], 'Continue');
  $assert->pageTextContains('2 modules have been installed: Deprecated module, Experimental Test.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.