mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This adds an assertion to confirm that `is_email()` considers email addresses with a `+` valid. Props SergeyBiryukov, ayeshrajans. Fixes #53130. git-svn-id: https://develop.svn.wordpress.org/trunk@50812 602fd350-edb4-49c9-b593-d223f7449a82
35 lines
765 B
PHP
35 lines
765 B
PHP
<?php
|
|
|
|
/**
|
|
* @group formatting
|
|
*/
|
|
class Tests_Formatting_IsEmail extends WP_UnitTestCase {
|
|
function test_returns_the_email_address_if_it_is_valid() {
|
|
$data = array(
|
|
'bob@example.com',
|
|
'phil@example.info',
|
|
'ace@204.32.222.14',
|
|
'kevin@many.subdomains.make.a.happy.man.edu',
|
|
'a@b.co',
|
|
'bill+ted@example.com',
|
|
);
|
|
foreach ( $data as $datum ) {
|
|
$this->assertSame( $datum, is_email( $datum ), $datum );
|
|
}
|
|
}
|
|
|
|
function test_returns_false_if_given_an_invalid_email_address() {
|
|
$data = array(
|
|
'khaaaaaaaaaaaaaaan!',
|
|
'http://bob.example.com/',
|
|
"sif i'd give u it, spamer!1",
|
|
'com.exampleNOSPAMbob',
|
|
'bob@your mom',
|
|
'a@b.c',
|
|
);
|
|
foreach ( $data as $datum ) {
|
|
$this->assertFalse( is_email( $datum ), $datum );
|
|
}
|
|
}
|
|
}
|