function ComposerInspectorTest::testGetVersion

Tests get version.

@legacy-covers ::getVersion

Attributes

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

File

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

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.