Skip to content

Commit

Permalink
minor #49621 [Tests] Remove occurrences of withConsecutive() (alexa…
Browse files Browse the repository at this point in the history
…ndre-daubois)

This PR was merged into the 5.4 branch.

Discussion
----------

[Tests] Remove occurrences of `withConsecutive()`

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

`withConsecutive()` has been deprecated in PHPUnit 9.6 and removed in PHP 10 (sebastianbergmann/phpunit#4564). This PR aims at starting the work to remove these occurrences. There is unfortunately no given migration path, and this requires manual work.

I'll create a meta issue referencing remaining occurrences if this one's merged, to keep track. Some seems pretty hard to remove.

cc `@OskarStark` this might interest you, as we worked a lot on tests lately 😄

Commits
-------

2047763649 [Tests] Remove occurrences of `withConsecutive()`
  • Loading branch information
nicolas-grekas committed Mar 10, 2023
2 parents 7e9e8d0 + 9d7018b commit c63f733
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,18 @@ public function testReadWithValidateIdMismatch()
{
$handler = $this->createMock(\SessionHandlerInterface::class);
$handler->expects($this->exactly(2))->method('read')
->withConsecutive(['id1'], ['id2'])
->will($this->onConsecutiveCalls('data1', 'data2'));
->willReturnCallback(function (...$args) {
static $series = [
[['id1'], 'data1'],
[['id2'], 'data2'],
];

[$expectedArgs, $return] = array_shift($series);
$this->assertSame($expectedArgs, $args);

return $return;
})
;
$proxy = new StrictSessionHandler($handler);

$this->assertTrue($proxy->validateId('id1'));
Expand Down

0 comments on commit c63f733

Please sign in to comment.