WordPress.org

Make WordPress Core


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

    r35225 r35242  
    77
    88    function test_get_post() {
    9         $id = self::$factory->post->create();
     9        $id = self::factory()->post->create();
    1010
    1111        $post = get_post( $id );
     
    6868
    6969    function test_get_post_ancestors() {
    70         $parent_id = self::$factory->post->create();
    71         $child_id = self::$factory->post->create();
    72         $grandchild_id = self::$factory->post->create();
     70        $parent_id = self::factory()->post->create();
     71        $child_id = self::factory()->post->create();
     72        $grandchild_id = self::factory()->post->create();
    7373        $updated = wp_update_post( array( 'ID' => $child_id, 'post_parent' => $parent_id ) );
    7474        $this->assertEquals( $updated, $child_id );
     
    100100
    101101    function test_get_post_category_property() {
    102         $post_id = self::$factory->post->create();
     102        $post_id = self::factory()->post->create();
    103103        $post = get_post( $post_id );
    104104
     
    119119
    120120    function test_get_tags_input_property() {
    121         $post_id = self::$factory->post->create();
     121        $post_id = self::factory()->post->create();
    122122        $post = get_post( $post_id );
    123123
     
    136136
    137137    function test_get_page_template_property() {
    138         $post_id = self::$factory->post->create();
     138        $post_id = self::factory()->post->create();
    139139        $post = get_post( $post_id );
    140140
     
    156156
    157157    function test_get_post_filter() {
    158         $post = get_post( self::$factory->post->create( array(
     158        $post = get_post( self::factory()->post->create( array(
    159159            'post_title' => "Mary's home"
    160160        ) ) );
     
    179179
    180180    function test_get_post_identity() {
    181         $post = get_post( self::$factory->post->create() );
     181        $post = get_post( self::factory()->post->create() );
    182182
    183183        $post->foo = 'bar';
     
    188188
    189189    function test_get_post_array() {
    190         $id = self::$factory->post->create();
     190        $id = self::factory()->post->create();
    191191
    192192        $post = get_post( $id, ARRAY_A );
     
    203203        global $wpdb;
    204204
    205         $id = self::$factory->post->create();
     205        $id = self::factory()->post->create();
    206206        wp_cache_delete( $id, 'posts' );
    207207
Note: See TracChangeset for help on using the changeset viewer.