Skip to content

Commit

Permalink
EA-5554: Bug fix for responders
Browse files Browse the repository at this point in the history
  • Loading branch information
sleipi committed Nov 30, 2023
1 parent 522f005 commit b87b3d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Alert/CreateAlertRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getBody(): array
}

foreach ($this->alert->getResponders() as $responder) {
$body['responders'] = [
$body['responders'][] = [
'id' => $responder->getId(),
'type' => $responder->getType()
];
Expand Down
6 changes: 4 additions & 2 deletions tests/Alert/CreateAlertRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ public function testCanAppendResponder(): void
{
$alert = $this->createMock(Alert::class);
$alert->expects($this->atLeastOnce())->method('getResponders')->willReturn([
$this->createMock(Responder::class),
$this->createMock(Responder::class)
new Responder('foo', Responder::team),
new Responder('bar', Responder::user),
]);
$request = new CreateAlertRequest($alert);

$this->assertArrayHasKey('responders', $request->getBody());
$this->assertEquals(['id' => 'foo', 'type' => 'team'], $request->getBody()['responders'][0]);
$this->assertEquals(['id' => 'bar', 'type' => 'user'], $request->getBody()['responders'][1]);
}

public function testCanAppendTags(): void
Expand Down

0 comments on commit b87b3d1

Please sign in to comment.