WordPress.org

Make WordPress Core


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

    r35225 r35242  
    77class Tests_Admin_IncludesComment extends WP_UnitTestCase {
    88    public function test_must_match_date_and_author() {
    9         $p1 = self::$factory->post->create();
    10         $c1 = self::$factory->comment->create( array(
     9        $p1 = self::factory()->post->create();
     10        $c1 = self::factory()->comment->create( array(
    1111            'comment_author' => 1,
    1212            'comment_date' => '2014-05-06 12:00:00',
     
    1414        ) );
    1515
    16         $p2 = self::$factory->post->create();
    17         $c2 = self::$factory->comment->create( array(
     16        $p2 = self::factory()->post->create();
     17        $c2 = self::factory()->comment->create( array(
    1818            'comment_author' => 2,
    1919            'comment_date' => '2004-01-02 12:00:00',
     
    2929     */
    3030    public function test_default_value_of_timezone_should_be_blog() {
    31         $p = self::$factory->post->create();
    32         $c = self::$factory->comment->create( array(
     31        $p = self::factory()->post->create();
     32        $c = self::factory()->comment->create( array(
    3333            'comment_author' => 1,
    3434            'comment_post_ID' => $p,
     
    4444     */
    4545    public function test_should_respect_timezone_blog() {
    46         $p = self::$factory->post->create();
    47         $c = self::$factory->comment->create( array(
     46        $p = self::factory()->post->create();
     47        $c = self::factory()->comment->create( array(
    4848            'comment_author' => 1,
    4949            'comment_post_ID' => $p,
     
    5959     */
    6060    public function test_should_respect_timezone_gmt() {
    61         $p = self::$factory->post->create();
    62         $c = self::$factory->comment->create( array(
     61        $p = self::factory()->post->create();
     62        $c = self::factory()->comment->create( array(
    6363            'comment_author' => 1,
    6464            'comment_post_ID' => $p,
     
    7474     */
    7575    public function test_invalid_timezone_should_fall_back_on_blog() {
    76         $p = self::$factory->post->create();
    77         $c = self::$factory->comment->create( array(
     76        $p = self::factory()->post->create();
     77        $c = self::factory()->comment->create( array(
    7878            'comment_author' => 1,
    7979            'comment_post_ID' => $p,
Note: See TracChangeset for help on using the changeset viewer.