diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 32aa168a..72c93b04 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -591,6 +591,11 @@ public function enableDeployKey(int|string $project_id, int $key_id): mixed return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); } + public function updateDeployKey(int|string $project_id, int $key_id, array $parameters): mixed + { + return $this->put($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id)), $parameters); + } + public function deployTokens(int|string $project_id, ?bool $active = null): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []); diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 62b5dfcc..a94d5be0 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -1352,6 +1352,20 @@ public function shoudEnableDeployKey(): void $this->assertEquals($expectedBool, $api->enableDeployKey(1, 3)); } + #[Test] + public function shouldUpdateDeployKey(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('put') + ->with('projects/1/deploy_keys/3', ['title' => 'new-title', 'can_push' => true]) + ->willReturn($expectedBool); + + $this->assertEquals($expectedBool, $api->updateDeployKey(1, 3, ['title' => 'new-title', 'can_push' => true])); + } + #[Test] public function shouldGetDeployTokens(): void {