Skip to content

Commit 76eccf5

Browse files
committed
minor #208 Fix phpunit deprecation (alamirault)
This PR was merged into the master branch. Discussion ---------- Fix phpunit deprecation Fix phpunit deprecations ``` root@4a1e0c585181:/var/www/html# ./vendor/bin/phpunit PHPUnit 9.5.20 #StandWithUkraine .........W..W.................................................. 63 / 169 ( 37%) ............................................................... 126 / 169 ( 74%) ........................................... 169 / 169 (100%) Time: 00:15.272, Memory: 40.50 MB There were 2 warnings: 1) App\Tests\Api\Status\GitHubStatusApiTest::testSetIssueStatusRemovesExcessStatuses The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked. 2) App\Tests\Api\Status\GitHubStatusApiTest::testSetIssueStatusRemovesUnconfirmedWhenBugIsReviewed The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked. ``` Commits ------- 7a26f8c Fix phpunit deprecation
2 parents 790e3f9 + 7a26f8c commit 76eccf5

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/Api/Status/GitHubStatusApiTest.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,19 @@ public function testSetIssueStatusWithoutPreviousStatus()
8787

8888
public function testSetIssueStatusRemovesExcessStatuses()
8989
{
90-
$this->labelsApi->expects($this->at(0))
90+
$this->labelsApi->expects(self::once())
9191
->method('getIssueLabels')
9292
->with(1234)
9393
->willReturn(['Bug', 'Status: Needs Review', 'Status: Needs Work']);
9494

95-
$this->labelsApi->expects($this->at(1))
95+
$this->labelsApi->expects($this->exactly(2))
9696
->method('removeIssueLabel')
97-
->with(1234, 'Status: Needs Review');
98-
99-
$this->labelsApi->expects($this->at(2))
100-
->method('removeIssueLabel')
101-
->with(1234, 'Status: Needs Work');
97+
->withConsecutive(
98+
[1234, 'Status: Needs Review'],
99+
[1234, 'Status: Needs Work']
100+
);
102101

103-
$this->labelsApi->expects($this->at(3))
102+
$this->labelsApi->expects($this->once())
104103
->method('addIssueLabel')
105104
->with(1234, 'Status: Reviewed');
106105

@@ -147,13 +146,12 @@ public function testSetIssueStatusRemovesUnconfirmedWhenBugIsReviewed()
147146
->with(1234)
148147
->willReturn(['Bug', 'Status: Needs Review', 'Unconfirmed']);
149148

150-
$this->labelsApi->expects($this->at(1))
151-
->method('removeIssueLabel')
152-
->with(1234, 'Status: Needs Review');
153-
154-
$this->labelsApi->expects($this->at(2))
149+
$this->labelsApi->expects($this->exactly(2))
155150
->method('removeIssueLabel')
156-
->with(1234, 'Unconfirmed');
151+
->withConsecutive(
152+
[1234, 'Status: Needs Review'],
153+
[1234, 'Unconfirmed']
154+
);
157155

158156
$this->labelsApi->expects($this->once())
159157
->method('addIssueLabel')

0 commit comments

Comments
 (0)