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/link/getPostCommentsFeedLink.php

    r35225 r35242  
    66
    77    public function test_post_link() {
    8         $post_id = self::$factory->post->create();
     8        $post_id = self::factory()->post->create();
    99
    1010        $link = get_post_comments_feed_link( $post_id );
     
    2020        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    2121
    22         $post_id = self::$factory->post->create();
     22        $post_id = self::factory()->post->create();
    2323
    2424        $link = get_post_comments_feed_link( $post_id );
     
    2929
    3030    public function test_attachment_link() {
    31         $post_id = self::$factory->post->create();
    32         $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
     31        $post_id = self::factory()->post->create();
     32        $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    3333            'post_mime_type' => 'image/jpeg',
    3434            'post_type' => 'attachment'
     
    4747        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    4848
    49         $post_id = self::$factory->post->create( array(
     49        $post_id = self::factory()->post->create( array(
    5050            'post_status' => 'publish'
    5151        ) );
    52         $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
     52        $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    5353            'post_mime_type' => 'image/jpeg',
    5454            'post_type' => 'attachment',
     
    6767        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    6868
    69         $post_id = self::$factory->post->create();
    70         $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
     69        $post_id = self::factory()->post->create();
     70        $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    7171            'post_mime_type' => 'image/jpeg',
    7272            'post_type' => 'attachment'
     
    8080
    8181    public function test_unattached_link() {
    82         $attachment_id = self::$factory->attachment->create_object( 'image.jpg', 0, array(
     82        $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array(
    8383            'post_mime_type' => 'image/jpeg',
    8484            'post_type' => 'attachment'
     
    9797        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    9898
    99         $attachment_id = self::$factory->attachment->create_object( 'image.jpg', 0, array(
     99        $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array(
    100100            'post_mime_type' => 'image/jpeg',
    101101            'post_type' => 'attachment'
Note: See TracChangeset for help on using the changeset viewer.