8 mkdir( __DIR__ .
'/../data/gitrepo' );
9 mkdir( __DIR__ .
'/../data/gitrepo/1' );
10 mkdir( __DIR__ .
'/../data/gitrepo/2' );
11 mkdir( __DIR__ .
'/../data/gitrepo/3' );
12 mkdir( __DIR__ .
'/../data/gitrepo/1/.git' );
13 mkdir( __DIR__ .
'/../data/gitrepo/1/.git/refs' );
14 mkdir( __DIR__ .
'/../data/gitrepo/1/.git/refs/heads' );
15 file_put_contents( __DIR__ .
'/../data/gitrepo/1/.git/HEAD',
16 "ref: refs/heads/master\n" );
17 file_put_contents( __DIR__ .
'/../data/gitrepo/1/.git/refs/heads/master',
18 "0123456789012345678901234567890123abcdef\n" );
19 file_put_contents( __DIR__ .
'/../data/gitrepo/1/.git/packed-refs',
20 "abcdef6789012345678901234567890123456789 refs/heads/master\n" );
21 file_put_contents( __DIR__ .
'/../data/gitrepo/2/.git',
22 "gitdir: ../1/.git\n" );
23 file_put_contents( __DIR__ .
'/../data/gitrepo/3/.git',
24 'gitdir: ' . __DIR__ .
"/../data/gitrepo/1/.git\n" );
37 $this->assertTrue( $gitInfo->cacheIsComplete() );
38 $this->assertEquals(
'refs/heads/master', $gitInfo->getHead() );
39 $this->assertEquals(
'0123456789abcdef0123456789abcdef01234567',
40 $gitInfo->getHeadSHA1() );
41 $this->assertEquals(
'1070884800', $gitInfo->getHeadCommitDate() );
42 $this->assertEquals(
'master', $gitInfo->getCurrentBranch() );
43 $this->assertContains(
'0123456789abcdef0123456789abcdef01234567',
44 $gitInfo->getHeadViewUrl() );
55 $dir =
$GLOBALS[
'IP'] .
'/testMissingJsonData';
58 $this->assertFalse( $fixture->cacheIsComplete() );
60 $this->assertEquals(
false, $fixture->getHead() );
61 $this->assertEquals(
false, $fixture->getHeadSHA1() );
62 $this->assertEquals(
false, $fixture->getHeadCommitDate() );
63 $this->assertEquals(
false, $fixture->getCurrentBranch() );
64 $this->assertEquals(
false, $fixture->getHeadViewUrl() );
67 $this->assertTrue( $fixture->cacheIsComplete() );