You are here

public function CoreComposerValidatorTest::testCoreNotRequired in Automatic Updates 8.2

Tests that an error is raised if core is not required in composer.json.

File

tests/src/Kernel/ReadinessValidation/CoreComposerValidatorTest.php, line 37

Class

CoreComposerValidatorTest
@covers \Drupal\automatic_updates\Validator\CoreComposerValidator

Namespace

Drupal\Tests\automatic_updates\Kernel\ReadinessValidation

Code

public function testCoreNotRequired() : void {

  // Point to a valid composer.json with no requirements.
  $locator = $this
    ->prophesize(PathLocator::class);
  $locator
    ->getActiveDirectory()
    ->willReturn(__DIR__ . '/../../../fixtures/project_staged_validation/no_core_requirements');
  $this->container
    ->set('automatic_updates.path_locator', $locator
    ->reveal());
  $error = ValidationResult::createError([
    'Drupal core does not appear to be required in the project-level composer.json.',
  ]);
  $this
    ->assertCheckerResultsFromManager([
    $error,
  ], TRUE);
}