Skip to:
Content

bbPress.org

Changeset 5925


Ignore:
Timestamp:
08/24/2015 09:55:26 AM (4 years ago)
Author:
netweb
Message:

Tests: Ensure bbPress' custom post types posts are created with a unique GUID.

Props tharsheblows, netweb. Fixes #2844, see also #WP5305 / wp:changeset:33630.

Location:
trunk/tests/phpunit/testcases
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/forums/functions/forum.php

    r5863 r5925  
    1919
    2020        $now = time();
    21         $post_date = date( 'Y-m-d H:i:s', $now - 60*60*100 );
     21        $post_date = date( 'Y-m-d H:i:s', $now - 60 * 60 * 100 );
    2222
    2323        $t = $this->factory->topic->create( array(
     
    3838        ) );
    3939
    40         // Forum post
     40        // Get the forum.
     41        $forum = bbp_get_forum( $f );
     42
     43        // Forum post.
    4144        $this->assertSame( 'Forum 1', bbp_get_forum_title( $f ) );
    4245        $this->assertSame( 'Content of Forum 1', bbp_get_forum_content( $f ) );
     
    4548        $this->assertTrue( bbp_is_forum_public( $f ) );
    4649        $this->assertSame( 0, bbp_get_forum_parent_id( $f ) );
    47 
    48         // Forum meta
     50        $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?forum=' . $forum->post_name, $forum->guid );
     51
     52        // Forum meta.
    4953        $this->assertSame( 0, bbp_get_forum_subforum_count( $f, true ) );
    50         $this->assertSame( 1, bbp_get_forum_topic_count( $f, false, true ) ); // Topic count
    51         $this->assertSame( 1, bbp_get_forum_topic_count( $f, true, true ) );  // Total topic count
    52         $this->assertSame( 0, bbp_get_forum_topic_count_hidden( $f, true ) ); // Topic count hidden
    53         $this->assertSame( 1, bbp_get_forum_reply_count( $f, false, true ) ); // Reply count
    54         $this->assertSame( 1, bbp_get_forum_reply_count( $f, true, true ) );  // Total reply count
    55         $this->assertSame( 2, bbp_get_forum_post_count( $f, false, true ) );  // Post count
    56         $this->assertSame( 2, bbp_get_forum_post_count( $f, true, true ) );   // Total post count
     54        $this->assertSame( 1, bbp_get_forum_topic_count( $f, false, true ) );
     55        $this->assertSame( 1, bbp_get_forum_topic_count( $f, true, true ) );
     56        $this->assertSame( 0, bbp_get_forum_topic_count_hidden( $f, true ) );
     57        $this->assertSame( 1, bbp_get_forum_reply_count( $f, false, true ) );
     58        $this->assertSame( 1, bbp_get_forum_reply_count( $f, true, true ) );
     59        $this->assertSame( 2, bbp_get_forum_post_count( $f, false, true ) );
     60        $this->assertSame( 2, bbp_get_forum_post_count( $f, true, true ) );
    5761        $this->assertSame( $t, bbp_get_forum_last_topic_id( $f ) );
    5862        $this->assertSame( $r, bbp_get_forum_last_reply_id( $f ) );
  • trunk/tests/phpunit/testcases/replies/functions/reply.php

    r5779 r5925  
    3333        ) );
    3434
    35         // reply post
     35        // Get the reply.
     36        $reply = bbp_get_reply( $r );
     37
     38        // Reply post.
    3639        $this->assertSame( 'Reply To: Topic 1', bbp_get_reply_title( $r ) );
    3740        $this->assertSame( 'publish', bbp_get_reply_status( $r ) );
    38         $this->assertSame( $t, wp_get_post_parent_id( $r ) ); // post parent
    39 
    40         // reply meta
    41         $this->assertSame( $f, bbp_get_reply_forum_id( $r ) ); // _bbp_forum_id
    42         $this->assertSame( $t, bbp_get_reply_topic_id( $r ) ); // _bbp_forum_id
     41        $this->assertSame( $t, wp_get_post_parent_id( $r ) );
     42        $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?reply=' . $reply->post_name, $reply->guid );
     43
     44        // Reply meta.
     45        $this->assertSame( $f, bbp_get_reply_forum_id( $r ) );
     46        $this->assertSame( $t, bbp_get_reply_topic_id( $r ) );
    4347    }
    4448
  • trunk/tests/phpunit/testcases/topics/functions/topic.php

    r5915 r5925  
    1919
    2020        $now = time();
    21         $post_date = date( 'Y-m-d H:i:s', $now - 60*60*100 );
     21        $post_date = date( 'Y-m-d H:i:s', $now - 60 * 60 * 100 );
    2222
    2323        $t = $this->factory->topic->create( array(
     
    3838        ) );
    3939
    40         // Topic post
     40        // Get the topic.
     41        $topic = bbp_get_topic( $t );
     42
     43        // Topic post.
    4144        $this->assertSame( 'Topic 1', bbp_get_topic_title( $t ) );
    4245        $this->assertSame( 'publish', bbp_get_topic_status( $t ) );
    43         $this->assertSame( $f, wp_get_post_parent_id( $t ) ); // post parent
    44 
    45         // Topic meta
    46         $this->assertSame( $f, bbp_get_topic_forum_id( $t ) ); // _bbp_forum_id
     46        $this->assertSame( $f, wp_get_post_parent_id( $t ) );
     47        $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?topic=' . $topic->post_name, $topic->guid );
     48
     49        // Topic meta.
     50        $this->assertSame( $f, bbp_get_topic_forum_id( $t ) );
    4751        $this->assertSame( 1, bbp_get_topic_reply_count( $t, true ) );
    4852        $this->assertSame( 0, bbp_get_topic_reply_count_hidden( $t, true ) );
Note: See TracChangeset for help on using the changeset viewer.