Skip to content

Commit 06e8922

Browse files
committed
Add trace to Project API
Get a trace of a specific build of a project
1 parent 231825c commit 06e8922

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/Gitlab/Api/Projects.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ public function build($project_id, $build_id)
149149
return $this->get($this->getProjectPath($project_id, 'builds/'.$this->encodePath($build_id)));
150150
}
151151

152+
/**
153+
* @param $project_id
154+
* @param $build_id
155+
* @return mixed
156+
*/
157+
public function trace($project_id, $build_id)
158+
{
159+
return $this->get($this->getProjectPath($project_id, 'builds/'.$this->encodePath($build_id).'/trace'));
160+
}
161+
152162
/**
153163
* @param int $project_id
154164
* @param string $username_query

test/Gitlab/Tests/Api/ProjectsTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,23 @@ public function shouldGetBuild()
254254

255255
$this->assertEquals($expectedArray, $api->build(1, 2));
256256
}
257+
258+
/**
259+
* @test
260+
*/
261+
public function shouldGetTrace()
262+
{
263+
$expectedString = 'runner trace of a specific build';
264+
265+
$api = $this->getApiMock();
266+
$api->expects($this->once())
267+
->method('get')
268+
->with('projects/1/builds/2/trace')
269+
->will($this->returnValue($expectedString))
270+
;
271+
272+
$this->assertEquals($expectedString, $api->trace(1, 2));
273+
}
257274

258275
/**
259276
* @test

0 commit comments

Comments
 (0)