Skip to content

Commit 5d94a88

Browse files
lol768a-lwilliams
lol768
authored andcommitted
Add some more tests
1 parent 88c8337 commit 5d94a88

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

test/Github/Tests/Api/DeploymentTest.php

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,83 @@ class DeploymentTest extends TestCase
99
*/
1010
public function shouldCreateDeployment()
1111
{
12-
/** @var \Github\Api\Deployment $api */
1312
$api = $this->getApiMock();
1413
$deploymentData = array("ref" => "fd6a5f9e5a430dddae8d6a8ea378f913d3a766f9");
1514
$api->expects($this->once())
1615
->method('post')
17-
->with('/repos/KnpLabs/php-github-api/deployments', $deploymentData);
16+
->with('repos/KnpLabs/php-github-api/deployments', $deploymentData);
1817

1918
$api->create("KnpLabs", "php-github-api", $deploymentData);
2019
}
2120

21+
/**
22+
* @test
23+
*/
24+
public function shouldGetAllDeployments()
25+
{
26+
$api = $this->getApiMock();
27+
$api->expects($this->once())
28+
->method('get')
29+
->with('repos/KnpLabs/php-github-api/deployments');
30+
31+
$api->all("KnpLabs", "php-github-api");
32+
}
33+
34+
/**
35+
* @test
36+
*/
37+
public function shouldGetAllDeploymentsWithFilterParameters()
38+
{
39+
$api = $this->getApiMock();
40+
$filterData = ["foo" => "bar", "bar" => "foo"];
41+
42+
$api->expects($this->once())
43+
->method('get')
44+
->with('repos/KnpLabs/php-github-api/deployments', $filterData);
45+
46+
$api->all("KnpLabs", "php-github-api", $filterData);
47+
}
48+
49+
/**
50+
* @test
51+
*/
52+
public function shouldCreateStatusUpdate()
53+
{
54+
$api = $this->getApiMock();
55+
$statusData = ["state" => "pending", "description" => "waiting to start"];
56+
57+
$api->expects($this->once())
58+
->method('post')
59+
->with('repos/KnpLabs/php-github-api/deployments/1/statuses', $statusData);
60+
61+
$api->updateStatus("KnpLabs", "php-github-api", 1, $statusData);
62+
}
63+
64+
/**
65+
* @test
66+
* @expectedException GitHub\Exception\MissingArgumentException
67+
*/
68+
public function shouldRejectStatusUpdateWithoutStateField()
69+
{
70+
$api = $this->getApiMock();
71+
$statusData = [ "description" => "waiting to start"];
72+
73+
$api->updateStatus("KnpLabs", "php-github-api", 1, $statusData);
74+
}
75+
76+
/**
77+
* @test
78+
*/
79+
public function shouldGetAllStatuses()
80+
{
81+
$api = $this->getApiMock();
82+
$api->expects($this->once())
83+
->method('get')
84+
->with('repos/KnpLabs/php-github-api/deployments/1/statuses');
85+
86+
$api->getStatuses("KnpLabs", "php-github-api", 1);
87+
}
88+
2289
protected function getApiClass()
2390
{
2491
return 'Github\Api\Deployment';

0 commit comments

Comments
 (0)