wordpress-develop/tests/phpunit/tests/formatting/IsEmail.php
Rachel Baker c52f1fb160 Formatting: Increase minimum characters allowed in is_email() to 6.
Brings the minimum characters expected for a valid email address to six, which matches the expectations in `wp_handle_comment_submission()` and REST API email arguments.

Props rmccue, lukecavanagh, rachelbaker, desrosj, sudar.
Fixes #38708.


git-svn-id: https://develop.svn.wordpress.org/trunk@40667 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-14 04:19:51 +00:00

34 lines
736 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",
);
foreach ( $data as $datum ) {
$this->assertEquals( $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);
}
}
}