@@ -9,16 +9,83 @@ class DeploymentTest extends TestCase
9
9
*/
10
10
public function shouldCreateDeployment ()
11
11
{
12
- /** @var \Github\Api\Deployment $api */
13
12
$ api = $ this ->getApiMock ();
14
13
$ deploymentData = array ("ref " => "fd6a5f9e5a430dddae8d6a8ea378f913d3a766f9 " );
15
14
$ api ->expects ($ this ->once ())
16
15
->method ('post ' )
17
- ->with ('/ repos/KnpLabs/php-github-api/deployments ' , $ deploymentData );
16
+ ->with ('repos/KnpLabs/php-github-api/deployments ' , $ deploymentData );
18
17
19
18
$ api ->create ("KnpLabs " , "php-github-api " , $ deploymentData );
20
19
}
21
20
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
+
22
89
protected function getApiClass ()
23
90
{
24
91
return 'Github\Api\Deployment ' ;
0 commit comments