Make WordPress Core


Ignore:
Timestamp:
09/12/2013 07:16:30 AM (11 years ago)
Author:
wonderboymusic
Message:
  • Fill in undefined var in Tests_Option_BlogOption
  • Add defined() check for BLOGSUPLOADDIR
  • Suppress deprecated function notices for is_blog_user() and get_dashboard_blog()
  • Check existence of $user in wpmu_log_new_registrations() before arbitrarily making a database query

Fixes all notices in multisite unit tests.

See #25282.

File:
1 edited

Legend:

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

    r25197 r25397  
    1111
    1212    protected $plugin_hook_count = 0;
     13
     14    function setUp() {
     15        parent::setUp();
     16
     17        $_SERVER['REMOTE_ADDR'] = '';
     18        add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );
     19    }
     20
     21    function tearDown() {
     22        parent::tearDown();
     23        remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );
     24    }
     25
     26    function deprecated_function_run_check( $function ) {
     27        if ( in_array( $function, array( 'is_blog_user', 'get_dashboard_blog' ) ) )
     28            add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
     29    }
     30
     31    function filter_deprecated_function_trigger_error() {
     32        remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
     33        return false;
     34    }
    1335
    1436    function test_create_and_delete_blog() {
     
    309331        $this->assertTrue( is_upload_space_available() );
    310332
    311         if ( ! file_exists( BLOGSUPLOADDIR ) )
     333        if ( defined( 'BLOGSUPLOADDIR' ) && ! file_exists( BLOGSUPLOADDIR ) )
    312334            $this->markTestSkipped( 'This test is broken when blogs.dir does not exist. ');
    313335
     
    526548    /**
    527549     * Test fetching a blog that doesn't exist and again after it exists.
    528      * 
     550     *
    529551     * @ticket 23405
    530552     */
     
    10141036        ) );
    10151037        update_user_status( $spam_user_id, 'spam', '1' );
    1016        
     1038
    10171039        $this->assertTrue( is_user_spammy( $spam_username ) );
    10181040        $this->assertFalse( is_user_spammy( 'testuser1' ) );
Note: See TracChangeset for help on using the changeset viewer.