[ Index ] |
PHP Cross Reference of BBPress |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Tests for the forum component query functions. 5 * 6 * @group forums 7 * @group functions 8 * @group query 9 */ 10 class BBP_Tests_Forums_Functions_Query extends BBP_UnitTestCase { 11 12 /** 13 * @covers ::bbp_exclude_forum_ids 14 * @todo Implement test_bbp_exclude_forum_ids(). 15 */ 16 public function test_bbp_exclude_forum_ids() { 17 // Remove the following lines when you implement this test. 18 $this->markTestIncomplete( 19 'This test has not been implemented yet.' 20 ); 21 } 22 23 /** 24 * @covers ::bbp_forum_query_topic_ids 25 */ 26 public function test_bbp_forum_query_topic_ids() { 27 $f = $this->factory->forum->create(); 28 29 $t1 = $this->factory->topic->create( array( 30 'post_parent' => $f, 31 'topic_meta' => array( 32 'forum_id' => $f, 33 ), 34 ) ); 35 36 $t2 = $this->factory->topic->create( array( 37 'post_parent' => $f, 38 'topic_meta' => array( 39 'forum_id' => $f, 40 ), 41 ) ); 42 43 $t3 = $this->factory->topic->create( array( 44 'post_parent' => $f, 45 'topic_meta' => array( 46 'forum_id' => $f, 47 ), 48 ) ); 49 50 $this->assertEqualSets( array( $t1, $t2, $t3 ), bbp_forum_query_topic_ids( $f ) ); 51 } 52 53 /** 54 * @covers ::bbp_forum_query_subforum_ids 55 */ 56 public function test_bbp_forum_query_subforum_ids() { 57 $f1 = $this->factory->forum->create(); 58 59 $f2 = $this->factory->forum->create( array( 60 'post_parent' => $f1, 61 ) ); 62 63 $f3 = $this->factory->forum->create( array( 64 'post_parent' => $f1, 65 ) ); 66 67 $this->assertEqualSets( array( $f2, $f3 ), bbp_forum_query_subforum_ids( $f1 ) ); 68 } 69 70 /** 71 * @covers ::bbp_forum_query_last_reply_id 72 */ 73 public function test_bbp_forum_query_last_reply_id() { 74 $c = $this->factory->forum->create( array( 75 'forum_meta' => array( 76 'forum_type' => 'category', 77 'status' => 'open', 78 ), 79 ) ); 80 81 $f = $this->factory->forum->create( array( 82 'post_parent' => $c, 83 'forum_meta' => array( 84 'forum_id' => $c, 85 'forum_type' => 'forum', 86 'status' => 'open', 87 ), 88 ) ); 89 90 $t = $this->factory->topic->create( array( 91 'post_parent' => $f, 92 'topic_meta' => array( 93 'forum_id' => $f, 94 ), 95 ) ); 96 97 $this->factory->reply->create( array( 98 'post_parent' => $t, 99 'reply_meta' => array( 100 'forum_id' => $f, 101 'topic_id' => $t, 102 ), 103 ) ); 104 105 // Get the forums last reply id. 106 $query_last_reply_f = bbp_forum_query_last_reply_id( $f ); 107 $this->assertSame( $query_last_reply_f, bbp_get_forum_last_reply_id( $f ) ); 108 109 // Get the categories last reply id. 110 $query_last_reply_c = bbp_forum_query_last_reply_id( $c ); 111 $this->assertSame( $query_last_reply_c, bbp_get_forum_last_reply_id( $c ) ); 112 113 $this->factory->reply->create( array( 114 'post_parent' => $t, 115 'reply_meta' => array( 116 'forum_id' => $f, 117 'topic_id' => $t, 118 ), 119 ) ); 120 121 // Get the forums last reply id. 122 $query_last_reply_f = bbp_forum_query_last_reply_id( $f ); 123 $this->assertSame( $query_last_reply_f, bbp_get_forum_last_reply_id( $f ) ); 124 125 // Get the categories last reply id. 126 $query_last_reply_c = bbp_forum_query_last_reply_id( $c ); 127 $this->assertSame( $query_last_reply_c, bbp_get_forum_last_reply_id( $c ) ); 128 } 129 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Dec 7 01:00:51 2024 | Cross-referenced by PHPXref 0.7.1 |