Skip to content

Commit

Permalink
Update tests to check the twig_symfony mailer config
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Jun 25, 2024
1 parent ae4ce46 commit 4ef57b3
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/DependencyInjection/FOSUserExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ public function testDisableRegistration()
$loader->load([$config], $this->configuration);
$this->assertNotHasDefinition('fos_user.registration.form.factory');

$mailer = $this->configuration->getDefinition('fos_user.mailer.twig_swift');
$mailer = $this->configuration->getDefinition('fos_user.mailer.twig_symfony');
$parameters = $this->configuration->getParameterBag()->resolveValue(
$mailer->getArgument(3)
);
$this->assertSame(
[
'confirmation' => ['[email protected]' => 'Acme Ltd'],
'resetting' => ['[email protected]' => 'Acme Corp'],
'confirmation' => ['address' => '[email protected]', 'sender_name' => 'Acme Ltd'],
'resetting' => ['address' => '[email protected]', 'sender_name' => 'Acme Corp'],
],
$parameters['from_email']
);
Expand All @@ -122,14 +122,14 @@ public function testDisableResetting()
$loader->load([$config], $this->configuration);
$this->assertNotHasDefinition('fos_user.resetting.form.factory');

$mailer = $this->configuration->getDefinition('fos_user.mailer.twig_swift');
$mailer = $this->configuration->getDefinition('fos_user.mailer.twig_symfony');
$parameters = $this->configuration->getParameterBag()->resolveValue(
$mailer->getArgument(3)
);
$this->assertSame(
[
'confirmation' => ['[email protected]' => 'Acme Corp'],
'resetting' => ['[email protected]' => 'Acme Ltd'],
'confirmation' => ['address' => '[email protected]', 'sender_name' => 'Acme Corp'],
'resetting' => ['address' => '[email protected]', 'sender_name' => 'Acme Ltd'],
],
$parameters['from_email']
);
Expand Down Expand Up @@ -166,8 +166,8 @@ public function testEmailsDisabledFeature($testConfig, $registration, $resetting
$config = array_merge($config, $testConfig);
$loader->load([$config], $this->configuration);

$this->assertParameter($registration, 'fos_user.registration.confirmation.from_email');
$this->assertParameter($resetting, 'fos_user.resetting.email.from_email');
$this->assertParameter($registration, 'fos_user.registration.confirmation.from_address');
$this->assertParameter($resetting, 'fos_user.resetting.email.from_address');
}

public function providerEmailsDisabledFeature()
Expand All @@ -190,13 +190,13 @@ public function providerEmailsDisabledFeature()
],
];

$default = ['[email protected]' => 'Acme Corp'];
$overriden = ['[email protected]' => 'Acme Ltd'];
$default = ['address' => '[email protected]', 'sender_name' => 'Acme Corp'];
$overriden = ['address' => '[email protected]', 'sender_name' => 'Acme Ltd'];

return [
[$configBothFeaturesDisabled, ['[email protected]' => 'Acme Ltd'], ['[email protected]' => 'Acme Ltd']],
[$configResettingDisabled, $default, ['[email protected]' => 'Acme Ltd']],
[$configRegistrationDisabled, ['[email protected]' => 'Acme Ltd'], $default],
[$configBothFeaturesDisabled, ['address' => '[email protected]', 'sender_name' => 'Acme Ltd'], ['address' => '[email protected]', 'sender_name' => 'Acme Ltd']],
[$configResettingDisabled, $default, ['address' => '[email protected]', 'sender_name' => 'Acme Ltd']],
[$configRegistrationDisabled, ['address' => '[email protected]', 'sender_name' => 'Acme Ltd'], $default],
[$configOverridenRegistrationEmail, $overriden, $default],
[$configOverridenResettingEmail, $default, $overriden],
];
Expand Down Expand Up @@ -289,10 +289,10 @@ public function testUserLoadConfirmationEmailWithDefaults()
$this->createEmptyConfiguration();

$this->assertParameter(false, 'fos_user.registration.confirmation.enabled');
$this->assertParameter(['[email protected]' => 'Acme Corp'], 'fos_user.registration.confirmation.from_email');
$this->assertParameter(['address' => '[email protected]', 'sender_name' => 'Acme Corp'], 'fos_user.registration.confirmation.from_address');
$this->assertParameter('@FOSUser/Registration/email.txt.twig', 'fos_user.registration.confirmation.template');
$this->assertParameter('@FOSUser/Resetting/email.txt.twig', 'fos_user.resetting.email.template');
$this->assertParameter(['[email protected]' => 'Acme Corp'], 'fos_user.resetting.email.from_email');
$this->assertParameter(['address' => '[email protected]', 'sender_name' => 'Acme Corp'], 'fos_user.resetting.email.from_address');
$this->assertParameter(86400, 'fos_user.resetting.token_ttl');
}

Expand All @@ -301,10 +301,10 @@ public function testUserLoadConfirmationEmail()
$this->createFullConfiguration();

$this->assertParameter(true, 'fos_user.registration.confirmation.enabled');
$this->assertParameter(['[email protected]' => 'Acme Corp'], 'fos_user.registration.confirmation.from_email');
$this->assertParameter(['address' => '[email protected]', 'sender_name' => 'Acme Corp'], 'fos_user.registration.confirmation.from_address');
$this->assertParameter('AcmeMyBundle:Registration:mail.txt.twig', 'fos_user.registration.confirmation.template');
$this->assertParameter('AcmeMyBundle:Resetting:mail.txt.twig', 'fos_user.resetting.email.template');
$this->assertParameter(['[email protected]' => 'Acme Corp'], 'fos_user.resetting.email.from_email');
$this->assertParameter(['address' => '[email protected]', 'sender_name' => 'Acme Corp'], 'fos_user.resetting.email.from_address');
$this->assertParameter(7200, 'fos_user.resetting.retry_ttl');
}

Expand Down

0 comments on commit 4ef57b3

Please sign in to comment.