InstallProfileDependenciesBcTest.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. use Drupal\Tests\BrowserTestBase;
  4. /**
  5. * Tests that an install profile with only dependencies works as expected.
  6. *
  7. * @group Installer
  8. * @group legacy
  9. */
  10. class InstallProfileDependenciesBcTest extends BrowserTestBase {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. protected $defaultTheme = 'stark';
  15. /**
  16. * {@inheritdoc}
  17. */
  18. protected $profile = 'testing_install_profile_dependencies_bc';
  19. /**
  20. * Tests that the install profile BC layer for dependencies key works.
  21. *
  22. * @expectedDeprecation The install profile core/profiles/testing_install_profile_dependencies_bc/testing_install_profile_dependencies_bc.info.yml only implements a 'dependencies' key. As of Drupal 8.6.0 profile's support a new 'install' key for modules that should be installed but not depended on. See https://www.drupal.org/node/2952947.
  23. */
  24. public function testUninstallingModules() {
  25. $user = $this->drupalCreateUser(['administer modules']);
  26. $this->drupalLogin($user);
  27. $this->drupalGet('admin/modules/uninstall');
  28. $this->getSession()->getPage()->checkField('uninstall[ban]');
  29. $this->getSession()->getPage()->checkField('uninstall[dblog]');
  30. $this->click('#edit-submit');
  31. // Click the confirm button.
  32. $this->click('#edit-submit');
  33. $this->assertSession()->responseContains('The selected modules have been uninstalled.');
  34. $this->assertSession()->responseContains('No modules are available to uninstall.');
  35. // We've uninstalled modules therefore we need to rebuild the container in
  36. // the test runner.
  37. $this->rebuildContainer();
  38. $module_handler = $this->container->get('module_handler');
  39. $this->assertFalse($module_handler->moduleExists('ban'));
  40. $this->assertFalse($module_handler->moduleExists('dblog'));
  41. }
  42. }