function ComposerInspectorTest::testGetVersion

Same name and namespace in other branches
  1. 11.x core/modules/package_manager/tests/src/Kernel/ComposerInspectorTest.php \Drupal\Tests\package_manager\Kernel\ComposerInspectorTest::testGetVersion()

Tests get version.

Attributes

#[TestWith([ "2.5.6", ])] #[TestWith([ NULL, ])]

File

core/modules/package_manager/tests/src/Kernel/ComposerInspectorTest.php, line 311

Class

ComposerInspectorTest
Tests Drupal\package_manager\ComposerInspector.

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testGetVersion(?string $reported_version) : void {
  $this->container
    ->set(ComposerProcessRunnerInterface::class, $this->mockComposerRunner($reported_version)
    ->reveal());
  if (empty($reported_version)) {
    $this->expectException(\UnexpectedValueException::class);
    $this->expectExceptionMessage('Unable to determine Composer version');
  }
  $this->assertSame($reported_version, $this->container
    ->get(ComposerInspector::class)
    ->getVersion());
}

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