Skip to content

Commit a895195

Browse files
committed
Merge branch 'main' into 2.x
* main: minor #191 [ci] php-cs-fixer it up
2 parents 658e4fa + a88ba79 commit a895195

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tests/Acceptance/VerifyEmailAcceptanceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testGenerateSignature(): void
4343

4444
$expectedSignature = base64_encode(hash_hmac(
4545
'sha256',
46-
sprintf('http://localhost/verify/user?expires=%s&token=%s', $expiresAt, urlencode($expectedToken)),
46+
\sprintf('http://localhost/verify/user?expires=%s&token=%s', $expiresAt, urlencode($expectedToken)),
4747
'foo',
4848
true
4949
));
@@ -52,7 +52,7 @@ public function testGenerateSignature(): void
5252
parse_str($parsed['query'], $result); /** @phpstan-ignore-line offsetAccess.nonOffsetAccessible offset query always exists */
5353
self::assertTrue(hash_equals($expectedSignature, $result['signature'])); /** @phpstan-ignore-line argument.type */
5454
self::assertSame(
55-
sprintf('http://localhost/verify/user?expires=%s&signature=%s&token=%s', $expiresAt, urlencode($expectedSignature), urlencode($expectedToken)),
55+
\sprintf('http://localhost/verify/user?expires=%s&signature=%s&token=%s', $expiresAt, urlencode($expectedSignature), urlencode($expectedToken)),
5656
$signature
5757
);
5858
}
@@ -65,7 +65,7 @@ public function testValidateUsingRequestObject(): void
6565
$helper = $container->get(VerifyEmailAcceptanceFixture::class)->helper; /** @phpstan-ignore-line property.notFound */
6666
$expires = new \DateTimeImmutable('+1 hour');
6767

68-
$uriToTest = sprintf(
68+
$uriToTest = \sprintf(
6969
'http://localhost/verify/user?%s',
7070
http_build_query([
7171
'expires' => $expires->getTimestamp(),
@@ -80,7 +80,7 @@ public function testValidateUsingRequestObject(): void
8080

8181
$signature = base64_encode(hash_hmac('sha256', $uriToTest, 'foo', true));
8282

83-
$test = sprintf('%s&signature=%s', $uriToTest, urlencode($signature));
83+
$test = \sprintf('%s&signature=%s', $uriToTest, urlencode($signature));
8484

8585
$helper->validateEmailConfirmationFromRequest(Request::create(uri: $test), '1234', 'jr@rushlow.dev');
8686
$this->assertTrue(true, 'Test correctly does not throw an exception');

tests/Functional/VerifyEmailHelperFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testGenerateSignature(): void
4646
->expects($this->once())
4747
->method('generate')
4848
->with('app_verify_route', ['expires' => $this->expiryTimestamp, 'token' => $token])
49-
->willReturn(sprintf('/verify?expires=%s&token=%s', $this->expiryTimestamp, urlencode($token)))
49+
->willReturn(\sprintf('/verify?expires=%s&token=%s', $this->expiryTimestamp, urlencode($token)))
5050
;
5151

5252
$result = $this->getHelper()->generateSignature('app_verify_route', '1234', 'jr@rushlow.dev');
@@ -78,7 +78,7 @@ private function getTestToken(): string
7878
private function getTestSignature(): string
7979
{
8080
$query = http_build_query(['expires' => $this->expiryTimestamp, 'token' => $this->getTestToken()], '', '&');
81-
$uri = sprintf('/verify?%s', $query);
81+
$uri = \sprintf('/verify?%s', $query);
8282

8383
return base64_encode(hash_hmac('sha256', $uri, 'foo', true));
8484
}

tests/Unit/Model/VerifyEmailSignatureComponentsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testTranslations(int $lifetime, int $expectedInterval, string $u
4242
$components = new VerifyEmailSignatureComponents($expire, 'some-uri', $created);
4343

4444
self::assertSame(
45-
sprintf('%%count%% %s|%%count%% %ss', $unitOfMeasure, $unitOfMeasure),
45+
\sprintf('%%count%% %s|%%count%% %ss', $unitOfMeasure, $unitOfMeasure),
4646
$components->getExpirationMessageKey()
4747
);
4848

tests/Unit/VerifyEmailHelperTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testSignatureIsGenerated(): void
4747
{
4848
$expires = time() + 3600;
4949

50-
$expectedSignedUrl = sprintf('/verify?expires=%s&signature=1234&token=hashedToken', $expires);
50+
$expectedSignedUrl = \sprintf('/verify?expires=%s&signature=1234&token=hashedToken', $expires);
5151

5252
$this->tokenGenerator
5353
->expects($this->once())
@@ -60,13 +60,13 @@ public function testSignatureIsGenerated(): void
6060
->expects($this->once())
6161
->method('generate')
6262
->with('app_verify_route', ['token' => 'hashedToken', 'expires' => $expires])
63-
->willReturn(sprintf('/verify?expires=%s&token=hashedToken', $expires))
63+
->willReturn(\sprintf('/verify?expires=%s&token=hashedToken', $expires))
6464
;
6565

6666
$this->mockSigner
6767
->expects($this->once())
6868
->method('sign')
69-
->with(sprintf('/verify?expires=%s&token=hashedToken', $expires))
69+
->with(\sprintf('/verify?expires=%s&token=hashedToken', $expires))
7070
->willReturn($expectedSignedUrl)
7171
;
7272

0 commit comments

Comments
 (0)