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/term/termExists.php

    r35225 r35242  
    1010
    1111    public function test_term_exists_term_int_taxonomy_nonempty_term_exists() {
    12         $t = self::$factory->term->create( array(
     12        $t = self::factory()->term->create( array(
    1313            'taxonomy' => 'post_tag',
    1414        ) );
     
    2323
    2424    public function test_term_exists_term_int_taxonomy_nonempty_wrong_taxonomy() {
    25         $t = self::$factory->term->create( array(
     25        $t = self::factory()->term->create( array(
    2626            'taxonomy' => 'post_tag',
    2727        ) );
     
    3131
    3232    public function test_term_exists_term_int_taxonomy_empty_term_exists() {
    33         $t = self::$factory->term->create( array(
     33        $t = self::factory()->term->create( array(
    3434            'taxonomy' => 'post_tag',
    3535        ) );
     
    4444
    4545    public function test_term_exists_unslash_term() {
    46         $t = self::$factory->term->create( array(
     46        $t = self::factory()->term->create( array(
    4747            'taxonomy' => 'post_tag',
    4848            'name' => 'I "love" WordPress\'s taxonomy system',
     
    5454
    5555    public function test_term_exists_trim_term() {
    56         $t = self::$factory->term->create( array(
     56        $t = self::factory()->term->create( array(
    5757            'taxonomy' => 'post_tag',
    5858            'slug' => 'foo',
     
    8585        ) );
    8686
    87         $parent_term = self::$factory->term->create( array(
    88             'taxonomy' => 'foo',
    89         ) );
    90 
    91         $t = self::$factory->term->create( array(
     87        $parent_term = self::factory()->term->create( array(
     88            'taxonomy' => 'foo',
     89        ) );
     90
     91        $t = self::factory()->term->create( array(
    9292            'taxonomy' => 'foo',
    9393            'parent' => $parent_term,
     
    111111        ) );
    112112
    113         $parent_term = self::$factory->term->create( array(
    114             'taxonomy' => 'foo',
    115         ) );
    116 
    117         $t = self::$factory->term->create( array(
     113        $parent_term = self::factory()->term->create( array(
     114            'taxonomy' => 'foo',
     115        ) );
     116
     117        $t = self::factory()->term->create( array(
    118118            'taxonomy' => 'foo',
    119119            'parent' => $parent_term,
     
    133133        ) );
    134134
    135         $parent_term = self::$factory->term->create( array(
    136             'taxonomy' => 'foo',
    137         ) );
    138 
    139         $t = self::$factory->term->create( array(
     135        $parent_term = self::factory()->term->create( array(
     136            'taxonomy' => 'foo',
     137        ) );
     138
     139        $t = self::factory()->term->create( array(
    140140            'taxonomy' => 'foo',
    141141            'parent' => $parent_term,
     
    154154        register_taxonomy( 'foo', 'post', array() );
    155155
    156         $t = self::$factory->term->create( array(
     156        $t = self::factory()->term->create( array(
    157157            'taxonomy' => 'foo',
    158158            'slug' => 'kewl-dudez',
     
    170170        register_taxonomy( 'foo', 'post', array() );
    171171
    172         $t = self::$factory->term->create( array(
     172        $t = self::factory()->term->create( array(
    173173            'taxonomy' => 'foo',
    174174            'name' => 'Kewl Dudez',
     
    186186        register_taxonomy( 'foo', 'post', array() );
    187187
    188         $t = self::$factory->term->create( array(
     188        $t = self::factory()->term->create( array(
    189189            'taxonomy' => 'foo',
    190190            'name' => 'juicy-fruit',
     
    202202        register_taxonomy( 'foo', 'post', array() );
    203203
    204         $t = self::$factory->term->create( array(
     204        $t = self::factory()->term->create( array(
    205205            'taxonomy' => 'foo',
    206206            'name' => 'Juicy Fruit',
Note: See TracChangeset for help on using the changeset viewer.