mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
FIX Tests for email templates and whether they exist or not
This commit is contained in:
parent
298441b50b
commit
faf04bff43
@ -499,7 +499,7 @@ class EmailRecipient extends DataObject
|
||||
{
|
||||
$t = ($template ? $template : $this->EmailTemplate);
|
||||
|
||||
return in_array($t, $this->getEmailTemplateDropdownValues());
|
||||
return array_key_exists($t, $this->getEmailTemplateDropdownValues());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -543,10 +543,13 @@ class EmailRecipient extends DataObject
|
||||
strlen(BASE_PATH) + 1
|
||||
);
|
||||
|
||||
$defaultPrefix = 'userforms/templates/';
|
||||
$defaultPrefixes = ['userforms/templates/', 'templates/'];
|
||||
foreach ($defaultPrefixes as $defaultPrefix) {
|
||||
// Remove default userforms folder if it's provided
|
||||
if (substr($templatePath, 0, strlen($defaultPrefix)) === $defaultPrefix) {
|
||||
$templatePath = substr($templatePath, strlen($defaultPrefix));
|
||||
break;
|
||||
}
|
||||
}
|
||||
$templates[$templatePath] = $template['filename'];
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class UserDefinedFormTest extends FunctionalTest
|
||||
{
|
||||
$recipient = new EmailRecipient();
|
||||
|
||||
$defaultValues = ['SubmittedFormEmail' => 'SubmittedFormEmail'];
|
||||
$defaultValues = ['email/SubmittedFormEmail' => 'SubmittedFormEmail'];
|
||||
|
||||
$this->assertEquals($recipient->getEmailTemplateDropdownValues(), $defaultValues);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user