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

    r35225 r35242  
    1313
    1414    public function test_integer_should_be_interpreted_as_term_id() {
    15         $t1 = self::$factory->term->create( array(
     15        $t1 = self::factory()->term->create( array(
    1616            'taxonomy' => 'wptests_tax',
    1717            'name' => 'foo',
    1818        ) );
    19         $t2 = self::$factory->term->create( array(
     19        $t2 = self::factory()->term->create( array(
    2020            'taxonomy' => 'wptests_tax',
    2121            'slug' => $t1,
     
    2929
    3030    public function test_numeric_string_should_be_interpreted_as_term_slug() {
    31         $t1 = self::$factory->term->create( array(
     31        $t1 = self::factory()->term->create( array(
    3232            'taxonomy' => 'wptests_tax',
    3333            'name' => 'foo',
    3434        ) );
    35         $t2 = self::$factory->term->create( array(
     35        $t2 = self::factory()->term->create( array(
    3636            'taxonomy' => 'wptests_tax',
    3737            'slug' => $t1,
     
    5050
    5151    public function test_category_should_use_cat_query_var_with_term_id() {
    52         $c = self::$factory->category->create();
     52        $c = self::factory()->category->create();
    5353
    5454        $actual = get_term_link( $c, 'category' );
     
    6161        ) );
    6262
    63         $t = self::$factory->term->create( array(
     63        $t = self::factory()->term->create( array(
    6464            'taxonomy' => 'wptests_tax2',
    6565            'slug' => 'bar',
     
    7575        ) );
    7676
    77         $t = self::$factory->term->create( array(
     77        $t = self::factory()->term->create( array(
    7878            'taxonomy' => 'wptests_tax2',
    7979            'slug' => 'bar',
     
    9898        flush_rewrite_rules();
    9999
    100         $t1 = self::$factory->term->create( array(
     100        $t1 = self::factory()->term->create( array(
    101101            'taxonomy' => 'wptests_tax2',
    102102            'slug' => 'term1',
    103103        ) );
    104104
    105         $t2 = self::$factory->term->create( array(
     105        $t2 = self::factory()->term->create( array(
    106106            'taxonomy' => 'wptests_tax2',
    107107            'slug' => 'term2',
     
    127127        flush_rewrite_rules();
    128128
    129         $t1 = self::$factory->term->create( array(
     129        $t1 = self::factory()->term->create( array(
    130130            'taxonomy' => 'wptests_tax2',
    131131            'slug' => 'term1',
    132132        ) );
    133133
    134         $t2 = self::$factory->term->create( array(
     134        $t2 = self::factory()->term->create( array(
    135135            'taxonomy' => 'wptests_tax2',
    136136            'slug' => 'term2',
Note: See TracChangeset for help on using the changeset viewer.