function ComposerBuildTestBase::assertDrupalVersion

Same name in other branches
  1. 10 core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php \Drupal\BuildTests\Composer\ComposerBuildTestBase::assertDrupalVersion()
  2. 11.x core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php \Drupal\BuildTests\Composer\ComposerBuildTestBase::assertDrupalVersion()

Assert that the VERSION constant in Drupal.php is the expected value.

@internal

Parameters

string $expectedVersion: The expected version.

string $dir: The path to the site root.

2 calls to ComposerBuildTestBase::assertDrupalVersion()
ComponentsTaggedReleaseTest::testReleaseTagging in core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php
Validate release tagging and regeneration of dependencies.
ComposerProjectTemplatesTest::testTemplateCreateProject in core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
@dataProvider provideTemplateCreateProject

File

core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php, line 32

Class

ComposerBuildTestBase
Base class for Composer build tests.

Namespace

Drupal\BuildTests\Composer

Code

protected function assertDrupalVersion(string $expectedVersion, string $dir) : void {
    $drupal_php_path = $dir . '/core/lib/Drupal.php';
    $this->assertFileExists($drupal_php_path);
    // Read back the Drupal version that was set and assert it matches
    // expectations
    $this->executeCommand("php -r 'include \"{$drupal_php_path}\"; print \\Drupal::VERSION;'");
    $this->assertCommandSuccessful();
    $this->assertCommandOutputContains($expectedVersion);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.