function ComposerTest::testEnsurePhpConfiguredVersion

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Composer/ComposerTest.php \Drupal\Tests\Composer\ComposerTest::testEnsurePhpConfiguredVersion()
  2. 11.x core/tests/Drupal/Tests/Composer/ComposerTest.php \Drupal\Tests\Composer\ComposerTest::testEnsurePhpConfiguredVersion()

Ensure that the configured php version matches the minimum php version.

Also ensure that the minimum php version in the root-level composer.json file exactly matches DRUPAL_MINIMUM_PHP.

File

core/tests/Drupal/Tests/Composer/ComposerTest.php, line 34

Class

ComposerTest
@coversDefaultClass \Drupal\Composer\Composer @group Composer

Namespace

Drupal\Tests\Composer

Code

public function testEnsurePhpConfiguredVersion() {
    $composer_json = json_decode(file_get_contents($this->root . '/composer.json'), TRUE);
    $composer_core_json = json_decode(file_get_contents($this->root . '/core/composer.json'), TRUE);
    $this->assertEquals(DRUPAL_MINIMUM_PHP, $composer_json['config']['platform']['php'], 'The DRUPAL_MINIMUM_PHP constant should always be exactly the same as the config.platform.php in the root composer.json.');
    $this->assertEquals($composer_core_json['require']['php'], '>=' . $composer_json['config']['platform']['php'], 'The config.platform.php configured version in the root composer.json file should always be exactly the same as the minimum php version configured in core/composer.json.');
}

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