-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6093179
commit ef86740
Showing
16 changed files
with
65 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ class UserDefinedFormControllerTest extends FunctionalTest | |
|
||
protected static $disable_themes = true; | ||
|
||
protected function setUp() | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
|
@@ -49,7 +49,7 @@ protected function setUp() | |
Config::modify()->merge(SSViewer::class, 'themes', ['simple', '$default']); | ||
} | ||
|
||
public function tearDown() | ||
protected function tearDown(): void | ||
{ | ||
TestAssetStore::reset(); | ||
parent::tearDown(); | ||
|
@@ -105,11 +105,11 @@ public function testProcess() | |
$this->assertEmailSent('[email protected]', '[email protected]', 'Email Subject'); | ||
$nohtml = $this->findEmail('[email protected]', '[email protected]', 'Email Subject'); | ||
|
||
$this->assertContains('Basic Text Field: Basic Value', $nohtml['Content'], 'Email contains no html'); | ||
$this->assertStringContainsString('Basic Text Field: Basic Value', $nohtml['Content'], 'Email contains no html'); | ||
|
||
// submitted html tags are not escaped because the email is being sent as text/plain | ||
$value = 'My body text Basic Value <b>HTML</b>'; | ||
$this->assertContains($value, $nohtml['Content'], 'Email contains the merge field value'); | ||
$this->assertStringContainsString($value, $nohtml['Content'], 'Email contains the merge field value'); | ||
|
||
// no data | ||
$this->assertEmailSent('[email protected]', '[email protected]', 'Email Subject'); | ||
|
@@ -123,7 +123,7 @@ public function testProcess() | |
// check to see if the user was redirected (301) | ||
$this->assertEquals($response->getStatusCode(), 302); | ||
$location = $response->getHeader('Location'); | ||
$this->assertContains('finished', $location); | ||
$this->assertStringContainsString('finished', $location); | ||
$this->assertStringEndsWith('#uff', $location); | ||
|
||
// check that multiple email addresses are supported in to and from | ||
|
@@ -142,7 +142,7 @@ public function testValidation() | |
$this->get($form->URLSegment); | ||
/** @var HTTPResponse $response */ | ||
$response = $this->submitForm('UserForm_Form_' . $form->ID, null, []); | ||
$this->assertContains('This field is required', $response->getBody()); | ||
$this->assertStringContainsString('This field is required', $response->getBody()); | ||
|
||
// Post with all fields, but invalid email | ||
$this->get($form->URLSegment); | ||
|
@@ -151,15 +151,15 @@ public function testValidation() | |
'required-email' => 'invalid', | ||
'required-text' => 'bob' | ||
]); | ||
$this->assertContains('Please enter an email address', $response->getBody()); | ||
$this->assertStringContainsString('Please enter an email address', $response->getBody()); | ||
|
||
// Post with only required | ||
$this->get($form->URLSegment); | ||
/** @var HTTPResponse $response */ | ||
$response = $this->submitForm('UserForm_Form_' . $form->ID, null, [ | ||
'required-text' => 'bob' | ||
]); | ||
$this->assertContains("Thanks, we've received your submission.", $response->getBody()); | ||
$this->assertStringContainsString("Thanks, we've received your submission.", $response->getBody()); | ||
} | ||
|
||
public function testFinished() | ||
|
@@ -172,7 +172,7 @@ public function testFinished() | |
|
||
$response = $this->get($form->URLSegment.'/finished'); | ||
|
||
$this->assertContains($form->OnCompleteMessage, $response->getBody()); | ||
$this->assertStringContainsString($form->OnCompleteMessage, $response->getBody()); | ||
} | ||
|
||
public function testAppendingFinished() | ||
|
@@ -185,7 +185,7 @@ public function testAppendingFinished() | |
|
||
$response = $this->get($form->URLSegment.'/finished'); | ||
|
||
$this->assertNotContains($form->OnCompleteMessage, $response->getBody()); | ||
$this->assertStringNotContainsString($form->OnCompleteMessage, $response->getBody()); | ||
} | ||
|
||
public function testForm() | ||
|
@@ -320,7 +320,7 @@ public function testRenderingIntoTemplateWithDisabledInterpolation() | |
$parser = new CSSContentParser($html); | ||
|
||
// Assert Content has been rendered with the shortcode in place | ||
$this->assertContains('<p>Here is my form</p><p>$UserDefinedForm</p><p>Thank you for filling it out</p>', $html); | ||
$this->assertStringContainsString('<p>Here is my form</p><p>$UserDefinedForm</p><p>Thank you for filling it out</p>', $html); | ||
// And the form in the $From area | ||
$this->assertArrayHasKey(0, $parser->getBySelector('form#UserForm_Form_' . $form->ID)); | ||
// check for the input | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,21 +20,19 @@ public function testShortcodesAreRenderedInEmailPreviewContent() | |
$recipient->EmailBodyHtml = '<p>Some email content. About us: [sitetree_link,id=' . $page->ID . '].</p>'; | ||
|
||
$result = $recipient->getEmailBodyContent(); | ||
$this->assertContains('/about-us/', $result); | ||
$this->assertStringContainsString('/about-us/', $result); | ||
|
||
$recipient->SendPlain = true; | ||
$recipient->EmailBody = 'Some email content. About us: [sitetree_link,id=' . $page->ID . '].'; | ||
|
||
$result = $recipient->getEmailBodyContent(); | ||
$this->assertContains('/about-us/', $result); | ||
$this->assertStringContainsString('/about-us/', $result); | ||
} | ||
|
||
/** | ||
* @expectedException \SilverStripe\ORM\ValidationException | ||
* @expectedExceptionMessage "Send email to" address or field is required | ||
*/ | ||
public function testEmptyRecipientFailsValidation() | ||
{ | ||
$this->expectException(\SilverStripe\ORM\ValidationException::class); | ||
$this->expectExceptionMessage('"Send email to" address or field is required'); | ||
$recipient = new EmailRecipient(); | ||
$recipient->EmailFrom = '[email protected]'; | ||
$recipient->write(); | ||
|
Oops, something went wrong.