Make WordPress Core

Ticket #15706: 15706.3.unit-tests.patch

File 15706.3.unit-tests.patch, 2.7 KB (added by boonebgorges, 12 years ago)
  • tests/ms.php

     
    525525
    526526        /**
    527527         * Test fetching a blog that doesn't exist and again after it exists.
    528          * 
     528         *
    529529         * @ticket 23405
    530530         */
    531531        function test_get_blog_details_blog_does_not_exist() {
     
    828828         * @ticket 21570
    829829         */
    830830        function test_is_email_address_unsafe() {
    831                 update_site_option( 'banned_email_domains', array( 'bar.com', 'foo.co' ) );
     831                update_site_option( 'banned_email_domains', array( 'bar.com', 'foo.co', '*.foo.org', 'foo.*.gov' ) );
    832832
    833                 foreach ( array( 'test@bar.com', 'test@foo.bar.com', 'test@foo.co', 'test@subdomain.foo.co' ) as $email_address ) {
     833                foreach ( array( 'test@bar.com', 'test@foo.bar.com', 'test@foo.co', 'test@subdomain.foo.co', 'test@bar.foo.org', 'test@foo.bar.gov' ) as $email_address ) {
    834834                        $this->assertTrue( is_email_address_unsafe( $email_address ), "$email_address should be UNSAFE" );
    835835                }
    836836
    837                 foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com' ) as $email_address ) {
     837                foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com', 'test@bar.baz.foo.org', 'test@foo.bar.baz.gov' ) as $email_address ) {
    838838                        $this->assertFalse( is_email_address_unsafe( $email_address ), "$email_address should be SAFE" );
    839839                }
    840840        }
    841841
     842        function test_is_email_address_allowed() {
     843                update_site_option( 'limited_email_domains', array( 'bar.com', 'foo.co', '*.foo.org', 'foo.*.gov' ) );
     844
     845                foreach ( array( 'test@bar.com', 'test@foo.bar.com', 'test@foo.co', 'test@subdomain.foo.co', 'test@bar.foo.org', 'test@foo.bar.gov' ) as $email_address ) {
     846                        $this->assertTrue( is_email_address_allowed( $email_address ), "$email_address should be UNSAFE" );
     847                }
     848
     849                foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com', 'test@bar.baz.foo.org', 'test@foo.bar.baz.gov' ) as $email_address ) {
     850                        $this->assertFalse( is_email_address_allowed( $email_address ), "$email_address should be SAFE" );
     851                }
     852
     853                update_site_option( 'limited_email_domains', '' );
     854
     855                foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com', 'test@bar.baz.foo.org', 'test@foo.bar.baz.gov' ) as $email_address ) {
     856                        $this->assertTrue( is_email_address_allowed( $email_address ), "$email_address should be SAFE" );
     857                }
     858        }
     859
    842860        /**
    843861         * @ticket 21552
    844862         * @ticket 23418
     
    9981016                        'user_login' => $spam_username,
    9991017                ) );
    10001018                update_user_status( $spam_user_id, 'spam', '1' );
    1001                
     1019
    10021020                $this->assertTrue( is_user_spammy( $spam_username ) );
    10031021                $this->assertFalse( is_user_spammy( 'testuser1' ) );
    10041022        }