Skip to content

Commit 6d47056

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Tests] Remove occurrences of `withConsecutive()` Fix support binary values in parameters. [Dotenv] Improve Dotenv::usePutenv phpdoc
2 parents 210fc3f + 428c849 commit 6d47056

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,15 @@ public function testFailurePathFromRequestWithInvalidUrl()
197197

198198
$this->logger->expects($this->exactly(2))
199199
->method('debug')
200-
->withConsecutive(
201-
['Ignoring query parameter "_my_failure_path": not a valid URL.'],
202-
['Authentication failure, redirect triggered.', ['failure_path' => '/login']]
203-
);
200+
->willReturnCallback(function (...$args) {
201+
static $series = [
202+
['Ignoring query parameter "_my_failure_path": not a valid URL.', []],
203+
['Authentication failure, redirect triggered.', ['failure_path' => '/login']],
204+
];
205+
206+
$expectedArgs = array_shift($series);
207+
$this->assertSame($expectedArgs, $args);
208+
});
204209

205210
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel, $this->httpUtils, $options, $this->logger);
206211

Tests/LoginLink/LoginLinkHandlerTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests\LoginLink;
1313

14+
use PHPUnit\Framework\Constraint\Constraint;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617
use Psr\Cache\CacheItemPoolInterface;
@@ -80,9 +81,22 @@ public function testCreateLoginLink($user, array $extraProperties, Request $requ
8081
->method('getContext')
8182
->willReturn($currentRequestContext = new RequestContext());
8283

84+
$series = [
85+
$this->equalTo((new RequestContext())->fromRequest($request)->setParameter('_locale', $request->getLocale())),
86+
$currentRequestContext,
87+
];
88+
8389
$this->router->expects($this->exactly(2))
8490
->method('setContext')
85-
->withConsecutive([$this->equalTo((new RequestContext())->fromRequest($request)->setParameter('_locale', $request->getLocale()))], [$currentRequestContext]);
91+
->willReturnCallback(function (RequestContext $context) use (&$series) {
92+
$expectedContext = array_shift($series);
93+
94+
if ($expectedContext instanceof Constraint) {
95+
$expectedContext->evaluate($context);
96+
} else {
97+
$this->assertSame($expectedContext, $context);
98+
}
99+
});
86100
}
87101

88102
$loginLink = $this->createLinker([], array_keys($extraProperties))->createLoginLink($user, $request);

0 commit comments

Comments
 (0)