3 class ComposerJsonTest
extends MediaWikiTestCase
{
7 public function setUp() {
10 $this->json
= "$IP/tests/phpunit/data/composer/composer.json";
11 $this->json2
= "$IP/tests/phpunit/data/composer/new-composer.json";
14 public static function provideGetHash() {
16 [ 'json', 'cc6e7fc565b246cb30b0cac103a2b31e' ],
17 [ 'json2', '19921dd1fc457f1b00561da932432001' ],
22 * @dataProvider provideGetHash
23 * @covers ComposerJson::getHash
25 public function testIsHashUpToDate( $file, $expected ) {
26 $json = new ComposerJson( $this->$file );
27 $this->assertEquals( $expected, $json->getHash() );
31 * @covers ComposerJson::__construct
32 * @covers ComposerJson::getRequiredDependencies
34 public function testGetRequiredDependencies() {
35 $json = new ComposerJson( $this->json
);
36 $this->assertArrayEquals( [
38 'cssjanus/cssjanus' => '1.1.1',
39 'leafo/lessphp' => '0.5.0',
41 ], $json->getRequiredDependencies(), false, true );
44 public static function provideNormalizeVersion() {
46 [ 'v1.0.0', '1.0.0' ],
52 * @dataProvider provideNormalizeVersion
53 * @covers ComposerJson::normalizeVersion
55 public function testNormalizeVersion( $input, $expected ) {
56 $this->assertEquals( $expected, ComposerJson
::normalizeVersion( $input ) );