Make WordPress Core


Ignore:
Timestamp:
10/17/2015 06:02:16 PM (11 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/getPostClass.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
     
    2323
    2424        public function test_with_categories() {
    25                 $cats = self::$factory->category->create_many( 2 );
     25                $cats = self::factory()->category->create_many( 2 );
    2626                wp_set_post_terms( $this->post_id, $cats, 'category' );
    2727
     
    5858         */
    5959        public function test_with_utf8_category_slugs() {
    60                 $cat_id1 = self::$factory->category->create( array( 'name' => 'Первая рубрика' ) );
    61                 $cat_id2 = self::$factory->category->create( array( 'name' => 'Вторая рубрика' ) );
    62                 $cat_id3 = self::$factory->category->create( array( 'name' => '25кадр' ) );
     60                $cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) );
     61                $cat_id2 = self::factory()->category->create( array( 'name' => 'Вторая рубрика' ) );
     62                $cat_id3 = self::factory()->category->create( array( 'name' => '25кадр' ) );
    6363                wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' );
    6464
     
    7474         */
    7575        public function test_with_utf8_tag_slugs() {
    76                 $tag_id1 = self::$factory->tag->create( array( 'name' => 'Первая метка' ) );
    77                 $tag_id2 = self::$factory->tag->create( array( 'name' => 'Вторая метка' ) );
    78                 $tag_id3 = self::$factory->tag->create( array( 'name' => '25кадр' ) );
     76                $tag_id1 = self::factory()->tag->create( array( 'name' => 'Первая метка' ) );
     77                $tag_id2 = self::factory()->tag->create( array( 'name' => 'Вторая метка' ) );
     78                $tag_id3 = self::factory()->tag->create( array( 'name' => '25кадр' ) );
    7979                wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' );
    8080
     
    9191        public function test_with_utf8_term_slugs() {
    9292                register_taxonomy( 'wptests_tax', 'post' );
    93                 $term_id1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
    94                 $term_id2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
    95                 $term_id3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
     93                $term_id1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
     94                $term_id2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
     95                $term_id3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
    9696                wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' );
    9797
Note: See TracChangeset for help on using the changeset viewer.