Skip to content

Commit 5e087d7

Browse files
committed
Fix some escaped mutants around response code expectations
Signed-off-by: George Steel <[email protected]>
1 parent 3097404 commit 5e087d7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

test/unit/Github/Api/V3/CreatePullRequestTest.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,30 @@ protected function setUp(): void
4545
);
4646
}
4747

48-
public function testSuccessfulRequest(): void
48+
/** @return array<string, array{0: int<200, 299>}> */
49+
public static function successCodes(): array
50+
{
51+
return [
52+
'min' => [200],
53+
'mid' => [250],
54+
'max' => [299],
55+
];
56+
}
57+
58+
/**
59+
* @param int<200, 299> $responseCode
60+
*
61+
* @dataProvider successCodes
62+
*/
63+
public function testSuccessfulRequest(int $responseCode): void
4964
{
5065
$this->messageFactory
5166
->expects(self::any())
5267
->method('createRequest')
5368
->with('POST', 'https://api.github.com/repos/foo/bar/pulls')
5469
->willReturn(new Request('https://the-domain.com/the-path'));
5570

56-
$validResponse = new Response();
71+
$validResponse = (new Response())->withStatus($responseCode);
5772

5873
$validResponse->getBody()->write(
5974
<<<'JSON'

test/unit/Github/Api/V3/SetDefaultBranchThroughApiCallTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function exampleValidResponseCodes(): array
9898
[200],
9999
[201],
100100
[204],
101+
[299],
101102
];
102103
}
103104

0 commit comments

Comments
 (0)