Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions lib/Github/Api/CurrentUser/DeployKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,6 @@ public function create(array $params)
return $this->post('/user/keys', $params);
}

/**
* Updates deploy key for the authenticated user.
*
* @link http://developer.github.com/v3/repos/keys/
*
* @param string $id
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function update($id, array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(array('title', 'key'));
}

return $this->patch('/user/keys/'.rawurlencode($id), $params);
}

/**
* Removes deploy key for the authenticated user.
*
Expand Down
47 changes: 0 additions & 47 deletions test/Github/Tests/Api/CurrentUser/DeployKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,53 +83,6 @@ public function shouldNotCreateKeyWithoutKeyParam()
$api->create($data);
}

/**
* @test
*/
public function shouldUpdateKey()
{
$expectedValue = array('id' => '123', 'key' => 'ssh-rsa ...');
$data = array('title' => 'my key', 'key' => 'ssh-rsa ...');

$api = $this->getApiMock();
$api->expects($this->once())
->method('patch')
->with('/user/keys/123', $data)
->will($this->returnValue($expectedValue));

$this->assertEquals($expectedValue, $api->update(123, $data));
}

/**
* @test
* @expectedException \Github\Exception\MissingArgumentException
*/
public function shouldNotUpdateKeyWithoutTitleParam()
{
$data = array('key' => 'ssh-rsa ...');

$api = $this->getApiMock();
$api->expects($this->never())
->method('patch');

$api->update(123, $data);
}

/**
* @test
* @expectedException \Github\Exception\MissingArgumentException
*/
public function shouldNotUpdateKeyWithoutKeyParam()
{
$data = array('title' => 'my key');

$api = $this->getApiMock();
$api->expects($this->never())
->method('patch');

$api->update(123, $data);
}

/**
* @test
*/
Expand Down