-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathGitInfoTest.php
60 lines (47 loc) · 1.51 KB
/
GitInfoTest.php
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
<?php
namespace CodeClimate\PhpTestReporter\Tests\Unit\System\Git;
use CodeClimate\PhpTestReporter\System\Git\GitInfo;
class GitInfoTest extends \PHPUnit\Framework\TestCase
{
public function testIsFinal()
{
$reflection = new \ReflectionClass('CodeClimate\PhpTestReporter\System\Git\GitInfo');
$this->assertTrue($reflection->isFinal());
}
public function testImplementsGitInfoInterface()
{
$reflection = new \ReflectionClass('CodeClimate\PhpTestReporter\System\Git\GitInfo');
$this->assertTrue($reflection->implementsInterface('CodeClimate\PhpTestReporter\System\Git\GitInfoInterface'));
}
public function testConstructorSetsValues()
{
$head = 'foo';
$branch = 'feature/gitinfo';
$committedAt = time();
$info = new GitInfo(
$head,
$branch,
$committedAt
);
$this->assertSame($head, $info->head());
$this->assertSame($branch, $info->branch());
$this->assertSame($committedAt, $info->committedAt());
}
public function testToArrayReturnsArrayRepresentation()
{
$head = 'foo';
$branch = 'feature/gitinfo';
$committedAt = time();
$info = new GitInfo(
$head,
$branch,
$committedAt
);
$expected = array(
'head' => $head,
'branch' => $branch,
'committed_at' => $committedAt,
);
$this->assertEquals($expected, $info->toArray());
}
}