From 5c471a404506428ad52f174d1f9614034c5b6c0b Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 14 Jan 2017 20:59:20 +0100 Subject: [PATCH 1/4] added method to get artifacts file --- .gitignore | 1 + lib/Gitlab/Api/Projects.php | 14 ++++++++++++-- test/Gitlab/Tests/Api/ProjectsTest.php | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d1502b087..3171e94ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vendor/ composer.lock +.idea/ \ No newline at end of file diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 52a40690a..27dc66eb8 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -126,7 +126,7 @@ public function remove($project_id) { return $this->delete('projects/'.$this->encodePath($project_id)); } - + /** * @param int $project_id * @return mixed @@ -134,7 +134,7 @@ public function remove($project_id) public function archive($project_id){ return $this->post("projects/".$this->encodePath($project_id)."/archive"); } - + /** * @param int $project_id * @return mixed @@ -165,6 +165,16 @@ public function build($project_id, $build_id) return $this->get($this->getProjectPath($project_id, 'builds/'.$this->encodePath($build_id))); } + /** + * @param $project_id + * @param $build_id + * @return mixed + */ + public function buildArtifacts($project_id, $build_id) + { + return $this->get($this->getProjectPath($project_id, 'builds/'.$this->encodePath($build_id).'/artifacts')); + } + /** * @param $project_id * @param $build_id diff --git a/test/Gitlab/Tests/Api/ProjectsTest.php b/test/Gitlab/Tests/Api/ProjectsTest.php index fb5a5ec33..ede1d53fc 100644 --- a/test/Gitlab/Tests/Api/ProjectsTest.php +++ b/test/Gitlab/Tests/Api/ProjectsTest.php @@ -289,6 +289,22 @@ public function shouldGetBuild() $this->assertEquals($expectedArray, $api->build(1, 2)); } + /** + * @test + */ + public function shouldGetBuildArtifacts(){ + $expectedArray = array(); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/builds/2/artifacts') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray,$api->buildArtifacts(1,2)); + } + /** * @test */ From c54645d9e5bfbc1565f38399de81fe5ce3700c8b Mon Sep 17 00:00:00 2001 From: Administrator Date: Tue, 17 Jan 2017 19:01:47 +0100 Subject: [PATCH 2/4] removed .idea from gitignore and format code --- .gitignore | 3 +-- test/Gitlab/Tests/Api/ProjectsTest.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3171e94ff..4f4acd356 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ vendor/ -composer.lock -.idea/ \ No newline at end of file +composer.lock \ No newline at end of file diff --git a/test/Gitlab/Tests/Api/ProjectsTest.php b/test/Gitlab/Tests/Api/ProjectsTest.php index ede1d53fc..c47aabd55 100644 --- a/test/Gitlab/Tests/Api/ProjectsTest.php +++ b/test/Gitlab/Tests/Api/ProjectsTest.php @@ -302,7 +302,7 @@ public function shouldGetBuildArtifacts(){ ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray,$api->buildArtifacts(1,2)); + $this->assertEquals($expectedArray,$api->buildArtifacts(1, 2)); } /** From 10fce1fd2e8510dcad3e64a7874c668b6c5db88e Mon Sep 17 00:00:00 2001 From: Radu Topala Date: Thu, 20 Apr 2017 09:26:14 +0300 Subject: [PATCH 3/4] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4f4acd356..48b8bf907 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ vendor/ -composer.lock \ No newline at end of file From 985a3b0772373e11b5937ff019b93260ad455c2a Mon Sep 17 00:00:00 2001 From: Radu Topala Date: Thu, 20 Apr 2017 09:28:00 +0300 Subject: [PATCH 4/4] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 48b8bf907..d1502b087 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ vendor/ +composer.lock