diff --git a/CHANGELOG.md b/CHANGELOG.md index b63d5419..4e903b8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.7.1] - 2022-04-24 + +* Fixed `GroupsEpic::all()` method +* Fixed `Projects::createPipeline()` method + ## [11.7.0] - 2022-01-24 * Dropped PHP 7.2 and 7.3 support diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 70f899ad..5c81d6fd 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -103,10 +103,11 @@ protected function get(string $uri, array $params = [], array $headers = []) * @param array $params * @param array $headers * @param array $files + * @param array $uriParams * * @return mixed */ - protected function post(string $uri, array $params = [], array $headers = [], array $files = []) + protected function post(string $uri, array $params = [], array $headers = [], array $files = [], array $uriParams = []) { if (0 < \count($files)) { $builder = $this->createMultipartStreamBuilder($params, $files); @@ -120,7 +121,7 @@ protected function post(string $uri, array $params = [], array $headers = [], ar } } - $response = $this->client->getHttpClient()->post(self::prepareUri($uri), $headers, $body); + $response = $this->client->getHttpClient()->post(self::prepareUri($uri, $uriParams), $headers, $body); return ResponseMediator::getContent($response); } diff --git a/src/Api/GroupsEpics.php b/src/Api/GroupsEpics.php index e66e9730..b6ab2cdc 100644 --- a/src/Api/GroupsEpics.php +++ b/src/Api/GroupsEpics.php @@ -19,7 +19,12 @@ class GroupsEpics extends AbstractApi /** * @var string */ - public const STATE_ACTIVE = 'active'; + public const STATE_ALL = 'all'; + + /** + * @var string + */ + public const STATE_OPENED = 'opened'; /** * @var string @@ -47,7 +52,7 @@ public function all($group_id, array $parameters = []) }) ; $resolver->setDefined('state') - ->setAllowedValues('state', [self::STATE_ACTIVE, self::STATE_CLOSED]) + ->setAllowedValues('state', [self::STATE_ALL, self::STATE_OPENED, self::STATE_CLOSED]) ; $resolver->setDefined('search'); diff --git a/src/Api/Projects.php b/src/Api/Projects.php index fe067dd6..e824cc2f 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -421,15 +421,15 @@ public function pipelineVariables($project_id, int $pipeline_id) */ public function createPipeline($project_id, string $commit_ref, array $variables = null) { - $parameters = [ - 'ref' => $commit_ref, - ]; + $parameters = []; if (null !== $variables) { $parameters['variables'] = $variables; } - return $this->post($this->getProjectPath($project_id, 'pipeline'), $parameters); + return $this->post($this->getProjectPath($project_id, 'pipeline'), $parameters, [], [], [ + 'ref' => $commit_ref, + ]); } /** diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 200de417..113c69c9 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -839,7 +839,7 @@ public function shouldCreatePipeline(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('projects/1/pipeline', ['ref' => 'test-pipeline']) + ->with('projects/1/pipeline', [], [], [], ['ref' => 'test-pipeline']) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline')); @@ -868,7 +868,7 @@ public function shouldCreatePipelineWithVariables(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('projects/1/pipeline', ['ref' => 'test-pipeline', 'variables' => $variables]) + ->with('projects/1/pipeline', ['variables' => $variables], [], [], ['ref' => 'test-pipeline']) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline', $variables)); diff --git a/tests/HttpClient/Message/ResponseMediatorTest.php b/tests/HttpClient/Message/ResponseMediatorTest.php index 4596ee24..7266ecfa 100644 --- a/tests/HttpClient/Message/ResponseMediatorTest.php +++ b/tests/HttpClient/Message/ResponseMediatorTest.php @@ -75,12 +75,7 @@ public function testGetErrrorMessageInvalidJson(): void public function testGetPagination(): void { - $header = <<<'TEXT' -; rel="first", -; rel="next", -; rel="prev", -; rel="last", -TEXT; + $header = '; rel="first",; rel="next",; rel="prev",; rel="last"'; $pagination = [ 'first' => 'https://example.gitlab.com/', diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 910aeaa3..e095c4ea 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -26,7 +26,7 @@ public function testRepoContributors(): void $response = $client ->repositories() - ->contributors(5315609); + ->contributors(16155465); $this->assertIsArray($response); $this->assertTrue(isset($response[2]));