function ComposerRequirementTest::testComposerInfoShown
Tests that Composer version and path are listed on the status report.
File
-
core/
modules/ package_manager/ tests/ src/ Functional/ ComposerRequirementTest.php, line 31
Class
- ComposerRequirementTest
- Tests that Package Manager shows the Composer version on the status report.
Namespace
Drupal\Tests\package_manager\FunctionalCode
public function testComposerInfoShown() : void {
// Ensure we can locate the Composer executable.
/** @var \PhpTuf\ComposerStager\API\Finder\Service\ExecutableFinderInterface $executable_finder */
$executable_finder = $this->container
->get(ExecutableFinderInterface::class);
$composer_path = $executable_finder->find('composer');
$composer_version = $this->container
->get(ComposerInspector::class)
->getVersion();
// Ensure the status report shows Composer's version and path.
$account = $this->drupalCreateUser([
'administer site configuration',
]);
$this->drupalLogin($account);
$this->drupalGet('/admin/reports/status');
$assert_session = $this->assertSession();
$assert_session->pageTextContains('Composer version');
$assert_session->responseContains("{$composer_version} (<code>{$composer_path}</code>)");
// If the Composer can't be found, we should see the error message that gets
// throw by the executable finder.
TestExecutableFinder::throwFor('composer');
$this->getSession()
->reload();
$assert_session->statusCodeEquals(200);
$assert_session->pageTextContains('Composer was not found. The error message was: composer is not a thing');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.