Skip to content

Commit c07fa69

Browse files
gilmiriamm1guelpf
authored andcommitted
add showAll for schedules
1 parent d24b8b3 commit c07fa69

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/Gitlab/Api/Schedules.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ public function show($project_id, $schedule_id)
2424
return $this->get($this->getProjectPath($project_id, 'pipeline_schedules/'.$this->encodePath($schedule_id)));
2525
}
2626

27+
/**
28+
* @param int $project_id
29+
* @return mixed
30+
*/
31+
public function showAll($project_id)
32+
{
33+
return $this->get($this->getProjectPath($project_id, 'pipeline_schedules'));
34+
}
35+
2736
/**
2837
* @param int $project_id
2938
* @param int $schedule_id

test/Gitlab/Tests/Api/ScheduleTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ public function shouldShowSchedule()
7070
$this->assertEquals($expectedArray, $api->show(1, 2));
7171
}
7272

73+
/**
74+
* @test
75+
*/
76+
public function shouldShowAllSchedule()
77+
{
78+
$expectedArray = array('id' => 1, 'name' => 'A schedule');
79+
80+
$api = $this->getApiMock();
81+
$api->expects($this->once())
82+
->method('get')
83+
->with('projects/1/pipeline_schedules')
84+
->will($this->returnValue($expectedArray))
85+
;
86+
87+
$this->assertEquals($expectedArray, $api->showAll(1));
88+
}
89+
7390
/**
7491
* @test
7592
*/

0 commit comments

Comments
 (0)