Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2017 07:44:10 PM (4 years ago)
Author:
boonebgorges
Message:

Use static factory method throughout PHPUnit tests.

See #7620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/blogs/filters.php

    r11256 r11737  
    4646     */
    4747    public function test_bp_activity_catch_transition_post_type_status() {
    48         $post_id = $this->factory->post->create( array(
     48        $post_id = self::factory()->post->create( array(
    4949            'post_status' => 'publish',
    5050            'post_type'   => 'using_old_filter',
     
    5959     */
    6060    public function test_bp_blogs_record_comment() {
    61         $u = $this->factory->user->create();
    62         $user = $this->factory->user->get_object_by_id( $u );
     61        $u = self::factory()->user->create();
     62        $user = self::factory()->user->get_object_by_id( $u );
    6363
    64         $post_id = $this->factory->post->create( array(
     64        $post_id = self::factory()->post->create( array(
    6565            'post_status' => 'publish',
    6666            'post_type'   => 'using_old_filter',
     
    6868        ) );
    6969
    70         $comment_id = $this->factory->comment->create( array(
     70        $comment_id = self::factory()->comment->create( array(
    7171            'user_id'              => $u,
    7272            'comment_author_email' => $user->user_email,
     
    7575
    7676        // Approve the comment
    77         $this->factory->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
     77        self::factory()->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
    7878
    7979        $this->assertTrue( $this->activity_exists_for_post_type( get_current_blog_id(), $comment_id, 'new_blog_comment' ), 'Generated activity for comments about a post type registering using the bp_blogs_record_post_post_types filter should have a new_blog_comment action' );
     
    8585     */
    8686    public function test_bp_blogs_record_comment_sync_activity_comment() {
    87         $u = $this->factory->user->create();
    88         $user = $this->factory->user->get_object_by_id( $u );
     87        $u = self::factory()->user->create();
     88        $user = self::factory()->user->get_object_by_id( $u );
    8989
    9090        add_filter( 'bp_disable_blogforum_comments', '__return_false' );
    9191
    92         $post_id = $this->factory->post->create( array(
     92        $post_id = self::factory()->post->create( array(
    9393            'post_status' => 'publish',
    9494            'post_type'   => 'using_old_filter',
     
    103103        ) );
    104104
    105         $comment_id = $this->factory->comment->create( array(
     105        $comment_id = self::factory()->comment->create( array(
    106106            'user_id'              => $u,
    107107            'comment_author_email' => $user->user_email,
     
    110110
    111111        // Approve the comment
    112         $this->factory->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
     112        self::factory()->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
    113113
    114114        $this->assertTrue( $this->activity_exists_for_post_type( $parent_activity_id, '', 'activity_comment', 'stream' ), 'Generated activity for comments about a post type registering using the bp_blogs_record_post_post_types filter having sync on should have a activity_comment action' );
Note: See TracChangeset for help on using the changeset viewer.