class ComposerBuildTestBase
Same name and namespace in other branches
- 11.x core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php \Drupal\BuildTests\Composer\ComposerBuildTestBase
Base class for Composer build tests.
@coversNothing
Hierarchy
- class \Drupal\BuildTests\Framework\BuildTestBase uses \Drupal\BuildTests\Framework\ExternalCommandRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\BuildTests\Composer\ComposerBuildTestBase implements \Drupal\BuildTests\Framework\BuildTestBase
Expanded class hierarchy of ComposerBuildTestBase
3 files declare their use of ComposerBuildTestBase
- ComponentsIsolatedBuildTest.php in core/
tests/ Drupal/ BuildTests/ Composer/ Component/ ComponentsIsolatedBuildTest.php - ComponentsTaggedReleaseTest.php in core/
tests/ Drupal/ BuildTests/ Composer/ Component/ ComponentsTaggedReleaseTest.php - ComposerProjectTemplatesTest.php in core/
tests/ Drupal/ BuildTests/ Composer/ Template/ ComposerProjectTemplatesTest.php
File
-
core/
tests/ Drupal/ BuildTests/ Composer/ ComposerBuildTestBase.php, line 13
Namespace
Drupal\BuildTests\ComposerView source
abstract class ComposerBuildTestBase extends BuildTestBase {
/**
* Relative path from Drupal root to the Components directory.
*
* @var string
*/
protected static $componentsPath = '/core/lib/Drupal/Component';
/**
* Assert that the VERSION constant in Drupal.php is the expected value.
*
* @param string $expectedVersion
* The expected version.
* @param string $dir
* The path to the site root.
*
* @internal
*/
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);
}
/**
* Find all the composer.json files for components.
*
* @param string $drupal_root
* The Drupal root directory.
*
* @return \Symfony\Component\Finder\Finder
* A Finder object with all the composer.json files for components.
*/
protected function getComponentPathsFinder(string $drupal_root) : Finder {
$finder = new Finder();
$finder->name('composer.json')
->in($drupal_root . static::$componentsPath)
->ignoreUnreadableDirs()
->depth(1);
return $finder;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.