diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 32aa168a..a2d0a7a3 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -194,9 +194,14 @@ public function update(int|string $project_id, array $parameters): mixed return $this->put('projects/'.self::encodePath($project_id), $parameters); } - public function remove(int|string $project_id): mixed + public function remove(int|string $project_id, array $parameters = []): mixed { - return $this->delete('projects/'.self::encodePath($project_id)); + return $this->delete('projects/'.self::encodePath($project_id), $parameters); + } + + public function restore(int|string $project_id): mixed + { + return $this->post('projects/'.self::encodePath($project_id).'/restore'); } public function archive(int|string $project_id): mixed diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 62b5dfcc..fb108a2f 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -345,6 +345,37 @@ public function shouldRemoveProject(): void $this->assertEquals($expectedBool, $api->remove(1)); } + #[Test] + public function shouldRemoveProjectPermanently(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('delete') + ->with('projects/1', ['permanently_remove' => true, 'full_path' => 'full/path/to/project']) + ->willReturn(true); + + $this->assertEquals($expectedBool, $api->remove(1, [ + 'permanently_remove' => true, + 'full_path' => 'full/path/to/project', + ])); + } + + #[Test] + public function shouldRestoreDeletedProject(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('projects/1/restore') + ->willReturn(true); + + $this->assertEquals($expectedBool, $api->restore(1)); + } + #[Test] public function shouldGetPipelines(): void {