X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;ds=sidebyside;f=tests%2Fphpunit%2Fincludes%2FGitInfoTest.php;h=9f4a01c9d8f326d454d083a728d09a68370a2028;hb=77a8bbd406de8194432bbc92ce0b781ba44b43bc;hp=e22f50507ec14b0220e8c85c31b79a0ced32faca;hpb=9c3b9ef639dd015b652dc05dc6cdf26396b89463;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/GitInfoTest.php b/tests/phpunit/includes/GitInfoTest.php index e22f50507e..9f4a01c9d8 100644 --- a/tests/phpunit/includes/GitInfoTest.php +++ b/tests/phpunit/includes/GitInfoTest.php @@ -9,18 +9,23 @@ class GitInfoTest extends MediaWikiTestCase { $this->setMwGlobals( 'wgGitInfoCacheDirectory', __DIR__ . '/../data/gitinfo' ); } - public function testValidJsonData() { - $dir = $GLOBALS['IP'] . '/testValidJsonData'; - $fixture = new GitInfo( $dir ); - - $this->assertTrue( $fixture->cacheIsComplete() ); - $this->assertEquals( 'refs/heads/master', $fixture->getHead() ); + protected function assertValidGitInfo( GitInfo $gitInfo ) { + $this->assertTrue( $gitInfo->cacheIsComplete() ); + $this->assertEquals( 'refs/heads/master', $gitInfo->getHead() ); $this->assertEquals( '0123456789abcdef0123456789abcdef01234567', - $fixture->getHeadSHA1() ); - $this->assertEquals( '1070884800', $fixture->getHeadCommitDate() ); - $this->assertEquals( 'master', $fixture->getCurrentBranch() ); + $gitInfo->getHeadSHA1() ); + $this->assertEquals( '1070884800', $gitInfo->getHeadCommitDate() ); + $this->assertEquals( 'master', $gitInfo->getCurrentBranch() ); $this->assertContains( '0123456789abcdef0123456789abcdef01234567', - $fixture->getHeadViewUrl() ); + $gitInfo->getHeadViewUrl() ); + + } + + public function testValidJsonData() { + global $IP; + + $this->assertValidGitInfo( new GitInfo( "$IP/testValidJsonData") ); + $this->assertValidGitInfo( new GitInfo( __DIR__ . "/../data/gitinfo/extension" ) ); } public function testMissingJsonData() {