summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/libs/composer/ComposerLockTest.php
blob: b5fd5f6e71e6a0c532c3060615dd3af1b2c5ef9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

class ComposerLockTest extends MediaWikiTestCase {

	private $lock;

	public function setUp() {
		parent::setUp();
		global $IP;
		$this->lock = "$IP/tests/phpunit/data/composer/composer.lock";
	}

	/**
	 * @covers ComposerLock::getHash
	 */
	public function testGetHash() {
		$lock = new ComposerLock( $this->lock );
		$this->assertEquals( 'a3bb80b0ac4c4a31e52574d48c032923', $lock->getHash() );
	}

	/**
	 * @covers ComposerLock::getInstalledDependencies
	 */
	public function testGetInstalledDependencies() {
		$lock = new ComposerLock( $this->lock );
		$this->assertArrayEquals( array(
			'wikimedia/cdb' => array(
				'version' => '1.0.1',
				'type' => 'library',
			),
			'cssjanus/cssjanus' => array(
				'version' => '1.1.1',
				'type' => 'library',
			),
			'leafo/lessphp' => array(
				'version' => '0.5.0',
				'type' => 'library',
			),
			'psr/log' => array(
				'version' => '1.0.0',
				'type' => 'library',
			),
			'oojs/oojs-ui' => array(
				'version' => '0.6.0',
				'type' => 'library',
			),
			'composer/installers' => array(
				'version' => '1.0.19',
				'type' => 'composer-installer',
			),
			'mediawiki/translate' => array(
				'version' => '2014.12',
				'type' => 'mediawiki-extension',
			),
			'mediawiki/universal-language-selector' => array(
				'version' => '2014.12',
				'type' => 'mediawiki-extension',
			),
		), $lock->getInstalledDependencies(), false, true );
	}

}