function ComposerInspectorTest::testPackageDevSnapshotCommitHashIsRemoved

Tests that the commit hash of a dev snapshot package is ignored.

File

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

Class

ComposerInspectorTest
@coversDefaultClass \Drupal\package_manager\ComposerInspector

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPackageDevSnapshotCommitHashIsRemoved() : void {
    $inspector = new class ($this->container
        ->get(ComposerProcessRunnerInterface::class), $this->container
        ->get(ComposerIsAvailableInterface::class), $this->container
        ->get(PathFactoryInterface::class)) extends ComposerInspector {
        
        /**
         * {@inheritdoc}
         */
        protected function show(string $working_dir) : array {
            return [
                'test/package' => [
                    'name' => 'test/package',
                    'path' => __DIR__,
                    'version' => '1.0.x-dev 0a1b2c3d',
                ],
            ];
        }

};
    $project_root = $this->container
        ->get(PathLocator::class)
        ->getProjectRoot();
    $list = $inspector->getInstalledPackagesList($project_root);
    $this->assertSame('1.0.x-dev', $list['test/package']->version);
}

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