Skip to content
Snippets Groups Projects

Issue #3306283: Display readiness check results if any after installing Automatic Updates

Compare and Show latest version
1 file
+ 14
6
Compare changes
  • Side-by-side
  • Inline
@@ -8,6 +8,8 @@ use Drupal\automatic_updates_test\EventSubscriber\TestSubscriber1;
use Drupal\automatic_updates_test2\EventSubscriber\TestSubscriber2;
use Drupal\Core\Url;
use Drupal\package_manager\Event\StatusCheckEvent;
use Drupal\package_manager\ValidationResult;
use Drupal\package_manager_test_validation\EventSubscriber\TestSubscriber;
use Drupal\system\SystemManager;
use Drupal\Tests\automatic_updates\Traits\ValidationTestTrait;
use Drupal\Tests\Traits\Core\CronRunTrait;
@@ -48,6 +50,13 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
*/
protected $testChecker;
/**
* {@inheritdoc}
*/
protected static $modules = [
'package_manager_test_validation',
];
/**
* {@inheritdoc}
*/
@@ -71,19 +80,18 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
}
/**
*
* Tests early status checks immediately after Automatic Updates install.
*/
public function testEarlyStatusMessages(): void {
$assert = $this->assertSession();
$this->assertFalse($this->container->get('module_handler')->moduleExists('automated_cron'));
$error_message = 'You-Know-Who, He Who Must Not Be Named';
TestSubscriber::setTestResult([ValidationResult::createError([$error_message])],
StatusCheckEvent::class);
$this->drupalLogin($this->checkerRunnerUser);
$this->drupalGet('admin/modules');
$page = $this->getSession()->getPage();
TestSubscriber1::setTestResult([$this->createValidationResult(SystemManager::REQUIREMENT_ERROR, 2)],
StatusCheckEvent::class);
$page->checkField('modules[automatic_updates][enable]');
$page->pressButton('Install');
file_put_contents('/Users/omkar.podey/www/auto-updates/sites/test.html', $this->getSession()->getPage()->getContent());
$this->assertSession()->pageTextContainsOnce($error_message);
}
/**
Loading