Skip to content

Commit 8168261

Browse files
authored
bug KnpLabs#1107 Bugfix creating env (Froxz)
This PR was squashed before being merged into the 3.10.x-dev branch. Discussion ---------- Commits ------- 22cbc82 Bugfix creating env ce974e1 fixed tests 8b365a3 added rawurlencode for $name
1 parent b335003 commit 8168261

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Github/Api/Environment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function all($username, $repository, array $params = [])
3636
*/
3737
public function show($username, $repository, $name)
3838
{
39-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.$name);
39+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.rawurlencode($name));
4040
}
4141

4242
/**
@@ -53,7 +53,7 @@ public function show($username, $repository, $name)
5353
*/
5454
public function createOrUpdate($username, $repository, $name, array $params = [])
5555
{
56-
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments', $params);
56+
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.rawurlencode($name), $params);
5757
}
5858

5959
/**
@@ -65,6 +65,6 @@ public function createOrUpdate($username, $repository, $name, array $params = []
6565
*/
6666
public function remove(string $username, string $repository, string $name)
6767
{
68-
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.$name);
68+
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/environments/'.rawurlencode($name));
6969
}
7070
}

test/Github/Tests/Api/EnvironmentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function shouldCreateOrUpdateEnvironment()
1313

1414
$api->expects($this->once())
1515
->method('put')
16-
->with('/repos/KnpLabs/php-github-api/environments');
16+
->with('/repos/KnpLabs/php-github-api/environments/production');
1717

1818
$api->createOrUpdate('KnpLabs', 'php-github-api', 'production');
1919
}

0 commit comments

Comments
 (0)