Changeset 6004
- Timestamp:
- 04/18/2016 12:46:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/forums/functions/forum.php
r5947 r6004 16 16 public function test_bbp_insert_forum() { 17 17 18 $c = $this->factory->forum->create( array( 19 'post_title' => 'Category 1', 20 'post_content' => 'Content of Category 1', 21 'forum_meta' => array( 22 'forum_type' => 'category', 23 'status' => 'open', 24 ), 25 ) ); 26 18 27 $f = $this->factory->forum->create( array( 19 28 'post_title' => 'Forum 1', 20 29 'post_content' => 'Content of Forum 1', 30 'post_parent' => $c, 31 'forum_meta' => array( 32 'forum_id' => $c, 33 'forum_type' => 'forum', 34 'status' => 'open', 35 ), 21 36 ) ); 22 37 … … 41 56 ) ); 42 57 58 // Get the category. 59 $category = bbp_get_forum( $c ); 60 43 61 // Get the forum. 44 62 $forum = bbp_get_forum( $f ); 63 64 // Category post. 65 $this->assertSame( 'Category 1', bbp_get_forum_title( $c ) ); 66 $this->assertSame( 'Content of Category 1', bbp_get_forum_content( $c ) ); 67 $this->assertSame( 'open', bbp_get_forum_status( $c ) ); 68 $this->assertSame( 'category', bbp_get_forum_type( $c ) ); 69 $this->assertTrue( bbp_is_forum( $c ) ); 70 $this->assertTrue( bbp_is_forum_category( $c ) ); 71 $this->assertTrue( bbp_is_forum_open( $c ) ); 72 $this->assertTrue( bbp_is_forum_public( $c ) ); 73 $this->assertFalse( bbp_is_forum_closed( $c ) ); 74 $this->assertFalse( bbp_is_forum_hidden( $c ) ); 75 $this->assertFalse( bbp_is_forum_private( $c ) ); 76 $this->assertSame( 0, bbp_get_forum_parent_id( $c ) ); 77 $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?forum=' . $category->post_name, $category->guid ); 45 78 46 79 // Forum post. … … 49 82 $this->assertSame( 'open', bbp_get_forum_status( $f ) ); 50 83 $this->assertSame( 'forum', bbp_get_forum_type( $f ) ); 84 $this->assertTrue( bbp_is_forum( $f ) ); 85 $this->assertTrue( bbp_is_forum_open( $f ) ); 51 86 $this->assertTrue( bbp_is_forum_public( $f ) ); 52 $this->assertSame( 0, bbp_get_forum_parent_id( $f ) ); 53 $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?forum=' . $forum->post_name, $forum->guid ); 87 $this->assertFalse( bbp_is_forum_closed( $f ) ); 88 $this->assertFalse( bbp_is_forum_hidden( $f ) ); 89 $this->assertFalse( bbp_is_forum_private( $f ) ); 90 $this->assertSame( $c, bbp_get_forum_parent_id( $f ) ); 91 $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?forum=' . $category->post_name . '/' . $forum->post_name, $forum->guid ); 92 93 // Category meta. 94 $this->assertSame( 1, bbp_get_forum_subforum_count( $c, true ) ); 95 $this->assertSame( 0, bbp_get_forum_topic_count( $c, false, true ) ); 96 $this->assertSame( 1, bbp_get_forum_topic_count( $c, true, true ) ); 97 $this->assertSame( 0, bbp_get_forum_topic_count_hidden( $c, true ) ); 98 $this->assertSame( 0, bbp_get_forum_reply_count( $c, false, true ) ); 99 $this->assertSame( 1, bbp_get_forum_reply_count( $c, true, true ) ); 100 $this->assertSame( 0, bbp_get_forum_post_count( $c, false, true ) ); 101 $this->assertSame( 2, bbp_get_forum_post_count( $c, true, true ) ); 102 $this->assertSame( $t, bbp_get_forum_last_topic_id( $c ) ); 103 $this->assertSame( $r, bbp_get_forum_last_reply_id( $c ) ); 104 $this->assertSame( $r, bbp_get_forum_last_active_id( $c ) ); 105 $this->assertSame( '4 days, 4 hours ago', bbp_get_forum_last_active_time( $c ) ); 54 106 55 107 // Forum meta. … … 60 112 $this->assertSame( 1, bbp_get_forum_reply_count( $f, false, true ) ); 61 113 $this->assertSame( 1, bbp_get_forum_reply_count( $f, true, true ) ); 114 62 115 $this->assertSame( 2, bbp_get_forum_post_count( $f, false, true ) ); 63 116 $this->assertSame( 2, bbp_get_forum_post_count( $f, true, true ) );
Note: See TracChangeset
for help on using the changeset viewer.