Skip to content

Commit

Permalink
[11.11] Add support for tier in Environments::create (GitLabPHP#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
janfejtek authored Jul 17, 2023
1 parent 9f630a1 commit f80b572
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Api/Environments.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function all($project_id, array $parameters = [])
*
* @var string $name The name of the environment
* @var string $external_url Place to link to for this environment
* @var string $tier The tier of the new environment. Allowed values are production, staging, testing, development, and other.
* }
*
* @return mixed
Expand All @@ -56,6 +57,8 @@ public function create($project_id, array $parameters = [])
->setAllowedTypes('name', 'string');
$resolver->setDefined('external_url')
->setAllowedTypes('external_url', 'string');
$resolver->setDefined('tier')
->setAllowedValues('tier', ['production', 'staging', 'testing', 'development', 'other']);

return $this->post($this->getProjectPath($project_id, 'environments'), $resolver->resolve($parameters));
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Api/EnvironmentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ public function shouldCreateEnvironment(): void
'name' => 'review/fix-baz',
'slug' => 'review-fix-baz-dfjre5',
'external_url' => 'https://review-fix-baz-dfjre5.example.gitlab.com',
'tier' => 'production',
],
];

$params = [
'name' => 'review/fix-baz',
'external_url' => 'https://review-fix-baz-dfjre5.example.gitlab.com',
'tier' => 'production',
];

$api = $this->getApiMock();
Expand Down

0 comments on commit f80b572

Please sign in to comment.