Make WordPress Core


Ignore:
Timestamp:
10/17/2015 06:02:16 PM (9 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/post/getBodyClass.php

    r35225 r35242  
    1010    public function setUp() {
    1111        parent::setUp();
    12         $this->post_id = self::$factory->post->create();
     12        $this->post_id = self::factory()->post->create();
    1313    }
    1414
     
    1717     */
    1818    public function test_with_utf8_category_slugs() {
    19         $cat_id1 = self::$factory->category->create( array( 'name' => 'Первая рубрика' ) );
    20         $cat_id2 = self::$factory->category->create( array( 'name' => 'Вторая рубрика' ) );
    21         $cat_id3 = self::$factory->category->create( array( 'name' => '25кадр' ) );
     19        $cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) );
     20        $cat_id2 = self::factory()->category->create( array( 'name' => 'Вторая рубрика' ) );
     21        $cat_id3 = self::factory()->category->create( array( 'name' => '25кадр' ) );
    2222        wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' );
    2323
     
    3636     */
    3737    public function test_with_utf8_tag_slugs() {
    38         $tag_id1 = self::$factory->tag->create( array( 'name' => 'Первая метка' ) );
    39         $tag_id2 = self::$factory->tag->create( array( 'name' => 'Вторая метка' ) );
    40         $tag_id3 = self::$factory->tag->create( array( 'name' => '25кадр' ) );
     38        $tag_id1 = self::factory()->tag->create( array( 'name' => 'Первая метка' ) );
     39        $tag_id2 = self::factory()->tag->create( array( 'name' => 'Вторая метка' ) );
     40        $tag_id3 = self::factory()->tag->create( array( 'name' => '25кадр' ) );
    4141        wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' );
    4242
     
    6060    public function test_with_utf8_term_slugs() {
    6161        register_taxonomy( 'wptests_tax', 'post' );
    62         $term_id1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
    63         $term_id2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
    64         $term_id3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
     62        $term_id1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
     63        $term_id2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
     64        $term_id3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
    6565        wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' );
    6666
Note: See TracChangeset for help on using the changeset viewer.