WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/21/2015 03:17:36 AM (6 years ago)
Author:
wonderboymusic
Message:

AJAX UNIT TESTS: Have you ever wondered why these take 600 forevers to run? They all eventually call do_action( 'admin_init' ), which has _maybe_update_core, _maybe_update_plugins, and _maybe_update_themes hooked to it. REMOVE THEM, and AJAX unit tests run like the wind. Tests_Ajax_Response is still slow.

See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/TagSearch.php

    r25002 r35311  
    2020     * @var array
    2121     */
    22     private $_terms = array(
     22    private static $terms = array(
    2323        'chattels', 'depo', 'energumen', 'figuriste', 'habergeon', 'impropriation'
    2424    );
    2525
    26     /**
    27      * Setup
    28      * @todo use a term factory
    29      */
    30     public function setUp() {
    31         parent::setUp();
     26    private static $term_ids = array();
    3227
    33         foreach ( $this->_terms as $term )
    34             wp_insert_term( $term, 'post_tag' );
     28    public static function wpSetUpBeforeClass() {
     29        foreach ( self::$terms as $t ) {
     30            self::$term_ids[] = wp_insert_term( $t, 'post_tag' );
     31        }
     32    }
     33
     34    public static function wpTearDownAfterClass() {
     35        foreach ( self::$term_ids as $t ) {
     36            wp_delete_term( $t, 'post_tag' );
     37        }
    3538    }
    3639
Note: See TracChangeset for help on using the changeset viewer.