Skip to content
Snippets Groups Projects
Commit 1fc7a9dd authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Ted Bowman
Browse files

Issue #3316932 by kunal.sachdev, Wim Leers, tedbow: Do not skip ...

Issue #3316932 by kunal.sachdev, Wim Leers, tedbow: Do not skip  'update.settings' route in displaying status check messages
parent 0b2fd272
No related branches found
No related tags found
1 merge request!591Issue #3316932: Do not skip 'update.settings' route in displaying status check messages
...@@ -39,7 +39,6 @@ final class RouteSubscriber extends RouteSubscriberBase { ...@@ -39,7 +39,6 @@ final class RouteSubscriber extends RouteSubscriberBase {
'update.module_install', 'update.module_install',
'update.status', 'update.status',
'update.report_install', 'update.report_install',
'update.settings',
'system.status', 'system.status',
'update.confirmation_page', 'update.confirmation_page',
'system.batch_page.html', 'system.batch_page.html',
......
...@@ -176,10 +176,33 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -176,10 +176,33 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$this->assertWarnings($expected_results); $this->assertWarnings($expected_results);
} }
/**
* Data provider for URLs to the admin page.
*
* These particular admin routes are tested as status checks are disabled on
* certain routes but not on these.
*
* @see \Drupal\automatic_updates\Routing\RouteSubscriber::alterRoutes()
*
* @return string[][]
* The test cases.
*/
public function providerAdminRoutes(): array {
return [
'Structure Page' => ['system.admin_structure'],
'Update settings Page' => ['update.settings'],
];
}
/** /**
* Tests status check results on admin pages.. * Tests status check results on admin pages..
*
* @param string $admin_route
* The admin route to check.
*
* @dataProvider providerAdminRoutes
*/ */
public function testStatusChecksOnAdminPages(): void { public function testStatusChecksOnAdminPages(string $admin_route): void {
$assert = $this->assertSession(); $assert = $this->assertSession();
$messages_section_selector = '[data-drupal-messages]'; $messages_section_selector = '[data-drupal-messages]';
...@@ -193,7 +216,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -193,7 +216,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$this->drupalLogin($this->reportViewerUser); $this->drupalLogin($this->reportViewerUser);
$this->drupalGet('admin/reports/status'); $this->drupalGet('admin/reports/status');
$this->assertNoErrors(); $this->assertNoErrors();
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->elementNotExists('css', $messages_section_selector); $assert->elementNotExists('css', $messages_section_selector);
// Confirm a user without the permission to run status checks does not have // Confirm a user without the permission to run status checks does not have
...@@ -208,17 +231,17 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -208,17 +231,17 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$key_value->delete('status_check_last_run'); $key_value->delete('status_check_last_run');
// A user without the permission to run the checkers will not see a message // A user without the permission to run the checkers will not see a message
// on other pages if the checkers need to be run again. // on other pages if the checkers need to be run again.
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->elementNotExists('css', $messages_section_selector); $assert->elementNotExists('css', $messages_section_selector);
// Confirm that a user with the correct permission can also run the checkers // Confirm that a user with the correct permission can also run the checkers
// on another admin page. // on another admin page.
$this->drupalLogin($this->checkerRunnerUser); $this->drupalLogin($this->checkerRunnerUser);
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->elementExists('css', $messages_section_selector); $assert->elementExists('css', $messages_section_selector);
$assert->pageTextContainsOnce('Your site has not recently run an update readiness check. Run readiness checks now.'); $assert->pageTextContainsOnce('Your site has not recently run an update readiness check. Run readiness checks now.');
$this->clickLink('Run readiness checks now.'); $this->clickLink('Run readiness checks now.');
$assert->addressEquals('admin/structure'); $assert->addressEquals(Url::fromRoute($admin_route));
$assert->pageTextContainsOnce($expected_results[0]->getMessages()[0]); $assert->pageTextContainsOnce($expected_results[0]->getMessages()[0]);
$expected_results = [ $expected_results = [
...@@ -229,7 +252,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -229,7 +252,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// Confirm a new message is displayed if the cron is run after an hour. // Confirm a new message is displayed if the cron is run after an hour.
$this->delayRequestTime(); $this->delayRequestTime();
$this->cronRun(); $this->cronRun();
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->pageTextContainsOnce(static::$errorsExplanation); $assert->pageTextContainsOnce(static::$errorsExplanation);
// Confirm on admin pages that a single error will be displayed instead of a // Confirm on admin pages that a single error will be displayed instead of a
// summary. // summary.
...@@ -250,7 +273,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -250,7 +273,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
TestSubscriber1::setTestResult($unexpected_results, StatusCheckEvent::class); TestSubscriber1::setTestResult($unexpected_results, StatusCheckEvent::class);
$this->delayRequestTime(30); $this->delayRequestTime(30);
$this->cronRun(); $this->cronRun();
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->pageTextNotContains($unexpected_results['2 errors']->getSummary()); $assert->pageTextNotContains($unexpected_results['2 errors']->getSummary());
$assert->pageTextContainsOnce($expected_results['1 error']->getMessages()[0]); $assert->pageTextContainsOnce($expected_results['1 error']->getMessages()[0]);
$assert->pageTextNotContains($unexpected_results['2 warnings']->getSummary()); $assert->pageTextNotContains($unexpected_results['2 warnings']->getSummary());
...@@ -261,7 +284,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -261,7 +284,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$this->delayRequestTime(31); $this->delayRequestTime(31);
$this->cronRun(); $this->cronRun();
$expected_results = $unexpected_results; $expected_results = $unexpected_results;
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
// Confirm on admin pages only the error summary will be displayed if there // Confirm on admin pages only the error summary will be displayed if there
// is more than 1 error. // is more than 1 error.
$this->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['2 errors']->getSeverity()); $this->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['2 errors']->getSeverity());
...@@ -279,7 +302,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -279,7 +302,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class); TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class);
$this->delayRequestTime(); $this->delayRequestTime();
$this->cronRun(); $this->cronRun();
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
// Confirm that the warnings summary is displayed on admin pages if there // Confirm that the warnings summary is displayed on admin pages if there
// are no errors. // are no errors.
$assert->pageTextNotContains(static::$errorsExplanation); $assert->pageTextNotContains(static::$errorsExplanation);
...@@ -293,7 +316,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -293,7 +316,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class); TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class);
$this->delayRequestTime(); $this->delayRequestTime();
$this->cronRun(); $this->cronRun();
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->pageTextNotContains(static::$errorsExplanation); $assert->pageTextNotContains(static::$errorsExplanation);
// Confirm that a single warning is displayed and not the summary on admin // Confirm that a single warning is displayed and not the summary on admin
// pages if there is only 1 warning and there are no errors. // pages if there is only 1 warning and there are no errors.
...@@ -307,7 +330,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -307,7 +330,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$this->drupalGet(Url::fromRoute('update.settings')); $this->drupalGet(Url::fromRoute('update.settings'));
$edit['automatic_updates_cron'] = 'disable'; $edit['automatic_updates_cron'] = 'disable';
$this->submitForm($edit, 'Save configuration'); $this->submitForm($edit, 'Save configuration');
$this->drupalGet('admin/structure'); $this->drupalGet(Url::fromRoute($admin_route));
$assert->pageTextNotContains(static::$warningsExplanation); $assert->pageTextNotContains(static::$warningsExplanation);
$assert->pageTextNotContains($expected_results[0]->getMessages()[0]); $assert->pageTextNotContains($expected_results[0]->getMessages()[0]);
} }
......
...@@ -75,7 +75,6 @@ class UpdatePathTest extends UpdatePathTestBase { ...@@ -75,7 +75,6 @@ class UpdatePathTest extends UpdatePathTestBase {
'update.module_update', 'update.module_update',
'update.report_install', 'update.report_install',
'update.report_update', 'update.report_update',
'update.settings',
'update.status', 'update.status',
'update.theme_update', 'update.theme_update',
'automatic_updates.status_check', 'automatic_updates.status_check',
......
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