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 array( 'json', 'cc6e7fc565b246cb30b0cac103a2b31e' ),
17 array( '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::getRequiredDependencies
33 public function testGetRequiredDependencies() {
34 $json = new ComposerJson( $this->json
);
35 $this->assertArrayEquals( array(
37 'cssjanus/cssjanus' => '1.1.1',
38 'leafo/lessphp' => '0.5.0',
40 ), $json->getRequiredDependencies(), false, true );
43 public static function provideNormalizeVersion() {
45 array( 'v1.0.0', '1.0.0' ),
46 array( '0.0.5', '0.0.5' ),
51 * @dataProvider provideNormalizeVersion
52 * @covers ComposerJson::normalizeVersion
54 public function testNormalizeVersion( $input, $expected ) {
55 $this->assertEquals( $expected, ComposerJson
::normalizeVersion( $input ) );