Repository navigation
Expand file tree
/
Copy pathDeploymentTest.php
More file actions
93 lines (77 loc) · 2.36 KB
/
Copy pathDeploymentTest.php
File metadata and controls
93 lines (77 loc) · 2.36 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
namespace Github\Tests\Api;
class DeploymentTest extends TestCase
{
/**
* @test
*/
public function shouldCreateDeployment()
{
$api = $this->getApiMock();
$deploymentData = array('ref' => 'fd6a5f9e5a430dddae8d6a8ea378f913d3a766f9');
$api->expects($this->once())
->method('post')
->with('repos/KnpLabs/php-github-api/deployments', $deploymentData);
$api->create('KnpLabs', 'php-github-api', $deploymentData);
}
/**
* @test
*/
public function shouldGetAllDeployments()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('repos/KnpLabs/php-github-api/deployments');
$api->all('KnpLabs', 'php-github-api');
}
/**
* @test
*/
public function shouldGetAllDeploymentsWithFilterParameters()
{
$api = $this->getApiMock();
$filterData = array('foo' => 'bar', 'bar' => 'foo');
$api->expects($this->once())
->method('get')
->with('repos/KnpLabs/php-github-api/deployments', $filterData);
$api->all('KnpLabs', 'php-github-api', $filterData);
}
/**
* @test
*/
public function shouldCreateStatusUpdate()
{
$api = $this->getApiMock();
$statusData = array('state' => 'pending', 'description' => 'waiting to start');
$api->expects($this->once())
->method('post')
->with('repos/KnpLabs/php-github-api/deployments/1/statuses', $statusData);
$api->updateStatus('KnpLabs', 'php-github-api', 1, $statusData);
}
/**
* @test
* @expectedException \Github\Exception\MissingArgumentException
*/
public function shouldRejectStatusUpdateWithoutStateField()
{
$api = $this->getApiMock();
$statusData = array('description' => 'waiting to start');
$api->updateStatus('KnpLabs', 'php-github-api', 1, $statusData);
}
/**
* @test
*/
public function shouldGetAllStatuses()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('repos/KnpLabs/php-github-api/deployments/1/statuses');
$api->getStatuses('KnpLabs', 'php-github-api', 1);
}
protected function getApiClass()
{
return 'Github\Api\Deployment';
}
}