Debian Codegraph @

tests/phpunit/unit/includes/libs/composer/ComposerJsonTest.php

raw symbols SCIP
1 <?php
2
3 namespace Wikimedia\Tests\Composer;
4
5 use PHPUnit\Framework\TestCase;
6 use Wikimedia\Composer\ComposerJson;
7
8 /**
9 * @covers \Wikimedia\Composer\ComposerJson
10 */
11 class ComposerJsonTest extends TestCase {
12 private const JSON_FILE = __DIR__ . '/../../../../data/composer/composer.json';
13
14 public function testGetRequiredDependencies() {
15 $json = new ComposerJson( self::JSON_FILE );
16 $this->assertEquals( [
17 'cdb/cdb' => '1.0.0',
18 'cssjanus/cssjanus' => '1.1.1',
19 'leafo/lessphp' => '0.5.0',
20 'psr/log' => '1.0.0',
21 ], $json->getRequiredDependencies() );
22 }
23
24 public static function provideNormalizeVersion() {
25 return [
26 [ 'v1.0.0', '1.0.0' ],
27 [ '0.0.5', '0.0.5' ],
28 ];
29 }
30
31 /**
32 * @dataProvider provideNormalizeVersion
33 */
34 public function testNormalizeVersion( $input, $expected ) {
35 $this->assertEquals( $expected, ComposerJson::normalizeVersion( $input ) );
36 }
37 }