From 5306dbd8e5382771c7273051834597bb027afa13 Mon Sep 17 00:00:00 2001 From: Jan Fejtek Date: Wed, 7 Jun 2023 23:51:44 +0200 Subject: [PATCH 1/3] Update Environments.php --- src/Api/Environments.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Api/Environments.php b/src/Api/Environments.php index 9f01cdf6..09cd632b 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -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 @@ -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)); } From d97efe10f0ab3183baa3c37bb4c5357124010342 Mon Sep 17 00:00:00 2001 From: Jan Fejtek Date: Thu, 8 Jun 2023 00:22:18 +0200 Subject: [PATCH 2/3] Added test --- tests/Api/EnvironmentsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index b21cb443..38bf2612 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -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(); From 067061ede87032510bd449f4359e702aa0be0a79 Mon Sep 17 00:00:00 2001 From: Jan Fejtek Date: Thu, 8 Jun 2023 00:23:04 +0200 Subject: [PATCH 3/3] Update EnvironmentsTest.php --- tests/Api/EnvironmentsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index 38bf2612..03dec459 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -155,14 +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' + 'tier' => 'production', ], ]; $params = [ 'name' => 'review/fix-baz', 'external_url' => 'https://review-fix-baz-dfjre5.example.gitlab.com', - 'tier' => 'production' + 'tier' => 'production', ]; $api = $this->getApiMock();