Skip to content
Snippets Groups Projects
Commit f3fc637a authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Adam G-H
Browse files

Issue #3274047 by kunal.sachdev, phenaproxima: Do not use rootUser in tests...

Issue #3274047 by kunal.sachdev, phenaproxima: Do not use rootUser in tests unless absolutely necessary
parent 31519618
No related branches found
No related tags found
1 merge request!299Issue #3274047: Do not use root User in tests unless absolutely necessary.
...@@ -64,7 +64,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -64,7 +64,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/semver_test.1.1.xml'); $this->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/semver_test.1.1.xml');
$this->drupalLogin($this->rootUser); $user = $this->createUser([
'administer site configuration',
'administer software updates',
'access site in maintenance mode',
]);
$this->drupalLogin($user);
$this->drupalPlaceBlock('local_tasks_block', ['primary' => TRUE]); $this->drupalPlaceBlock('local_tasks_block', ['primary' => TRUE]);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
/** /**
* Implements hook_requirements(). * Implements hook_requirements().
*/ */
function package_manager_requirements() { function package_manager_requirements(string $phase) {
$requirements = []; $requirements = [];
if (!class_exists('PhpTuf\ComposerStager\Domain\Beginner')) { if (!class_exists('PhpTuf\ComposerStager\Domain\Beginner')) {
...@@ -18,7 +18,7 @@ function package_manager_requirements() { ...@@ -18,7 +18,7 @@ function package_manager_requirements() {
'severity' => REQUIREMENT_ERROR, 'severity' => REQUIREMENT_ERROR,
]; ];
} }
if (extension_loaded('xdebug')) { if ($phase === 'runtime' && extension_loaded('xdebug')) {
$requirements['package_manager_xdebug'] = [ $requirements['package_manager_xdebug'] = [
'title' => 'Xdebug enabled', 'title' => 'Xdebug enabled',
'description' => t('Xdebug is enabled, which may have a negative performance impact on Package Manager and any modules that use it.'), 'description' => t('Xdebug is enabled, which may have a negative performance impact on Package Manager and any modules that use it.'),
......
...@@ -31,7 +31,10 @@ class UpdateLockTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -31,7 +31,10 @@ class UpdateLockTest extends AutomaticUpdatesFunctionalTestBase {
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->drupalLogin($this->rootUser); $user = $this->createUser([
'administer site configuration',
]);
$this->drupalLogin($user);
$this->checkForUpdates(); $this->checkForUpdates();
} }
......
...@@ -50,7 +50,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -50,7 +50,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
parent::setUp(); parent::setUp();
$this->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/drupal.9.8.1-security.xml'); $this->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/drupal.9.8.1-security.xml');
$this->drupalLogin($this->rootUser); $user = $this->createUser([
'administer site configuration',
'administer software updates',
'access administration pages',
'access site in maintenance mode',
'administer modules',
'access site reports',
]);
$this->drupalLogin($user);
$this->checkForUpdates(); $this->checkForUpdates();
} }
...@@ -307,7 +315,11 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -307,7 +315,11 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
// We should get the same error if we log in as another user and try to // We should get the same error if we log in as another user and try to
// delete the staged update. // delete the staged update.
$this->drupalLogin($this->rootUser); $user = $this->createUser([
'administer software updates',
'access site in maintenance mode',
]);
$this->drupalLogin($user);
$this->drupalGet('/admin/reports/updates/automatic-update'); $this->drupalGet('/admin/reports/updates/automatic-update');
$assert_session->pageTextContains($conflict_message); $assert_session->pageTextContains($conflict_message);
$page->pressButton('Delete existing update'); $page->pressButton('Delete existing update');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment