InstallProfileDependenciesBcTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 $profile = 'testing_install_profile_dependencies_bc';
  15. /**
  16. * Tests that the install profile BC layer for dependencies key works.
  17. *
  18. * @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.
  19. */
  20. public function testUninstallingModules() {
  21. $user = $this->drupalCreateUser(['administer modules']);
  22. $this->drupalLogin($user);
  23. $this->drupalGet('admin/modules/uninstall');
  24. $this->getSession()->getPage()->checkField('uninstall[ban]');
  25. $this->getSession()->getPage()->checkField('uninstall[dblog]');
  26. $this->click('#edit-submit');
  27. // Click the confirm button.
  28. $this->click('#edit-submit');
  29. $this->assertSession()->responseContains('The selected modules have been uninstalled.');
  30. $this->assertSession()->responseContains('No modules are available to uninstall.');
  31. // We've uninstalled modules therefore we need to rebuild the container in
  32. // the test runner.
  33. $this->rebuildContainer();
  34. $module_handler = $this->container->get('module_handler');
  35. $this->assertFalse($module_handler->moduleExists('ban'));
  36. $this->assertFalse($module_handler->moduleExists('dblog'));
  37. }
  38. }