Make WordPress Core

Changeset 32638


Ignore:
Timestamp:
05/28/2015 04:05:30 PM (11 years ago)
Author:
boonebgorges
Message:

Improve tests for is_email_address_unsafe().

  • Move to a separate file for better organization and method names.
  • Use a dataProvider when appropriate, for better readability.
  • Add a test for splitting the banned domain list on line breaks.

See #20459, #21730.

Location:
trunk/tests/phpunit/tests
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite.php

    r29916 r32638  
    3737                $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog )-1 ] );
    3838        }
    39 
    40         /**
    41          * @ticket 21570
    42          */
    43         function test_aggressiveness_of_is_email_address_unsafe() {
    44                 update_site_option( 'banned_email_domains', array( 'bar.com', 'foo.co' ) );
    45 
    46                 foreach ( array( 'test@bar.com', 'test@foo.bar.com', 'test@foo.co', 'test@subdomain.foo.co' ) as $email_address ) {
    47                         $this->assertTrue( is_email_address_unsafe( $email_address ), "$email_address should be UNSAFE" );
    48                 }
    49 
    50                 foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com' ) as $email_address ) {
    51                         $this->assertFalse( is_email_address_unsafe( $email_address ), "$email_address should be SAFE" );
    52                 }
    53         }
    54 
    55         /**
    56          * @ticket 25046
    57          */
    58         function test_case_sensitivity_of_is_email_address_unsafe() {
    59                 update_site_option( 'banned_email_domains', array( 'baR.com', 'Foo.co', 'barfoo.COM', 'BAZ.com' ) );
    60 
    61                 foreach ( array( 'test@Bar.com', 'tEst@bar.com', 'test@barFoo.com', 'tEst@foo.bar.com', 'test@baz.Com' ) as $email_address ) {
    62                         $this->assertTrue( is_email_address_unsafe( $email_address ), "$email_address should be UNSAFE" );
    63                 }
    64 
    65                 foreach ( array( 'test@Foobar.com', 'test@Foo-bar.com', 'tEst@foobar.com', 'test@Subdomain.Foo.com', 'test@fooBAz.com' ) as $email_address ) {
    66                         $this->assertFalse( is_email_address_unsafe( $email_address ), "$email_address should be SAFE" );
    67                 }
    68 
    69         }
    7039}
    7140
Note: See TracChangeset for help on using the changeset viewer.