WordPress.org

Make WordPress Core

Changeset 1094 in tests


Ignore:
Timestamp:
10/25/12 21:40:03 (18 months ago)
Author:
nacin
Message:

Additional tests for banned domain matching in is_email_address_unsafe(). see #WP18799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/ms.php

    r1090 r1094  
    417417        $this->assertEquals( 1, $test_action_counter ); 
    418418        remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10, 1 ); 
    419          
     419 
    420420        add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10, 1 ); 
    421421        $result = update_blog_details( $blog_id, array( 'spam' => 1 ) ); 
     
    547547        $this->assertEquals( 2, $test_action_counter ); 
    548548        remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10, 1 ); 
    549          
     549 
    550550        add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10, 1 ); 
    551551        $result = update_blog_status( $blog_id, 'spam', 1 ); 
     
    736736     */ 
    737737    function test_is_email_address_unsafe() { 
    738         update_site_option( 'banned_email_domains', 'bar.com' ); 
    739  
    740         foreach ( array( 'test@bar.com', 'test@foo.bar.com' ) as $email_address ) { 
     738        update_site_option( 'banned_email_domains', array( 'bar.com', 'foo.co' ) ); 
     739 
     740        foreach ( array( 'test@bar.com', 'test@foo.bar.com', 'test@foo.co', 'test@subdomain.foo.co' ) as $email_address ) { 
    741741            $this->assertTrue( is_email_address_unsafe( $email_address ), "$email_address should be UNSAFE" ); 
    742742        } 
    743743 
    744         foreach ( array( 'test@foobar.com', 'test@foo-bar.com' ) as $email_address ) { 
     744        foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com' ) as $email_address ) { 
    745745            $this->assertFalse( is_email_address_unsafe( $email_address ), "$email_address should be SAFE" ); 
    746746        } 
     
    775775        $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 
    776776        $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/testdomainexists', 'title' => 'Test Title' ) ); 
    777      
     777 
    778778        $details = get_blog_details( $blog_id, false ); 
    779          
     779 
    780780        $this->assertEquals( $blog_id, domain_exists( $details->domain, $details->path ) ); 
    781781        $this->assertEquals( $blog_id, domain_exists( $details->domain, $details->path, $details->site_id ) ); 
     
    800800        $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 
    801801        $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/testdomainexists', 'title' => 'Test Title' ) ); 
    802      
     802 
    803803        $details = get_blog_details( $blog_id, false ); 
    804804 
Note: See TracChangeset for help on using the changeset viewer.