Skip to content

Commit c0d04e6

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

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;
@@ -79,9 +80,22 @@ public function testCreateLoginLink($user, array $extraProperties, Request $requ
7980
->method('getContext')
8081
->willReturn($currentRequestContext = new RequestContext());
8182

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

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

0 commit comments

Comments
 (0)