Make WordPress Core


Ignore:
Timestamp:
06/29/2016 01:13:53 PM (9 years ago)
Author:
ocean90
Message:

Tests: After [37861] move tests for deprecated filters into filters.php.

See #10441.

File:
1 edited

Legend:

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

    r37861 r37909  
    365365
    366366        $wp_actions = array();
    367        
     367
    368368        $this->assertEmpty( $wp_actions );
    369369        _restore_plugin_globals();
     
    384384        $tag = rand_str();
    385385        add_action($tag, array(&$a, 'action'));
    386        
     386
    387387        $this->assertNotEquals( $GLOBALS['wp_filter'], $original_filter );
    388388
     
    459459        $p2->post_title = 'Bar2';
    460460    }
    461 
    462     /**
    463      * @ticket 10441
    464      * @expectedDeprecated tests_apply_filters_deprecated
    465      */
    466     public function test_apply_filters_deprecated() {
    467         $p = 'Foo';
    468 
    469         add_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback' ) );
    470         $p = apply_filters_deprecated( 'tests_apply_filters_deprecated', array( $p ), '4.6' );
    471         remove_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback' ) );
    472 
    473         $this->assertSame( 'Bar', $p );
    474     }
    475 
    476     public static function deprecated_filter_callback( $p ) {
    477         $p = 'Bar';
    478         return $p;
    479     }
    480 
    481     /**
    482      * @ticket 10441
    483      * @expectedDeprecated tests_apply_filters_deprecated
    484      */
    485     public function test_apply_filters_deprecated_with_multiple_params() {
    486         $p1 = 'Foo1';
    487         $p2 = 'Foo2';
    488 
    489         add_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback_multiple_params' ), 10, 2 );
    490         $p1 = apply_filters_deprecated( 'tests_apply_filters_deprecated', array( $p1, $p2 ), '4.6' );
    491         remove_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback_multiple_params' ), 10, 2 );
    492 
    493         $this->assertSame( 'Bar1', $p1 );
    494 
    495         // Not passed by reference, so not modified.
    496         $this->assertSame( 'Foo2', $p2 );
    497     }
    498 
    499     public static function deprecated_filter_callback_multiple_params( $p1, $p2 ) {
    500         $p1 = 'Bar1';
    501         $p2 = 'Bar2';
    502 
    503         return $p1;
    504     }
    505461}
Note: See TracChangeset for help on using the changeset viewer.