forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommitTest.php
More file actions
65 lines (55 loc) · 1.88 KB
/
CommitTest.php
File metadata and controls
65 lines (55 loc) · 1.88 KB
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
63
64
65
<?php
namespace Github\Tests\Integration;
/**
* @group integration
*/
class CommitTest extends TestCase
{
/**
* @test
*/
public function shouldRetrieveCommitsForRepositoryBranch()
{
$username = 'KnpLabs';
$repo = 'php-github-api';
$branch = 'master';
$commits = $this->client->api('repo')->commits()->all($username, $repo, ['sha' => $branch]);
$commit = array_pop($commits);
$this->assertArrayHasKey('url', $commit);
$this->assertArrayHasKey('committer', $commit);
$this->assertArrayHasKey('author', $commit);
$this->assertArrayHasKey('commit', $commit);
$this->assertArrayHasKey('sha', $commit);
}
/**
* @test
*/
public function shouldRetrieveCommitBySha()
{
$username = 'KnpLabs';
$repo = 'php-github-api';
$commit = $this->client->api('repo')->commits()->show($username, $repo, '6df3adf5bd16745299c6429e163265daed430fa1');
$this->assertArrayHasKey('url', $commit);
$this->assertArrayHasKey('committer', $commit);
$this->assertArrayHasKey('author', $commit);
$this->assertArrayHasKey('commit', $commit);
$this->assertArrayHasKey('sha', $commit);
$this->assertArrayHasKey('files', $commit);
}
/**
* @test
*/
public function shouldRetrieveCommitsForFile()
{
$username = 'KnpLabs';
$repo = 'php-github-api';
$branch = 'master';
$commits = $this->client->api('repo')->commits()->all($username, $repo, ['sha' => $branch, 'path' => 'composer.json']);
$commit = array_pop($commits);
$this->assertArrayHasKey('url', $commit);
$this->assertArrayHasKey('committer', $commit);
$this->assertArrayHasKey('author', $commit);
$this->assertArrayHasKey('commit', $commit);
$this->assertArrayHasKey('sha', $commit);
}
}