diff --git a/lib/Github/Api/Environment.php b/lib/Github/Api/Environment.php index 057d1edf0d8..c154666daf3 100644 --- a/lib/Github/Api/Environment.php +++ b/lib/Github/Api/Environment.php @@ -36,7 +36,7 @@ public function all($username, $repository, array $params = []) */ public function show($username, $repository, $name) { - return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.$name); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.rawurlencode($name)); } /** @@ -53,7 +53,7 @@ public function show($username, $repository, $name) */ public function createOrUpdate($username, $repository, $name, array $params = []) { - return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments', $params); + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.rawurlencode($name), $params); } /** @@ -65,6 +65,6 @@ public function createOrUpdate($username, $repository, $name, array $params = [] */ public function remove(string $username, string $repository, string $name) { - return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.$name); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.rawurlencode($name)); } } diff --git a/test/Github/Tests/Api/EnvironmentTest.php b/test/Github/Tests/Api/EnvironmentTest.php index 56efbc0afc8..3b6f6f417fe 100644 --- a/test/Github/Tests/Api/EnvironmentTest.php +++ b/test/Github/Tests/Api/EnvironmentTest.php @@ -13,7 +13,7 @@ public function shouldCreateOrUpdateEnvironment() $api->expects($this->once()) ->method('put') - ->with('/repos/KnpLabs/php-github-api/environments'); + ->with('/repos/KnpLabs/php-github-api/environments/production'); $api->createOrUpdate('KnpLabs', 'php-github-api', 'production'); }