Skip to content

Commit c1c0483

Browse files
authored
[11.10] Add support for Project::removeTrigger (#744)
1 parent 0c0d270 commit c1c0483

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Api/Projects.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,17 @@ public function createTrigger($project_id, string $description)
283283
]);
284284
}
285285

286+
/**
287+
* @param int|string $project_id
288+
* @param int $trigger_id
289+
*
290+
* @return mixed
291+
*/
292+
public function removeTrigger($project_id, int $trigger_id)
293+
{
294+
return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id)));
295+
}
296+
286297
/**
287298
* @param int|string $project_id
288299
* @param string $ref

tests/Api/ProjectsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,22 @@ public function shouldCreateTrigger(): void
726726
$this->assertEquals($expectedArray, $api->createTrigger(1, 'foobar'));
727727
}
728728

729+
/**
730+
* @test
731+
*/
732+
public function shouldRemoveTrigger(): void
733+
{
734+
$expectedBool = true;
735+
736+
$api = $this->getApiMock();
737+
$api->expects($this->once())
738+
->method('delete')
739+
->with('projects/1/triggers/2')
740+
->will($this->returnValue($expectedBool));
741+
742+
$this->assertEquals($expectedBool, $api->removeTrigger(1, 2));
743+
}
744+
729745
/**
730746
* @test
731747
*/

0 commit comments

Comments
 (0)