Skip to content
Snippets Groups Projects

Issue #3262587: Show warnings when starting an update

1 unresolved thread
1 file
+ 40
0
Compare changes
  • Side-by-side
  • Inline
+ 40
0
<?php
namespace Drupal\Tests\automatic_updates\Unit;
use Drupal\automatic_updates\Validation\ReadinessTrait;
use Drupal\package_manager\ValidationResult;
use Drupal\system\SystemManager;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\automatic_updates\Validation\ReadinessTrait
*
* @group automatic_updates
*/
class ReadinessTraitTest extends UnitTestCase {
use ReadinessTrait;
/**
* @covers ::getOverallSeverity
*/
public function testOverallSeverity(): void {
// An error and a warning should be counted as an error.
$results = [
ValidationResult::createError(['Boo!']),
ValidationResult::createWarning(['Moo!']),
];
$this->assertSame(SystemManager::REQUIREMENT_ERROR, $this->getOverallSeverity($results));
// If there are no results, but no errors, the results should be counted as
// a warning.
array_shift($results);
$this->assertSame(SystemManager::REQUIREMENT_WARNING, $this->getOverallSeverity($results));
// If there are just plain no results, we should get REQUIREMENT_OK.
array_shift($results);
$this->assertSame(SystemManager::REQUIREMENT_OK, $this->getOverallSeverity($results));
}
}
Loading