mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 01:22:37 +00:00
Make unsetting the email pattern work as expected.
When set to `null`, only `filter_var()` should be used. This is a partial backport of #5111
This commit is contained in:
parent
c151ea585d
commit
f0b6657113
2 changed files with 27 additions and 5 deletions
|
@ -386,6 +386,25 @@ class CakeEmailTest extends CakeTestCase {
|
|||
), $this->CakeEmail->to());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that it is possible to unset the email pattern and make use of filter_var() instead.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @expectedException SocketException
|
||||
* @expectedExceptionMessage Invalid email: "fail.@example.com"
|
||||
*/
|
||||
public function testUnsetEmailPattern() {
|
||||
$email = new CakeEmail();
|
||||
$this->assertSame(CakeEmail::EMAIL_PATTERN, $email->emailPattern());
|
||||
|
||||
$email->emailPattern(null);
|
||||
$this->assertNull($email->emailPattern());
|
||||
|
||||
$email->to('pass@example.com');
|
||||
$email->to('fail.@example.com');
|
||||
}
|
||||
|
||||
/**
|
||||
* testFormatAddress method
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue