[ Index ] |
PHP Cross Reference of BBPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Tests for the core update functions. 4 * 5 * @group core 6 * @group update 7 */ 8 class BBP_Tests_Core_Update extends BBP_UnitTestCase { 9 10 /** 11 * @covers ::bbp_is_install 12 * @todo Implement test_bbp_is_install(). 13 */ 14 public function test_bbp_is_install() { 15 // Remove the following lines when you implement this test. 16 $this->markTestIncomplete( 17 'This test has not been implemented yet.' 18 ); 19 } 20 21 /** 22 * @covers ::bbp_is_update 23 * @todo Implement test_bbp_is_update(). 24 */ 25 public function test_bbp_is_update() { 26 // Remove the following lines when you implement this test. 27 $this->markTestIncomplete( 28 'This test has not been implemented yet.' 29 ); 30 } 31 32 /** 33 * @covers ::bbp_is_activation 34 * @todo Implement test_bbp_is_activation(). 35 */ 36 public function test_bbp_is_activation() { 37 // Remove the following lines when you implement this test. 38 $this->markTestIncomplete( 39 'This test has not been implemented yet.' 40 ); 41 } 42 43 /** 44 * @covers ::bbp_is_deactivation 45 * @todo Implement test_bbp_is_deactivation(). 46 */ 47 public function test_bbp_is_deactivation() { 48 // Remove the following lines when you implement this test. 49 $this->markTestIncomplete( 50 'This test has not been implemented yet.' 51 ); 52 } 53 54 /** 55 * @covers ::bbp_version_bump 56 * @todo Implement test_bbp_version_bump(). 57 */ 58 public function test_bbp_version_bump() { 59 // Remove the following lines when you implement this test. 60 $this->markTestIncomplete( 61 'This test has not been implemented yet.' 62 ); 63 } 64 65 /** 66 * @covers ::bbp_setup_updater 67 * @todo Implement test_bbp_setup_updater(). 68 */ 69 public function test_bbp_setup_updater() { 70 // Remove the following lines when you implement this test. 71 $this->markTestIncomplete( 72 'This test has not been implemented yet.' 73 ); 74 } 75 76 /** 77 * @group canonical 78 * @covers ::bbp_create_initial_content 79 */ 80 public function test_bbp_create_initial_content() { 81 82 $category_id = $this->factory->forum->create( array( 83 'forum_meta' => array( 84 'forum_type' => 'category', 85 'status' => 'open', 86 ), 87 ) ); 88 89 $u = $this->factory->user->create(); 90 91 bbp_create_initial_content( array( 92 'forum_parent' => $category_id, 93 'forum_author' => $u, 94 'topic_author' => $u, 95 'reply_author' => $u 96 ) ); 97 98 $forum_id = bbp_forum_query_subforum_ids( $category_id ); 99 $forum_id = (int) $forum_id[0]; 100 $topic_id = bbp_get_forum_last_topic_id( $forum_id ); 101 $reply_id = bbp_get_forum_last_reply_id( $forum_id ); 102 103 // Forum post 104 $this->assertSame( 'General', bbp_get_forum_title( $forum_id ) ); 105 $this->assertSame( 'General Discussion', bbp_get_forum_content( $forum_id ) ); 106 $this->assertSame( 'open', bbp_get_forum_status( $forum_id ) ); 107 $this->assertTrue( bbp_is_forum_public( $forum_id ) ); 108 $this->assertSame( $category_id, bbp_get_forum_parent_id( $forum_id ) ); 109 110 // Topic post 111 $this->assertSame( $forum_id, bbp_get_topic_forum_id( $topic_id ) ); 112 $this->assertSame( 'Hello World!', bbp_get_topic_title( $topic_id ) ); 113 remove_all_filters( 'bbp_get_topic_content' ); 114 $topic_content = "This is the very first topic in these forums."; 115 $this->assertSame( $topic_content, bbp_get_topic_content( $topic_id ) ); 116 $this->assertSame( 'publish', bbp_get_topic_status( $topic_id ) ); 117 $this->assertTrue( bbp_is_topic_published( $topic_id ) ); 118 119 // Reply post 120 $this->assertSame( $forum_id, bbp_get_reply_forum_id( $reply_id ) ); 121 $this->assertSame( 'Reply To: Hello World!', bbp_get_reply_title( $reply_id ) ); 122 $this->assertSame( $reply_id, bbp_get_reply_title_fallback( $reply_id ) ); 123 remove_all_filters( 'bbp_get_reply_content' ); 124 $reply_content = "And this is the very first reply."; 125 $this->assertSame( $reply_content, bbp_get_reply_content( $reply_id ) ); 126 $this->assertSame( 'publish', bbp_get_reply_status( $reply_id ) ); 127 $this->assertTrue( bbp_is_reply_published( $reply_id ) ); 128 129 // Category meta 130 $this->assertSame( 1, bbp_get_forum_subforum_count( $category_id, true ) ); 131 $this->assertSame( 0, bbp_get_forum_topic_count( $category_id, false, true ) ); 132 $this->assertSame( 0, bbp_get_forum_topic_count_hidden( $category_id, true ) ); 133 $this->assertSame( 0, bbp_get_forum_reply_count( $category_id, false, true ) ); 134 $this->assertSame( 1, bbp_get_forum_topic_count( $category_id, true, true ) ); 135 $this->assertSame( 1, bbp_get_forum_reply_count( $category_id, true, true ) ); 136 $this->assertSame( 0, bbp_get_forum_post_count( $category_id, false, true ) ); 137 $this->assertSame( 2, bbp_get_forum_post_count( $category_id, true, true ) ); 138 $this->assertSame( $topic_id, bbp_get_forum_last_topic_id( $category_id ) ); 139 $this->assertSame( 'Hello World!', bbp_get_forum_last_topic_title( $category_id ) ); 140 $this->assertSame( $reply_id, bbp_get_forum_last_reply_id( $category_id ) ); 141 $this->assertSame( 'Reply To: Hello World!', bbp_get_forum_last_reply_title( $category_id ) ); 142 $this->assertSame( $reply_id, bbp_get_forum_last_active_id( $category_id ) ); 143 $this->assertSame( '1 day, 16 hours ago', bbp_get_forum_last_active_time( $category_id ) ); 144 145 // Forum meta 146 $this->assertSame( 0, bbp_get_forum_subforum_count( $forum_id, true ) ); 147 $this->assertSame( 1, bbp_get_forum_topic_count( $forum_id, false, true ) ); 148 $this->assertSame( 0, bbp_get_forum_topic_count_hidden( $forum_id, true ) ); 149 $this->assertSame( 1, bbp_get_forum_reply_count( $forum_id, false, true ) ); 150 $this->assertSame( 1, bbp_get_forum_topic_count( $forum_id, true, true ) ); 151 $this->assertSame( 1, bbp_get_forum_reply_count( $forum_id, true, true ) ); 152 $this->assertSame( 2, bbp_get_forum_post_count( $forum_id, false, true ) ); 153 $this->assertSame( 2, bbp_get_forum_post_count( $forum_id, true, true ) ); 154 $this->assertSame( $topic_id, bbp_get_forum_last_topic_id( $forum_id ) ); 155 $this->assertSame( 'Hello World!', bbp_get_forum_last_topic_title( $forum_id ) ); 156 $this->assertSame( $reply_id, bbp_get_forum_last_reply_id( $forum_id ) ); 157 $this->assertSame( 'Reply To: Hello World!', bbp_get_forum_last_reply_title( $forum_id ) ); 158 $this->assertSame( $reply_id, bbp_get_forum_last_active_id( $forum_id ) ); 159 $this->assertSame( '1 day, 16 hours ago', bbp_get_forum_last_active_time( $forum_id ) ); 160 161 // Topic meta 162 $this->assertSame( '127.0.0.1', bbp_current_author_ip( $topic_id ) ); 163 $this->assertSame( $forum_id, bbp_get_topic_forum_id( $topic_id ) ); 164 $this->assertSame( 1, bbp_get_topic_voice_count( $topic_id, true ) ); 165 $this->assertSame( 1, bbp_get_topic_reply_count( $topic_id, true ) ); 166 $this->assertSame( 0, bbp_get_topic_reply_count_hidden( $topic_id, true ) ); 167 $this->assertSame( $reply_id, bbp_get_topic_last_reply_id( $topic_id ) ); 168 $this->assertSame( $reply_id, bbp_get_topic_last_active_id( $topic_id ) ); 169 $this->assertSame( '1 day, 16 hours ago', bbp_get_topic_last_active_time( $topic_id ) ); 170 171 // Reply Meta 172 $this->assertSame( '127.0.0.1', bbp_current_author_ip( $reply_id ) ); 173 $this->assertSame( $forum_id, bbp_get_reply_forum_id( $reply_id ) ); 174 $this->assertSame( $topic_id, bbp_get_reply_topic_id( $reply_id ) ); 175 } 176 177 /** 178 * @covers ::bbp_version_updater 179 * @todo Implement test_bbp_version_updater(). 180 */ 181 public function test_bbp_version_updater() { 182 // Remove the following lines when you implement this test. 183 $this->markTestIncomplete( 184 'This test has not been implemented yet.' 185 ); 186 } 187 188 /** 189 * @covers ::bbp_add_activation_redirect 190 * @todo Implement test_bbp_add_activation_redirect(). 191 */ 192 public function test_bbp_add_activation_redirect() { 193 // Remove the following lines when you implement this test. 194 $this->markTestIncomplete( 195 'This test has not been implemented yet.' 196 ); 197 } 198 199 /** 200 * @covers ::bbp_make_current_user_keymaster 201 * @todo Implement test_bbp_make_current_user_keymaster(). 202 */ 203 public function test_bbp_make_current_user_keymaster() { 204 // Remove the following lines when you implement this test. 205 $this->markTestIncomplete( 206 'This test has not been implemented yet.' 207 ); 208 } 209 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Dec 21 01:00:52 2024 | Cross-referenced by PHPXref 0.7.1 |