Skip to content

Commit 36eddff

Browse files
minor #49621 [Tests] Remove occurrences of withConsecutive() (alexandre-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()`
2 parents 9455c2a + d9c75e3 commit 36eddff

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Tests/CacheWarmer/ExpressionCacheWarmerTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bundle\SecurityBundle\CacheWarmer\ExpressionCacheWarmer;
1616
use Symfony\Component\ExpressionLanguage\Expression;
17+
use Symfony\Component\ExpressionLanguage\ParsedExpression;
1718
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
1819

1920
class ExpressionCacheWarmerTest extends TestCase
@@ -22,13 +23,21 @@ public function testWarmUp()
2223
{
2324
$expressions = [new Expression('A'), new Expression('B')];
2425

26+
$series = [
27+
[$expressions[0], ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']],
28+
[$expressions[1], ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']],
29+
];
30+
2531
$expressionLang = $this->createMock(ExpressionLanguage::class);
2632
$expressionLang->expects($this->exactly(2))
2733
->method('parse')
28-
->withConsecutive(
29-
[$expressions[0], ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']],
30-
[$expressions[1], ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']]
31-
);
34+
->willReturnCallback(function (...$args) use (&$series) {
35+
$expectedArgs = array_shift($series);
36+
$this->assertSame($expectedArgs, $args);
37+
38+
return $this->createMock(ParsedExpression::class);
39+
})
40+
;
3241

3342
(new ExpressionCacheWarmer($expressions, $expressionLang))->warmUp('');
3443
}

0 commit comments

Comments
 (0)