Make WordPress Core

Changeset 32148


Ignore:
Timestamp:
04/19/2015 07:42:52 AM (9 years ago)
Author:
pento
Message:

Backport the PHPUnit test fixes from [31622] to the 4.0 branch.

Props boonebgorges.

See #31537.

Location:
branches/4.0/tests/phpunit
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0/tests/phpunit/includes/utils.php

    r29120 r32148  
    355355    remove_filter( 'get_the_terms', array( 'Featured_Content', 'hide_the_featured_term' ), 10, 3 );
    356356}
     357
     358/**
     359 * Special class for exposing protected wpdb methods we need to access
     360 */
     361class wpdb_exposed_methods_for_testing extends wpdb {
     362    public function __construct() {
     363        global $wpdb;
     364        $this->dbh = $wpdb->dbh;
     365        $this->use_mysqli = $wpdb->use_mysqli;
     366        $this->ready = true;
     367        $this->field_types = $wpdb->field_types;
     368        $this->charset = $wpdb->charset;
     369    }
     370
     371    public function __call( $name, $arguments ) {
     372        return call_user_func_array( array( $this, $name ), $arguments );
     373    }
     374}
  • branches/4.0/tests/phpunit/tests/admin/includesScreen.php

    r26456 r32148  
    3838
    3939    function tearDown() {
    40         parent::tearDown();
    4140        unset( $GLOBALS['wp_taxonomies']['old-or-new'] );
    4241        set_current_screen( 'front' );
     42        parent::tearDown();
    4343    }
    4444
  • branches/4.0/tests/phpunit/tests/ajax/Autosave.php

    r26995 r32148  
    4747     */
    4848    public function tearDown() {
     49        wp_set_current_user( 0 );
    4950        parent::tearDown();
    50         wp_set_current_user( 0 );
    5151    }
    5252
  • branches/4.0/tests/phpunit/tests/ajax/Response.php

    r25002 r32148  
    3737     */
    3838    public function tearDown() {
    39         parent::tearDown();
    4039        remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 );
    4140        error_reporting( $this->_error_level );
     41        parent::tearDown();
    4242    }
    4343
  • branches/4.0/tests/phpunit/tests/basic.php

    r28631 r32148  
    1414
    1515    function tearDown() {
     16        $this->val = false;
    1617        parent::tearDown();
    17         $this->val = false;
    1818    }
    1919
  • branches/4.0/tests/phpunit/tests/cache.php

    r25002 r32148  
    1515
    1616    function tearDown() {
     17        $this->flush_cache();
    1718        parent::tearDown();
    18         $this->flush_cache();
    1919    }
    2020
  • branches/4.0/tests/phpunit/tests/canonical.php

    r28966 r32148  
    8686    function tearDown() {
    8787        global $wp_rewrite;
     88        wp_set_current_user( $this->old_current_user );
     89
     90        $wp_rewrite->init();
    8891        parent::tearDown();
    89         wp_set_current_user( $this->old_current_user );
    90 
    91         $wp_rewrite->init();
    9292    }
    9393
  • branches/4.0/tests/phpunit/tests/canonical/pageOnFront.php

    r28966 r32148  
    2121    function tearDown() {
    2222        global $wp_rewrite;
     23        $wp_rewrite->init();
    2324        parent::tearDown();
    24         $wp_rewrite->init();
    2525    }
    2626
  • branches/4.0/tests/phpunit/tests/category.php

    r28706 r32148  
    1111
    1212    function tearDown() {
     13        _unregister_taxonomy( 'test_tax_cat' );
    1314        parent::tearDown();
    14 
    15         _unregister_taxonomy( 'test_tax_cat' );
    1615    }
    1716
  • branches/4.0/tests/phpunit/tests/comment/getCommentsPagesCount.php

    r27055 r32148  
    2727     */
    2828    function tearDown() {
    29         parent::tearDown();
    3029        update_option( 'page_comments', $this->option_page_comments );
    3130        update_option( 'comments_per_page', $this->option_page_comments );
    3231        update_option( 'thread_comments', $this->option_page_comments );
    3332        update_option( 'posts_per_rss', $this->option_posts_per_rss );
     33        parent::tearDown();
    3434    }
    3535
  • branches/4.0/tests/phpunit/tests/cron.php

    r25368 r32148  
    1414
    1515    function tearDown() {
    16         parent::tearDown();
    1716        // make sure the schedule is clear
    1817        _set_cron_array(array());
     18        parent::tearDown();
    1919    }
    2020
  • branches/4.0/tests/phpunit/tests/image/base.php

    r29120 r32148  
    2323     */
    2424    public function tearDown() {
     25        remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
    2526        parent::tearDown();
    26 
    27         remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
    2827    }
    2928
  • branches/4.0/tests/phpunit/tests/link.php

    r30405 r32148  
    77    function tearDown() {
    88        global $wp_rewrite;
     9        $wp_rewrite->init();
    910        parent::tearDown();
    10         $wp_rewrite->init();
    1111    }
    1212
  • branches/4.0/tests/phpunit/tests/mail.php

    r25381 r32148  
    1212
    1313    function tearDown() {
     14        unset( $_SERVER['SERVER_NAME'] );
    1415        parent::tearDown();
    15         unset( $_SERVER['SERVER_NAME'] );
    1616    }
    1717
  • branches/4.0/tests/phpunit/tests/post/meta.php

    r25002 r32148  
    3434
    3535    function tearDown() {
    36         parent::tearDown();
    3736        wp_delete_post($this->post_id);
    3837        wp_delete_post($this->post_id_2);
     38        parent::tearDown();
    3939    }
    4040
  • branches/4.0/tests/phpunit/tests/post/revisions.php

    r28962 r32148  
    1313
    1414    function tearDown() {
     15        unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
    1516        parent::tearDown();
    16         unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
    1717    }
    1818
  • branches/4.0/tests/phpunit/tests/query/conditionals.php

    r29039 r32148  
    3535    function tearDown() {
    3636        global $wp_rewrite;
     37        $wp_rewrite->init();
     38
    3739        parent::tearDown();
    38         $wp_rewrite->init();
    3940    }
    4041
  • branches/4.0/tests/phpunit/tests/query/search.php

    r27474 r32148  
    1919
    2020    function tearDown() {
    21         parent::tearDown();
    22 
    2321        _unregister_post_type( $this->post_type );
    2422        unset( $this->q );
     23
     24        parent::tearDown();
    2525    }
    2626
  • branches/4.0/tests/phpunit/tests/rewrite.php

    r28966 r32148  
    2323    function tearDown() {
    2424        global $wp_rewrite;
     25        $wp_rewrite->init();
     26
    2527        parent::tearDown();
    26         $wp_rewrite->init();
    2728    }
    2829
  • branches/4.0/tests/phpunit/tests/shortcode.php

    r29197 r32148  
    2121    function tearDown() {
    2222        global $shortcode_tags;
    23         parent::tearDown();
    2423        foreach ( $this->shortcodes as $shortcode )
    2524            unset( $shortcode_tags[ $shortcode ] );
     25        parent::tearDown();
    2626    }
    2727
  • branches/4.0/tests/phpunit/tests/user/mapMetaCap.php

    r27390 r32148  
    3333
    3434    function tearDown() {
    35         parent::tearDown();
    36 
    3735        $GLOBALS['super_admins'] = $this->super_admins;
    3836        unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
     37        parent::tearDown();
    3938    }
    4039
  • branches/4.0/tests/phpunit/tests/xmlrpc/wp/getPage.php

    r25002 r32148  
    2525
    2626    function tearDown() {
     27        wp_delete_post( $this->post_id );
    2728        parent::tearDown();
    28 
    29         wp_delete_post( $this->post_id );
    3029    }
    3130
Note: See TracChangeset for help on using the changeset viewer.