From 8cf628767ad3cdc902e3bdef691cc4a0f97e04f2 Mon Sep 17 00:00:00 2001 From: Maicol Battistini Date: Mon, 7 Oct 2024 12:59:07 +0000 Subject: [PATCH 1/2] feat: Added new attributes for fork endpoint --- src/Api/Projects.php | 196 +++++++++++++++++++++++-------------- tests/Api/ProjectsTest.php | 24 +++++ 2 files changed, 146 insertions(+), 74 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 3f5d1962..e59b2df5 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -74,8 +74,16 @@ public function all(array $parameters = []) ->setAllowedValues('visibility', ['public', 'internal', 'private']) ; $orderBy = [ - 'id', 'name', 'path', 'created_at', 'updated_at', 'last_activity_at', - 'repository_size', 'storage_size', 'packages_size', 'wiki_size', + 'id', + 'name', + 'path', + 'created_at', + 'updated_at', + 'last_activity_at', + 'repository_size', + 'storage_size', + 'packages_size', + 'wiki_size', ]; $resolver->setDefined('order_by') ->setAllowedValues('order_by', $orderBy) @@ -177,7 +185,7 @@ public function show($project_id, array $parameters = []) ->setNormalizer('with_custom_attributes', $booleanNormalizer) ; - return $this->get('projects/'.self::encodePath($project_id), $resolver->resolve($parameters)); + return $this->get('projects/' . self::encodePath($project_id), $resolver->resolve($parameters)); } /** @@ -204,7 +212,7 @@ public function createForUser(int $user_id, string $name, array $parameters = [] { $parameters['name'] = $name; - return $this->post('projects/user/'.self::encodePath($user_id), $parameters); + return $this->post('projects/user/' . self::encodePath($user_id), $parameters); } /** @@ -215,7 +223,7 @@ public function createForUser(int $user_id, string $name, array $parameters = [] */ public function update($project_id, array $parameters) { - return $this->put('projects/'.self::encodePath($project_id), $parameters); + return $this->put('projects/' . self::encodePath($project_id), $parameters); } /** @@ -225,7 +233,7 @@ public function update($project_id, array $parameters) */ public function remove($project_id) { - return $this->delete('projects/'.self::encodePath($project_id)); + return $this->delete('projects/' . self::encodePath($project_id)); } /** @@ -235,7 +243,7 @@ public function remove($project_id) */ public function archive($project_id) { - return $this->post('projects/'.self::encodePath($project_id).'/archive'); + return $this->post('projects/' . self::encodePath($project_id) . '/archive'); } /** @@ -245,7 +253,7 @@ public function archive($project_id) */ public function unarchive($project_id) { - return $this->post('projects/'.self::encodePath($project_id).'/unarchive'); + return $this->post('projects/' . self::encodePath($project_id) . '/unarchive'); } /** @@ -255,7 +263,7 @@ public function unarchive($project_id) */ public function triggers($project_id) { - return $this->get('projects/'.self::encodePath($project_id).'/triggers'); + return $this->get('projects/' . self::encodePath($project_id) . '/triggers'); } /** @@ -266,7 +274,7 @@ public function triggers($project_id) */ public function trigger($project_id, int $trigger_id) { - return $this->get($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); + return $this->get($this->getProjectPath($project_id, 'triggers/' . self::encodePath($trigger_id))); } /** @@ -290,7 +298,7 @@ public function createTrigger($project_id, string $description) */ public function removeTrigger($project_id, int $trigger_id) { - return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); + return $this->delete($this->getProjectPath($project_id, 'triggers/' . self::encodePath($trigger_id))); } /** @@ -318,7 +326,7 @@ public function triggerPipeline($project_id, string $ref, string $token, array $ */ public function disableRunner(int $project_id, int $runner_id) { - return $this->delete('projects/'.self::encodePath($project_id).'/runners/'.self::encodePath($runner_id)); + return $this->delete('projects/' . self::encodePath($project_id) . '/runners/' . self::encodePath($runner_id)); } /** @@ -333,7 +341,7 @@ public function enableRunner(int $project_id, int $runner_id) 'runner_id' => $runner_id, ]; - return $this->post('projects/'.self::encodePath($project_id).'/runners', $parameters); + return $this->post('projects/' . self::encodePath($project_id) . '/runners', $parameters); } /** @@ -379,12 +387,12 @@ public function pipelines($project_id, array $parameters = []) $resolver->setDefined('name'); $resolver->setDefined('username'); $resolver->setDefined('updated_after') - ->setAllowedTypes('updated_after', \DateTimeInterface::class) - ->setNormalizer('updated_after', $datetimeNormalizer) + ->setAllowedTypes('updated_after', \DateTimeInterface::class) + ->setNormalizer('updated_after', $datetimeNormalizer) ; $resolver->setDefined('updated_before') - ->setAllowedTypes('updated_before', \DateTimeInterface::class) - ->setNormalizer('updated_before', $datetimeNormalizer) + ->setAllowedTypes('updated_before', \DateTimeInterface::class) + ->setNormalizer('updated_before', $datetimeNormalizer) ; $resolver->setDefined('order_by') ->setAllowedValues('order_by', ['id', 'status', 'ref', 'updated_at', 'user_id']) @@ -407,7 +415,7 @@ public function pipelines($project_id, array $parameters = []) */ public function pipeline($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); + return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id))); } /** @@ -418,7 +426,7 @@ public function pipeline($project_id, int $pipeline_id) */ public function pipelineJobs($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/jobs')); + return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/jobs')); } /** @@ -429,7 +437,7 @@ public function pipelineJobs($project_id, int $pipeline_id) */ public function pipelineVariables($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables')); + return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/variables')); } /** @@ -440,7 +448,7 @@ public function pipelineVariables($project_id, int $pipeline_id) */ public function pipelineTestReport($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report')); + return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/test_report')); } /** @@ -451,7 +459,7 @@ public function pipelineTestReport($project_id, int $pipeline_id) */ public function pipelineTestReportSummary($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary')); + return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/test_report_summary')); } /** @@ -487,7 +495,7 @@ public function createPipeline($project_id, string $commit_ref, array $variables */ public function retryPipeline($project_id, int $pipeline_id) { - return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/retry'); + return $this->post($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id)) . '/retry'); } /** @@ -498,7 +506,7 @@ public function retryPipeline($project_id, int $pipeline_id) */ public function cancelPipeline($project_id, int $pipeline_id) { - return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/cancel'); + return $this->post($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id)) . '/cancel'); } /** @@ -509,7 +517,7 @@ public function cancelPipeline($project_id, int $pipeline_id) */ public function deletePipeline($project_id, int $pipeline_id) { - return $this->delete($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); + return $this->delete($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id))); } /** @@ -529,7 +537,7 @@ public function allMembers($project_id, array $parameters = []) }) ; - return $this->get('projects/'.self::encodePath($project_id).'/members/all', $resolver->resolve($parameters)); + return $this->get('projects/' . self::encodePath($project_id) . '/members/all', $resolver->resolve($parameters)); } /** @@ -566,7 +574,7 @@ public function members($project_id, array $parameters = []) */ public function member($project_id, int $user_id) { - return $this->get($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); + return $this->get($this->getProjectPath($project_id, 'members/' . self::encodePath($user_id))); } /** @@ -577,7 +585,7 @@ public function member($project_id, int $user_id) */ public function allMember($project_id, int $user_id) { - return $this->get($this->getProjectPath($project_id, 'members/all/'.self::encodePath($user_id))); + return $this->get($this->getProjectPath($project_id, 'members/all/' . self::encodePath($user_id))); } /** @@ -618,7 +626,7 @@ public function saveMember($project_id, int $user_id, int $access_level, string $params['expires_at'] = $expires_at; } - return $this->put($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id)), $params); + return $this->put($this->getProjectPath($project_id, 'members/' . self::encodePath($user_id)), $params); } /** @@ -629,7 +637,7 @@ public function saveMember($project_id, int $user_id, int $access_level, string */ public function removeMember($project_id, int $user_id) { - return $this->delete($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); + return $this->delete($this->getProjectPath($project_id, 'members/' . self::encodePath($user_id))); } /** @@ -653,7 +661,7 @@ public function hooks($project_id, array $parameters = []) */ public function hook($project_id, int $hook_id) { - return $this->get($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); + return $this->get($this->getProjectPath($project_id, 'hooks/' . self::encodePath($hook_id))); } /** @@ -728,7 +736,7 @@ public function iterations($project_id, array $parameters = []) ->setDefault('include_ancestors', true) ; - return $this->get('projects/'.self::encodePath($project_id).'/iterations', $resolver->resolve($parameters)); + return $this->get('projects/' . self::encodePath($project_id) . '/iterations', $resolver->resolve($parameters)); } /** @@ -747,7 +755,7 @@ public function iterations($project_id, array $parameters = []) */ public function getRepositoryCommitDiscussions($project_id, string $commit_id) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($commit_id)).'/discussions'); + return $this->get($this->getProjectPath($project_id, 'repository/commits/' . self::encodePath($commit_id)) . '/discussions'); } /** @@ -777,7 +785,7 @@ public function addHook($project_id, string $url, array $parameters = []) */ public function updateHook($project_id, int $hook_id, array $parameters) { - return $this->put($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id)), $parameters); + return $this->put($this->getProjectPath($project_id, 'hooks/' . self::encodePath($hook_id)), $parameters); } /** @@ -788,7 +796,7 @@ public function updateHook($project_id, int $hook_id, array $parameters) */ public function removeHook($project_id, int $hook_id) { - return $this->delete($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); + return $this->delete($this->getProjectPath($project_id, 'hooks/' . self::encodePath($hook_id))); } /** @@ -820,7 +828,7 @@ public function deployKeys($project_id) */ public function deployKey($project_id, int $key_id) { - return $this->get($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); + return $this->get($this->getProjectPath($project_id, 'deploy_keys/' . self::encodePath($key_id))); } /** @@ -848,7 +856,7 @@ public function addDeployKey($project_id, string $title, string $key, bool $canP */ public function deleteDeployKey($project_id, int $key_id) { - return $this->delete($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); + return $this->delete($this->getProjectPath($project_id, 'deploy_keys/' . self::encodePath($key_id))); } /** @@ -859,7 +867,7 @@ public function deleteDeployKey($project_id, int $key_id) */ public function enableDeployKey($project_id, int $key_id) { - return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); + return $this->post($this->getProjectPath($project_id, 'deploy_keys/' . self::encodePath($key_id) . '/enable')); } /** @@ -930,7 +938,7 @@ public function createDeployToken($project_id, array $parameters = []) */ public function deleteDeployToken($project_id, int $token_id) { - return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/'.self::encodePath($token_id))); + return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/' . self::encodePath($token_id))); } /** @@ -1020,7 +1028,7 @@ public function addLabel($project_id, array $parameters) */ public function updateLabel($project_id, int $label_id, array $parameters) { - return $this->put($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id)), $parameters); + return $this->put($this->getProjectPath($project_id, 'labels/' . self::encodePath($label_id)), $parameters); } /** @@ -1031,7 +1039,7 @@ public function updateLabel($project_id, int $label_id, array $parameters) */ public function removeLabel($project_id, int $label_id) { - return $this->delete($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id))); + return $this->delete($this->getProjectPath($project_id, 'labels/' . self::encodePath($label_id))); } /** @@ -1089,8 +1097,16 @@ public function forks($project_id, array $parameters = []) ->setAllowedValues('visibility', ['public', 'internal', 'private']) ; $orderBy = [ - 'id', 'name', 'path', 'created_at', 'updated_at', 'last_activity_at', - 'repository_size', 'storage_size', 'packages_size', 'wiki_size', + 'id', + 'name', + 'path', + 'created_at', + 'updated_at', + 'last_activity_at', + 'repository_size', + 'storage_size', + 'packages_size', + 'wiki_size', ]; $resolver->setDefined('order_by') ->setAllowedValues('order_by', $orderBy) @@ -1150,9 +1166,15 @@ public function forks($project_id, array $parameters = []) * @param int|string $project_id * @param array $parameters { * - * @var string $namespace The ID or path of the namespace that the project will be forked to - * @var string $path The path of the forked project (optional) - * @var string $name The name of the forked project (optional) + * @var string $namespace (Deprecated) The ID or path of the namespace that the project will be forked to (optional) + * @var int $namespace_id The ID of the namespace that the project is forked to. (optional) + * @var string $namespace_path The path of the namespace that the project is forked to. (optional) + * @var string $path The path of the forked project (optional) + * @var string $name The name of the forked project (optional) + * @var string $branches The branches to fork (empty for all branches) (optional) + * @var string $description The description assigned to the resultant project after forking (optional) + * @var boolean $mr_default_target_self For forked projects, target merge requests to this project. If false, the target is the upstream project. (optional) + * @var string $visibility The visibility level assigned to the resultant project after forking. (optional) * } * * @return mixed @@ -1160,7 +1182,33 @@ public function forks($project_id, array $parameters = []) public function fork($project_id, array $parameters = []) { $resolver = new OptionsResolver(); - $resolver->setDefined(['namespace', 'path', 'name']); + $resolver->setDefined('namespace') + ->setDeprecated('namespace', '13.0', 'The "namespace" parameter is deprecated. Use "namespace_id" or "namespace_path" instead.') + ; + $resolver->setDefined('namespace_id') + ->setAllowedTypes('namespace_id', 'int') + ; + $resolver->setDefined('namespace_path') + ->setAllowedTypes('namespace_path', 'string') + ; + $resolver->setDefined('path') + ->setAllowedTypes('path', 'string') + ; + $resolver->setDefined('name') + ->setAllowedTypes('name', 'string') + ; + $resolver->setDefined('branches') + ->setAllowedTypes('branches', 'string') + ; + $resolver->setDefined('description') + ->setAllowedTypes('description', 'string') + ; + $resolver->setDefined('mr_default_target_self') + ->setAllowedTypes('mr_default_target_self', 'bool') + ; + $resolver->setDefined('visibility') + ->setAllowedValues('visibility', ['private', 'internal', 'public']) + ; $resolved = $resolver->resolve($parameters); @@ -1175,7 +1223,7 @@ public function fork($project_id, array $parameters = []) */ public function createForkRelation($project_id, $forked_project_id) { - return $this->post($this->getProjectPath($project_id, 'fork/'.self::encodePath($forked_project_id))); + return $this->post($this->getProjectPath($project_id, 'fork/' . self::encodePath($forked_project_id))); } /** @@ -1197,7 +1245,7 @@ public function removeForkRelation($project_id) */ public function setService($project_id, string $service_name, array $parameters = []) { - return $this->put($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name)), $parameters); + return $this->put($this->getProjectPath($project_id, 'services/' . self::encodePath($service_name)), $parameters); } /** @@ -1208,7 +1256,7 @@ public function setService($project_id, string $service_name, array $parameters */ public function removeService($project_id, string $service_name) { - return $this->delete($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name))); + return $this->delete($this->getProjectPath($project_id, 'services/' . self::encodePath($service_name))); } /** @@ -1237,7 +1285,7 @@ public function variable($project_id, string $key, array $parameters = []) $resolver->setDefined('filter') ->setAllowedTypes('filter', 'array'); - return $this->get($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'variables/' . self::encodePath($key)), $resolver->resolve($parameters)); } /** @@ -1302,7 +1350,7 @@ public function updateVariable($project_id, string $key, string $value, ?bool $p $payload = \array_merge($parameters, $payload); - return $this->put($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $payload); + return $this->put($this->getProjectPath($project_id, 'variables/' . self::encodePath($key)), $payload); } /** @@ -1323,7 +1371,7 @@ public function removeVariable($project_id, string $key, array $parameters = []) $resolver->setDefined('filter') ->setAllowedTypes('filter', 'array'); - return $this->delete($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); + return $this->delete($this->getProjectPath($project_id, 'variables/' . self::encodePath($key)), $resolver->resolve($parameters)); } /** @@ -1345,7 +1393,7 @@ public function uploadFile($project_id, string $file) */ public function uploadAvatar($project_id, string $file) { - return $this->put('projects/'.self::encodePath($project_id), [], [], ['avatar' => $file]); + return $this->put('projects/' . self::encodePath($project_id), [], [], ['avatar' => $file]); } /** @@ -1414,7 +1462,7 @@ public function deployments($project_id, array $parameters = []) */ public function deployment($project_id, int $deployment_id) { - return $this->get($this->getProjectPath($project_id, 'deployments/'.self::encodePath($deployment_id))); + return $this->get($this->getProjectPath($project_id, 'deployments/' . self::encodePath($deployment_id))); } /** @@ -1454,7 +1502,7 @@ public function addShare($project_id, array $parameters = []) */ public function removeShare($project_id, $group_id) { - return $this->delete($this->getProjectPath($project_id, 'share/'.$group_id)); + return $this->delete($this->getProjectPath($project_id, 'share/' . $group_id)); } /** @@ -1475,7 +1523,7 @@ public function badges($project_id) */ public function badge($project_id, int $badge_id) { - return $this->get($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); + return $this->get($this->getProjectPath($project_id, 'badges/' . self::encodePath($badge_id))); } /** @@ -1497,7 +1545,7 @@ public function addBadge($project_id, array $parameters = []) */ public function removeBadge($project_id, int $badge_id) { - return $this->delete($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); + return $this->delete($this->getProjectPath($project_id, 'badges/' . self::encodePath($badge_id))); } /** @@ -1509,7 +1557,7 @@ public function removeBadge($project_id, int $badge_id) */ public function updateBadge($project_id, int $badge_id, array $parameters = []) { - return $this->put($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id)), $parameters); + return $this->put($this->getProjectPath($project_id, 'badges/' . self::encodePath($badge_id)), $parameters); } /** @@ -1520,7 +1568,7 @@ public function updateBadge($project_id, int $badge_id, array $parameters = []) */ public function protectedBranches($project_id, array $parameters = []) { - return $this->get('projects/'.self::encodePath($project_id).'/protected_branches'); + return $this->get('projects/' . self::encodePath($project_id) . '/protected_branches'); } /** @@ -1542,7 +1590,7 @@ public function addProtectedBranch($project_id, array $parameters = []) */ public function deleteProtectedBranch($project_id, string $branch_name) { - return $this->delete($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name))); + return $this->delete($this->getProjectPath($project_id, 'protected_branches/' . self::encodePath($branch_name))); } /** @@ -1554,7 +1602,7 @@ public function deleteProtectedBranch($project_id, string $branch_name) */ public function updateProtectedBranch($project_id, string $branch_name, array $parameters = []) { - return $this->patch($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name)), $parameters); + return $this->patch($this->getProjectPath($project_id, 'protected_branches/' . self::encodePath($branch_name)), $parameters); } /** @@ -1564,7 +1612,7 @@ public function updateProtectedBranch($project_id, string $branch_name, array $p */ public function approvalsConfiguration($project_id) { - return $this->get('projects/'.self::encodePath($project_id).'/approvals'); + return $this->get('projects/' . self::encodePath($project_id) . '/approvals'); } /** @@ -1575,7 +1623,7 @@ public function approvalsConfiguration($project_id) */ public function updateApprovalsConfiguration($project_id, array $parameters = []) { - return $this->post('projects/'.self::encodePath($project_id).'/approvals', $parameters); + return $this->post('projects/' . self::encodePath($project_id) . '/approvals', $parameters); } /** @@ -1585,7 +1633,7 @@ public function updateApprovalsConfiguration($project_id, array $parameters = [] */ public function approvalsRules($project_id) { - return $this->get('projects/'.self::encodePath($project_id).'/approval_rules'); + return $this->get('projects/' . self::encodePath($project_id) . '/approval_rules'); } /** @@ -1596,7 +1644,7 @@ public function approvalsRules($project_id) */ public function createApprovalsRule($project_id, array $parameters = []) { - return $this->post('projects/'.self::encodePath($project_id).'/approval_rules/', $parameters); + return $this->post('projects/' . self::encodePath($project_id) . '/approval_rules/', $parameters); } /** @@ -1608,7 +1656,7 @@ public function createApprovalsRule($project_id, array $parameters = []) */ public function updateApprovalsRule($project_id, int $approval_rule_id, array $parameters = []) { - return $this->put('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id), $parameters); + return $this->put('projects/' . self::encodePath($project_id) . '/approval_rules/' . self::encodePath($approval_rule_id), $parameters); } /** @@ -1619,7 +1667,7 @@ public function updateApprovalsRule($project_id, int $approval_rule_id, array $p */ public function deleteApprovalsRule($project_id, int $approval_rule_id) { - return $this->delete('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id)); + return $this->delete('projects/' . self::encodePath($project_id) . '/approval_rules/' . self::encodePath($approval_rule_id)); } /** @@ -1650,7 +1698,7 @@ public function projectAccessTokens($project_id) */ public function projectAccessToken($project_id, $token_id) { - return $this->get($this->getProjectPath($project_id, 'access_tokens/'.self::encodePath($token_id))); + return $this->get($this->getProjectPath($project_id, 'access_tokens/' . self::encodePath($token_id))); } /** @@ -1712,7 +1760,7 @@ public function createProjectAccessToken($project_id, array $parameters = []) */ public function deleteProjectAccessToken($project_id, $token_id) { - return $this->delete($this->getProjectPath($project_id, 'access_tokens/'.$token_id)); + return $this->delete($this->getProjectPath($project_id, 'access_tokens/' . $token_id)); } /** @@ -1722,7 +1770,7 @@ public function deleteProjectAccessToken($project_id, $token_id) */ public function protectedTags($project_id) { - return $this->get('projects/'.self::encodePath($project_id).'/protected_tags'); + return $this->get('projects/' . self::encodePath($project_id) . '/protected_tags'); } /** @@ -1733,7 +1781,7 @@ public function protectedTags($project_id) */ public function protectedTag($project_id, string $tag_name) { - return $this->get('projects/'.self::encodePath($project_id).'/protected_tags/'.self::encodePath($tag_name)); + return $this->get('projects/' . self::encodePath($project_id) . '/protected_tags/' . self::encodePath($tag_name)); } /** @@ -1778,7 +1826,7 @@ public function addProtectedTag($project_id, array $parameters = []) */ public function deleteProtectedTag($project_id, string $tag_name) { - return $this->delete($this->getProjectPath($project_id, 'protected_tags/'.self::encodePath($tag_name))); + return $this->delete($this->getProjectPath($project_id, 'protected_tags/' . self::encodePath($tag_name))); } /** @@ -1830,6 +1878,6 @@ public function search($id, array $parameters = []) $resolver->setDefined('state') ->setAllowedValues('state', ['opened', 'closed']); - return $this->get('projects/'.self::encodePath($id).'/search', $resolver->resolve($parameters)); + return $this->get('projects/' . self::encodePath($id) . '/search', $resolver->resolve($parameters)); } } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index c3296d62..e3098421 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -1876,6 +1876,30 @@ public function shouldForkWithNamespaceAndPathAndName(): void ])); } + /** + * @test + */ + public function shouldForkWithAllParametersNamespacePath(): void + { + $expectedArray = [ + 'branches' => 'master', + 'namespace_path' => 'new_namespace', + 'path' => 'new_path', + 'name' => 'new_name', + 'description' => 'new_description', + 'visibility' => 'public', + 'mr_default_target_self' => 'true', + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('projects/1/fork', $expectedArray) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->fork(1, $expectedArray)); + } + /** * @test */ From c60ebb867804ef3fb53388786f838f282d0d53a4 Mon Sep 17 00:00:00 2001 From: Maicol Battistini Date: Sat, 9 Nov 2024 14:13:23 +0000 Subject: [PATCH 2/2] fix: Remove unnecessary whitespace --- src/Api/Projects.php | 124 ++++++++++++++++++------------------- tests/Api/ProjectsTest.php | 2 +- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index e59b2df5..72a27188 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -185,7 +185,7 @@ public function show($project_id, array $parameters = []) ->setNormalizer('with_custom_attributes', $booleanNormalizer) ; - return $this->get('projects/' . self::encodePath($project_id), $resolver->resolve($parameters)); + return $this->get('projects/'.self::encodePath($project_id), $resolver->resolve($parameters)); } /** @@ -212,7 +212,7 @@ public function createForUser(int $user_id, string $name, array $parameters = [] { $parameters['name'] = $name; - return $this->post('projects/user/' . self::encodePath($user_id), $parameters); + return $this->post('projects/user/'.self::encodePath($user_id), $parameters); } /** @@ -223,7 +223,7 @@ public function createForUser(int $user_id, string $name, array $parameters = [] */ public function update($project_id, array $parameters) { - return $this->put('projects/' . self::encodePath($project_id), $parameters); + return $this->put('projects/'.self::encodePath($project_id), $parameters); } /** @@ -233,7 +233,7 @@ public function update($project_id, array $parameters) */ public function remove($project_id) { - return $this->delete('projects/' . self::encodePath($project_id)); + return $this->delete('projects/'.self::encodePath($project_id)); } /** @@ -243,7 +243,7 @@ public function remove($project_id) */ public function archive($project_id) { - return $this->post('projects/' . self::encodePath($project_id) . '/archive'); + return $this->post('projects/'.self::encodePath($project_id).'/archive'); } /** @@ -253,7 +253,7 @@ public function archive($project_id) */ public function unarchive($project_id) { - return $this->post('projects/' . self::encodePath($project_id) . '/unarchive'); + return $this->post('projects/'.self::encodePath($project_id).'/unarchive'); } /** @@ -263,7 +263,7 @@ public function unarchive($project_id) */ public function triggers($project_id) { - return $this->get('projects/' . self::encodePath($project_id) . '/triggers'); + return $this->get('projects/'.self::encodePath($project_id).'/triggers'); } /** @@ -274,7 +274,7 @@ public function triggers($project_id) */ public function trigger($project_id, int $trigger_id) { - return $this->get($this->getProjectPath($project_id, 'triggers/' . self::encodePath($trigger_id))); + return $this->get($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } /** @@ -298,7 +298,7 @@ public function createTrigger($project_id, string $description) */ public function removeTrigger($project_id, int $trigger_id) { - return $this->delete($this->getProjectPath($project_id, 'triggers/' . self::encodePath($trigger_id))); + return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } /** @@ -326,7 +326,7 @@ public function triggerPipeline($project_id, string $ref, string $token, array $ */ public function disableRunner(int $project_id, int $runner_id) { - return $this->delete('projects/' . self::encodePath($project_id) . '/runners/' . self::encodePath($runner_id)); + return $this->delete('projects/'.self::encodePath($project_id).'/runners/'.self::encodePath($runner_id)); } /** @@ -341,7 +341,7 @@ public function enableRunner(int $project_id, int $runner_id) 'runner_id' => $runner_id, ]; - return $this->post('projects/' . self::encodePath($project_id) . '/runners', $parameters); + return $this->post('projects/'.self::encodePath($project_id).'/runners', $parameters); } /** @@ -415,7 +415,7 @@ public function pipelines($project_id, array $parameters = []) */ public function pipeline($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id))); + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } /** @@ -426,7 +426,7 @@ public function pipeline($project_id, int $pipeline_id) */ public function pipelineJobs($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/jobs')); + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/jobs')); } /** @@ -437,7 +437,7 @@ public function pipelineJobs($project_id, int $pipeline_id) */ public function pipelineVariables($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/variables')); + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables')); } /** @@ -448,7 +448,7 @@ public function pipelineVariables($project_id, int $pipeline_id) */ public function pipelineTestReport($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/test_report')); + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report')); } /** @@ -459,7 +459,7 @@ public function pipelineTestReport($project_id, int $pipeline_id) */ public function pipelineTestReportSummary($project_id, int $pipeline_id) { - return $this->get($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id) . '/test_report_summary')); + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary')); } /** @@ -495,7 +495,7 @@ public function createPipeline($project_id, string $commit_ref, array $variables */ public function retryPipeline($project_id, int $pipeline_id) { - return $this->post($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id)) . '/retry'); + return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/retry'); } /** @@ -506,7 +506,7 @@ public function retryPipeline($project_id, int $pipeline_id) */ public function cancelPipeline($project_id, int $pipeline_id) { - return $this->post($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id)) . '/cancel'); + return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/cancel'); } /** @@ -517,7 +517,7 @@ public function cancelPipeline($project_id, int $pipeline_id) */ public function deletePipeline($project_id, int $pipeline_id) { - return $this->delete($this->getProjectPath($project_id, 'pipelines/' . self::encodePath($pipeline_id))); + return $this->delete($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } /** @@ -537,7 +537,7 @@ public function allMembers($project_id, array $parameters = []) }) ; - return $this->get('projects/' . self::encodePath($project_id) . '/members/all', $resolver->resolve($parameters)); + return $this->get('projects/'.self::encodePath($project_id).'/members/all', $resolver->resolve($parameters)); } /** @@ -574,7 +574,7 @@ public function members($project_id, array $parameters = []) */ public function member($project_id, int $user_id) { - return $this->get($this->getProjectPath($project_id, 'members/' . self::encodePath($user_id))); + return $this->get($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } /** @@ -585,7 +585,7 @@ public function member($project_id, int $user_id) */ public function allMember($project_id, int $user_id) { - return $this->get($this->getProjectPath($project_id, 'members/all/' . self::encodePath($user_id))); + return $this->get($this->getProjectPath($project_id, 'members/all/'.self::encodePath($user_id))); } /** @@ -626,7 +626,7 @@ public function saveMember($project_id, int $user_id, int $access_level, string $params['expires_at'] = $expires_at; } - return $this->put($this->getProjectPath($project_id, 'members/' . self::encodePath($user_id)), $params); + return $this->put($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id)), $params); } /** @@ -637,7 +637,7 @@ public function saveMember($project_id, int $user_id, int $access_level, string */ public function removeMember($project_id, int $user_id) { - return $this->delete($this->getProjectPath($project_id, 'members/' . self::encodePath($user_id))); + return $this->delete($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } /** @@ -661,7 +661,7 @@ public function hooks($project_id, array $parameters = []) */ public function hook($project_id, int $hook_id) { - return $this->get($this->getProjectPath($project_id, 'hooks/' . self::encodePath($hook_id))); + return $this->get($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } /** @@ -736,7 +736,7 @@ public function iterations($project_id, array $parameters = []) ->setDefault('include_ancestors', true) ; - return $this->get('projects/' . self::encodePath($project_id) . '/iterations', $resolver->resolve($parameters)); + return $this->get('projects/'.self::encodePath($project_id).'/iterations', $resolver->resolve($parameters)); } /** @@ -755,7 +755,7 @@ public function iterations($project_id, array $parameters = []) */ public function getRepositoryCommitDiscussions($project_id, string $commit_id) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/' . self::encodePath($commit_id)) . '/discussions'); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($commit_id)).'/discussions'); } /** @@ -785,7 +785,7 @@ public function addHook($project_id, string $url, array $parameters = []) */ public function updateHook($project_id, int $hook_id, array $parameters) { - return $this->put($this->getProjectPath($project_id, 'hooks/' . self::encodePath($hook_id)), $parameters); + return $this->put($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id)), $parameters); } /** @@ -796,7 +796,7 @@ public function updateHook($project_id, int $hook_id, array $parameters) */ public function removeHook($project_id, int $hook_id) { - return $this->delete($this->getProjectPath($project_id, 'hooks/' . self::encodePath($hook_id))); + return $this->delete($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } /** @@ -828,7 +828,7 @@ public function deployKeys($project_id) */ public function deployKey($project_id, int $key_id) { - return $this->get($this->getProjectPath($project_id, 'deploy_keys/' . self::encodePath($key_id))); + return $this->get($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } /** @@ -856,7 +856,7 @@ public function addDeployKey($project_id, string $title, string $key, bool $canP */ public function deleteDeployKey($project_id, int $key_id) { - return $this->delete($this->getProjectPath($project_id, 'deploy_keys/' . self::encodePath($key_id))); + return $this->delete($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } /** @@ -867,7 +867,7 @@ public function deleteDeployKey($project_id, int $key_id) */ public function enableDeployKey($project_id, int $key_id) { - return $this->post($this->getProjectPath($project_id, 'deploy_keys/' . self::encodePath($key_id) . '/enable')); + return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); } /** @@ -938,7 +938,7 @@ public function createDeployToken($project_id, array $parameters = []) */ public function deleteDeployToken($project_id, int $token_id) { - return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/' . self::encodePath($token_id))); + return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/'.self::encodePath($token_id))); } /** @@ -1028,7 +1028,7 @@ public function addLabel($project_id, array $parameters) */ public function updateLabel($project_id, int $label_id, array $parameters) { - return $this->put($this->getProjectPath($project_id, 'labels/' . self::encodePath($label_id)), $parameters); + return $this->put($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id)), $parameters); } /** @@ -1039,7 +1039,7 @@ public function updateLabel($project_id, int $label_id, array $parameters) */ public function removeLabel($project_id, int $label_id) { - return $this->delete($this->getProjectPath($project_id, 'labels/' . self::encodePath($label_id))); + return $this->delete($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id))); } /** @@ -1223,7 +1223,7 @@ public function fork($project_id, array $parameters = []) */ public function createForkRelation($project_id, $forked_project_id) { - return $this->post($this->getProjectPath($project_id, 'fork/' . self::encodePath($forked_project_id))); + return $this->post($this->getProjectPath($project_id, 'fork/'.self::encodePath($forked_project_id))); } /** @@ -1245,7 +1245,7 @@ public function removeForkRelation($project_id) */ public function setService($project_id, string $service_name, array $parameters = []) { - return $this->put($this->getProjectPath($project_id, 'services/' . self::encodePath($service_name)), $parameters); + return $this->put($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name)), $parameters); } /** @@ -1256,7 +1256,7 @@ public function setService($project_id, string $service_name, array $parameters */ public function removeService($project_id, string $service_name) { - return $this->delete($this->getProjectPath($project_id, 'services/' . self::encodePath($service_name))); + return $this->delete($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name))); } /** @@ -1285,7 +1285,7 @@ public function variable($project_id, string $key, array $parameters = []) $resolver->setDefined('filter') ->setAllowedTypes('filter', 'array'); - return $this->get($this->getProjectPath($project_id, 'variables/' . self::encodePath($key)), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); } /** @@ -1350,7 +1350,7 @@ public function updateVariable($project_id, string $key, string $value, ?bool $p $payload = \array_merge($parameters, $payload); - return $this->put($this->getProjectPath($project_id, 'variables/' . self::encodePath($key)), $payload); + return $this->put($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $payload); } /** @@ -1371,7 +1371,7 @@ public function removeVariable($project_id, string $key, array $parameters = []) $resolver->setDefined('filter') ->setAllowedTypes('filter', 'array'); - return $this->delete($this->getProjectPath($project_id, 'variables/' . self::encodePath($key)), $resolver->resolve($parameters)); + return $this->delete($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); } /** @@ -1393,7 +1393,7 @@ public function uploadFile($project_id, string $file) */ public function uploadAvatar($project_id, string $file) { - return $this->put('projects/' . self::encodePath($project_id), [], [], ['avatar' => $file]); + return $this->put('projects/'.self::encodePath($project_id), [], [], ['avatar' => $file]); } /** @@ -1462,7 +1462,7 @@ public function deployments($project_id, array $parameters = []) */ public function deployment($project_id, int $deployment_id) { - return $this->get($this->getProjectPath($project_id, 'deployments/' . self::encodePath($deployment_id))); + return $this->get($this->getProjectPath($project_id, 'deployments/'.self::encodePath($deployment_id))); } /** @@ -1502,7 +1502,7 @@ public function addShare($project_id, array $parameters = []) */ public function removeShare($project_id, $group_id) { - return $this->delete($this->getProjectPath($project_id, 'share/' . $group_id)); + return $this->delete($this->getProjectPath($project_id, 'share/'.$group_id)); } /** @@ -1523,7 +1523,7 @@ public function badges($project_id) */ public function badge($project_id, int $badge_id) { - return $this->get($this->getProjectPath($project_id, 'badges/' . self::encodePath($badge_id))); + return $this->get($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } /** @@ -1545,7 +1545,7 @@ public function addBadge($project_id, array $parameters = []) */ public function removeBadge($project_id, int $badge_id) { - return $this->delete($this->getProjectPath($project_id, 'badges/' . self::encodePath($badge_id))); + return $this->delete($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } /** @@ -1557,7 +1557,7 @@ public function removeBadge($project_id, int $badge_id) */ public function updateBadge($project_id, int $badge_id, array $parameters = []) { - return $this->put($this->getProjectPath($project_id, 'badges/' . self::encodePath($badge_id)), $parameters); + return $this->put($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id)), $parameters); } /** @@ -1568,7 +1568,7 @@ public function updateBadge($project_id, int $badge_id, array $parameters = []) */ public function protectedBranches($project_id, array $parameters = []) { - return $this->get('projects/' . self::encodePath($project_id) . '/protected_branches'); + return $this->get('projects/'.self::encodePath($project_id).'/protected_branches'); } /** @@ -1590,7 +1590,7 @@ public function addProtectedBranch($project_id, array $parameters = []) */ public function deleteProtectedBranch($project_id, string $branch_name) { - return $this->delete($this->getProjectPath($project_id, 'protected_branches/' . self::encodePath($branch_name))); + return $this->delete($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name))); } /** @@ -1602,7 +1602,7 @@ public function deleteProtectedBranch($project_id, string $branch_name) */ public function updateProtectedBranch($project_id, string $branch_name, array $parameters = []) { - return $this->patch($this->getProjectPath($project_id, 'protected_branches/' . self::encodePath($branch_name)), $parameters); + return $this->patch($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name)), $parameters); } /** @@ -1612,7 +1612,7 @@ public function updateProtectedBranch($project_id, string $branch_name, array $p */ public function approvalsConfiguration($project_id) { - return $this->get('projects/' . self::encodePath($project_id) . '/approvals'); + return $this->get('projects/'.self::encodePath($project_id).'/approvals'); } /** @@ -1623,7 +1623,7 @@ public function approvalsConfiguration($project_id) */ public function updateApprovalsConfiguration($project_id, array $parameters = []) { - return $this->post('projects/' . self::encodePath($project_id) . '/approvals', $parameters); + return $this->post('projects/'.self::encodePath($project_id).'/approvals', $parameters); } /** @@ -1633,7 +1633,7 @@ public function updateApprovalsConfiguration($project_id, array $parameters = [] */ public function approvalsRules($project_id) { - return $this->get('projects/' . self::encodePath($project_id) . '/approval_rules'); + return $this->get('projects/'.self::encodePath($project_id).'/approval_rules'); } /** @@ -1644,7 +1644,7 @@ public function approvalsRules($project_id) */ public function createApprovalsRule($project_id, array $parameters = []) { - return $this->post('projects/' . self::encodePath($project_id) . '/approval_rules/', $parameters); + return $this->post('projects/'.self::encodePath($project_id).'/approval_rules/', $parameters); } /** @@ -1656,7 +1656,7 @@ public function createApprovalsRule($project_id, array $parameters = []) */ public function updateApprovalsRule($project_id, int $approval_rule_id, array $parameters = []) { - return $this->put('projects/' . self::encodePath($project_id) . '/approval_rules/' . self::encodePath($approval_rule_id), $parameters); + return $this->put('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id), $parameters); } /** @@ -1667,7 +1667,7 @@ public function updateApprovalsRule($project_id, int $approval_rule_id, array $p */ public function deleteApprovalsRule($project_id, int $approval_rule_id) { - return $this->delete('projects/' . self::encodePath($project_id) . '/approval_rules/' . self::encodePath($approval_rule_id)); + return $this->delete('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id)); } /** @@ -1698,7 +1698,7 @@ public function projectAccessTokens($project_id) */ public function projectAccessToken($project_id, $token_id) { - return $this->get($this->getProjectPath($project_id, 'access_tokens/' . self::encodePath($token_id))); + return $this->get($this->getProjectPath($project_id, 'access_tokens/'.self::encodePath($token_id))); } /** @@ -1760,7 +1760,7 @@ public function createProjectAccessToken($project_id, array $parameters = []) */ public function deleteProjectAccessToken($project_id, $token_id) { - return $this->delete($this->getProjectPath($project_id, 'access_tokens/' . $token_id)); + return $this->delete($this->getProjectPath($project_id, 'access_tokens/'.$token_id)); } /** @@ -1770,7 +1770,7 @@ public function deleteProjectAccessToken($project_id, $token_id) */ public function protectedTags($project_id) { - return $this->get('projects/' . self::encodePath($project_id) . '/protected_tags'); + return $this->get('projects/'.self::encodePath($project_id).'/protected_tags'); } /** @@ -1781,7 +1781,7 @@ public function protectedTags($project_id) */ public function protectedTag($project_id, string $tag_name) { - return $this->get('projects/' . self::encodePath($project_id) . '/protected_tags/' . self::encodePath($tag_name)); + return $this->get('projects/'.self::encodePath($project_id).'/protected_tags/'.self::encodePath($tag_name)); } /** @@ -1826,7 +1826,7 @@ public function addProtectedTag($project_id, array $parameters = []) */ public function deleteProtectedTag($project_id, string $tag_name) { - return $this->delete($this->getProjectPath($project_id, 'protected_tags/' . self::encodePath($tag_name))); + return $this->delete($this->getProjectPath($project_id, 'protected_tags/'.self::encodePath($tag_name))); } /** @@ -1878,6 +1878,6 @@ public function search($id, array $parameters = []) $resolver->setDefined('state') ->setAllowedValues('state', ['opened', 'closed']); - return $this->get('projects/' . self::encodePath($id) . '/search', $resolver->resolve($parameters)); + return $this->get('projects/'.self::encodePath($id).'/search', $resolver->resolve($parameters)); } } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index e3098421..e81c4511 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -1890,7 +1890,7 @@ public function shouldForkWithAllParametersNamespacePath(): void 'visibility' => 'public', 'mr_default_target_self' => 'true', ]; - + $api = $this->getApiMock(); $api->expects($this->once()) ->method('post')