function ComposerInspectorTest::testGetVersion

@covers ::getVersion

@testWith ["2.5.6"]
[null]

File

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

Class

ComposerInspectorTest
@coversDefaultClass \Drupal\package_manager\ComposerInspector[[api-linebreak]]

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.