Skip to content

Commit 6088676

Browse files
authored
[11.9] Add support for Projects::pipelineTestReport & Projects::pipelineTestReportSummary (#709)
* Add support for `Projects::pipelineTestReport` * Add support for `Projects::pipelineTestReportSummary`
1 parent 617d7b4 commit 6088676

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

src/Api/Projects.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,28 @@ public function pipelineVariables($project_id, int $pipeline_id)
437437
return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables'));
438438
}
439439

440+
/**
441+
* @param int|string $project_id
442+
* @param int $pipeline_id
443+
*
444+
* @return mixed
445+
*/
446+
public function pipelineTestReport($project_id, int $pipeline_id)
447+
{
448+
return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report'));
449+
}
450+
451+
/**
452+
* @param int|string $project_id
453+
* @param int $pipeline_id
454+
*
455+
* @return mixed
456+
*/
457+
public function pipelineTestReportSummary($project_id, int $pipeline_id)
458+
{
459+
return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary'));
460+
}
461+
440462
/**
441463
* @param int|string $project_id
442464
* @param string $commit_ref

tests/Api/ProjectsTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,54 @@ public function shouldGetPipelineVariables(): void
847847
$this->assertEquals($expectedArray, $api->pipelineVariables(1, 3));
848848
}
849849

850+
/**
851+
* @test
852+
*/
853+
public function shouldGetPipelineTestReport(): void
854+
{
855+
$expectedArray = [
856+
'total_time' => 0.011809,
857+
'total_count' => 8,
858+
'success_count' => 8,
859+
'failed_count' => 0,
860+
'skipped_count' => 0,
861+
'error_count' => 0,
862+
'test_suites' => [],
863+
];
864+
865+
$api = $this->getApiMock();
866+
$api->expects($this->once())
867+
->method('get')
868+
->with('projects/1/pipelines/3/test_report')
869+
->will($this->returnValue($expectedArray));
870+
871+
$this->assertEquals($expectedArray, $api->pipelineTestReport(1, 3));
872+
}
873+
874+
/**
875+
* @test
876+
*/
877+
public function shouldGetPipelineTestReportSummary(): void
878+
{
879+
$expectedArray = [
880+
'total_time' => 0.011809,
881+
'total_count' => 8,
882+
'success_count' => 8,
883+
'failed_count' => 0,
884+
'skipped_count' => 0,
885+
'error_count' => 0,
886+
'test_suites' => [],
887+
];
888+
889+
$api = $this->getApiMock();
890+
$api->expects($this->once())
891+
->method('get')
892+
->with('projects/1/pipelines/3/test_report_summary')
893+
->will($this->returnValue($expectedArray));
894+
895+
$this->assertEquals($expectedArray, $api->pipelineTestReportSummary(1, 3));
896+
}
897+
850898
/**
851899
* @test
852900
*/

0 commit comments

Comments
 (0)