Skip to content

Commit 32b6011

Browse files
authored
[make:registration-form] render the raw signedUrl in the email template (#1217)
1 parent 14de6f8 commit 32b6011

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/Resources/skeleton/registration/twig_email.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<p>
44
Please confirm your email address by clicking the following link: <br><br>
5-
<a href="{{ signedUrl }}">Confirm my Email</a>.
5+
<a href="{{ signedUrl|raw }}">Confirm my Email</a>.
66
This link will expire in {{ expiresAtMessageKey|trans(expiresAtMessageData, 'VerifyEmailBundle') }}.
77
</p>
88

tests/Maker/MakeRegistrationFormTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function getTestDetails(): \Generator
135135
'[email protected]', // from email address
136136
'SymfonyCasts', // From Name
137137
'n', // no authenticate after
138-
0, // route number to redirect to
138+
'app_anonymous', // route number to redirect to
139139
]);
140140

141141
$this->assertStringContainsString('Success', $output);
@@ -174,7 +174,7 @@ public function getTestDetails(): \Generator
174174
'[email protected]', // from email address
175175
'SymfonyCasts', // From Name
176176
'n', // no authenticate after
177-
0, // route number to redirect to
177+
'app_anonymous', // route number to redirect to
178178
]);
179179

180180
$this->assertStringContainsString('Success', $output);

tests/fixtures/make-registration-form/tests/it_generates_registration_form_with_verification.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public function testRegistrationSuccessful()
1919

2020
$client->submit($form);
2121

22-
$messages = $this->getMailerMessages();
23-
self::assertCount(1, $messages);
22+
self::assertEmailCount(1);
2423

2524
/** @var EntityManager $em */
2625
$em = self::$kernel->getContainer()
@@ -32,9 +31,12 @@ public function testRegistrationSuccessful()
3231

3332
self::assertFalse(($query->getSingleResult())->isVerified());
3433

35-
$context = $messages[0]->getContext();
34+
$messageBody = self::getMailerMessage()->getHtmlBody();
3635

37-
$client->request('GET', $context['signedUrl']);
36+
// Group "1" contains just the signed url from the email
37+
preg_match('/(http.*)(")/', $messageBody, $signedUrl);
38+
39+
$client->request('GET', $signedUrl[1]);
3840

3941
self::assertTrue(($query->getSingleResult())->isVerified());
4042
}

0 commit comments

Comments
 (0)