WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/17/2015 06:02:16 PM (6 years ago)
Author:
wonderboymusic
Message:

Unit Tests: after [35225], make factory a method/getter on WP_UnitTestCase and add magic methods for BC for every plugin that is extending WP_UnitTestCase and accessing the $factory instance prop.

Props nerrad, wonderboymusic.
See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php

    r35225 r35242  
    2222        parent::setUp();
    2323        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    24         wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
     24        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    2525
    2626        global $wp_customize;
     
    150150        do_action( 'customize_register', $this->wp_customize );
    151151
    152         $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     152        $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
    153153
    154154        $menu_id = wp_create_nav_menu( 'Menu' );
     
    193193        do_action( 'customize_register', $this->wp_customize );
    194194
    195         $tax_id = self::$factory->category->create( array( 'name' => 'Salutations' ) );
     195        $tax_id = self::factory()->category->create( array( 'name' => 'Salutations' ) );
    196196
    197197        $menu_id = wp_create_nav_menu( 'Menu' );
     
    271271        $this->assertEquals( $post_value, $value );
    272272
    273         $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     273        $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
    274274        $item_id = wp_update_nav_menu_item( $menu_id, 0, array(
    275275            'menu-item-type' => 'post_type',
     
    297297        do_action( 'customize_register', $this->wp_customize );
    298298
    299         $first_post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    300         $second_post_id = self::$factory->post->create( array( 'post_title' => 'Hola Muno' ) );
     299        $first_post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
     300        $second_post_id = self::factory()->post->create( array( 'post_title' => 'Hola Muno' ) );
    301301
    302302        $primary_menu_id = wp_create_nav_menu( 'Primary' );
     
    349349
    350350        $menu_id = wp_create_nav_menu( 'Primary' );
    351         $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     351        $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
    352352        $item_ids = array();
    353353        for ( $i = 0; $i < 5; $i += 1 ) {
     
    404404
    405405        $menu_id = wp_create_nav_menu( 'Primary' );
    406         $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     406        $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
    407407        $item_ids = array();
    408408        for ( $i = 0; $i < 5; $i += 1 ) {
     
    489489        do_action( 'customize_register', $this->wp_customize );
    490490
    491         $first_post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    492         $second_post_id = self::$factory->post->create( array( 'post_title' => 'Hola Muno' ) );
     491        $first_post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
     492        $second_post_id = self::factory()->post->create( array( 'post_title' => 'Hola Muno' ) );
    493493
    494494        $primary_menu_id = wp_create_nav_menu( 'Primary' );
     
    555555
    556556        $menu_id = wp_create_nav_menu( 'Primary' );
    557         $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     557        $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
    558558        $item_ids = array();
    559559        for ( $i = 0; $i < 5; $i += 1 ) {
     
    624624
    625625        $menu_id = wp_create_nav_menu( 'Primary' );
    626         $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     626        $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) );
    627627        $item_ids = array();
    628628        for ( $i = 0; $i < 5; $i += 1 ) {
Note: See TracChangeset for help on using the changeset viewer.