Skip to content

Commit 6ee0e0b

Browse files
committed
added test
1 parent 095f463 commit 6ee0e0b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/Github/Api/Deployment.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public function create($username, $repository, array $params)
7777
* @param string $username the user who owns the repo
7878
* @param string $repository the name of the repo
7979
* @param int $id the id of the deployment
80+
*
81+
* @return mixed null on success, array on error with 'message'
8082
*/
8183
public function remove($username, $repository, $id)
8284
{

test/Github/Tests/Api/DeploymentTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function shouldGetAllDeploymentsWithFilterParameters()
5151
/**
5252
* @test
5353
*/
54-
public function shouldShowProject()
54+
public function shouldShowDeployment()
5555
{
5656
$expectedValue = ['id' => 123, 'ref' => 'master'];
5757

@@ -64,6 +64,20 @@ public function shouldShowProject()
6464
$this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123));
6565
}
6666

67+
/**
68+
* @test
69+
*/
70+
public function shouldDeleteDeployment()
71+
{
72+
$api = $this->getApiMock();
73+
$api->expects($this->once())
74+
->method('delete')
75+
->with('/repos/KnpLabs/php-github-api/deployments/123')
76+
->will($this->returnValue(null));
77+
78+
$this->assertNull($api->remove('KnpLabs', 'php-github-api', 123));
79+
}
80+
6781
/**
6882
* @test
6983
*/
@@ -111,4 +125,4 @@ protected function getApiClass()
111125
{
112126
return \Github\Api\Deployment::class;
113127
}
114-
}
128+
}

0 commit comments

Comments
 (0)