Remove messages.inc, rebuildLanguage.php, writeMessagesArray.inc
[mediawiki.git] / tests / phpunit / includes / GitInfoTest.php
blob7c684d51e19aff2dbbfcdb7ebcc0361facf63532
1 <?php
2 /**
3 * @covers GitInfo
4 */
5 class GitInfoTest extends MediaWikiTestCase {
7 protected function setUp() {
8 parent::setUp();
9 $this->setMwGlobals( 'wgCacheDirectory', __DIR__ . '/../data' );
12 public function testValidJsonData() {
13 $dir = $GLOBALS['IP'] . '/testValidJsonData';
14 $fixture = new GitInfo( $dir );
16 $this->assertTrue( $fixture->cacheIsComplete() );
17 $this->assertEquals( 'refs/heads/master', $fixture->getHead() );
18 $this->assertEquals( '0123456789abcdef0123456789abcdef01234567',
19 $fixture->getHeadSHA1() );
20 $this->assertEquals( '1070884800', $fixture->getHeadCommitDate() );
21 $this->assertEquals( 'master', $fixture->getCurrentBranch() );
22 $this->assertContains( '0123456789abcdef0123456789abcdef01234567',
23 $fixture->getHeadViewUrl() );
26 public function testMissingJsonData() {
27 $dir = $GLOBALS['IP'] . '/testMissingJsonData';
28 $fixture = new GitInfo( $dir );
30 $this->assertFalse( $fixture->cacheIsComplete() );
32 $this->assertEquals( false, $fixture->getHead() );
33 $this->assertEquals( false, $fixture->getHeadSHA1() );
34 $this->assertEquals( false, $fixture->getHeadCommitDate() );
35 $this->assertEquals( false, $fixture->getCurrentBranch() );
36 $this->assertEquals( false, $fixture->getHeadViewUrl() );
38 // After calling all the outputs, the cache should be complete
39 $this->assertTrue( $fixture->cacheIsComplete() );