Issue #3243405: Add a kernel test of UpdateVersionValidator
Merge request reports
Activity
19 'automatic_updates', 20 'package_manager', 21 ]; 22 23 /** 24 * Tests that no error is raised if there are no major or minor updates. 25 */ 26 public function testNoMajorOrMinorUpdates(): void { 27 $this->assertCheckerResultsFromManager([], TRUE); 28 } 29 30 /** 31 * Tests that an error is raised if there are major updates. 32 */ 33 public function testMajorUpdates(): void { 34 $this->setCoreVersion('8.0.0'); Lets make sure that major version we test is great than
9
because that is what we set in\Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase::setUp()
We should make another issue to add another check
UpdateVersionValidator
to give a different if the version lower than the current version. We should have the same message for any version that is lower than the current.changed this line in version 3 of the diff
29 30 /** 31 * Tests that an error is raised if there are major updates. 32 */ 33 public function testMajorUpdates(): void { 34 $this->setCoreVersion('8.0.0'); 35 $result = ValidationResult::createError(['Updating from one major version to another is not supported.']); 36 $this->assertCheckerResultsFromManager([$result], TRUE); 37 38 } 39 40 /** 41 * Tests that an error is raised if there are minor updates. 42 */ 43 public function testMinorUpdates(): void { 44 $this->setCoreVersion('9.3.0'); changed this line in version 3 of the diff
16 * {@inheritdoc} 17 */ 18 protected static $modules = [ 19 'automatic_updates', 20 'package_manager', 21 ]; 22 23 /** 24 * Tests that no error is raised if there are no major or minor updates. 25 */ 26 public function testNoMajorOrMinorUpdates(): void { 27 $this->assertCheckerResultsFromManager([], TRUE); 28 } 29 30 /** 31 * Tests that an error is raised if there are major updates. We should clarify that it is not just that there are major updates available but that update version is different.
Suggestion
Tests an update version that is a different major version than the current.
To keep it short enough I left out "Tests that an error is raised" because this a test for a validator that can be assumed.
changed this line in version 4 of the diff
9 * @covers \Drupal\automatic_updates\Validator\UpdateVersionValidator 10 * 11 * @group automatic_updates 12 */ 13 class UpdateVersionValidatorTest extends AutomaticUpdatesKernelTestBase { 14 15 /** 16 * {@inheritdoc} 17 */ 18 protected static $modules = [ 19 'automatic_updates', 20 'package_manager', 21 ]; 22 23 /** 24 * Tests that no error is raised if there are no major or minor updates. changed this line in version 4 of the diff