Changeset 7778
- Timestamp:
- 10/04/2026 07:26:39 AM (6 weeks ago)
- Location:
- trunk/tests/phpunit/testcases
- Files:
-
- 2 edited
-
replies/template/status.php (modified) (3 diffs)
-
topics/template/status.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/replies/template/status.php
r7353 r7778 28 28 * @covers ::bbp_reply_status 29 29 * @covers ::bbp_get_reply_status 30 * @todo Implement test_bbp_get_reply_status().31 30 */ 32 31 public function test_bbp_get_reply_status() { 33 // Remove the following lines when you implement this test. 34 $this->markTestIncomplete( 35 'This test has not been implemented yet.' 36 ); 37 32 $topic_id = $this->factory->topic->create(); 33 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 34 35 $this->assertSame( bbp_get_public_status_id(), bbp_get_reply_status( $reply_id ) ); 36 wp_update_post( array( 'ID' => $reply_id, 'post_status' => bbp_get_pending_status_id() ) ); 37 $this->assertSame( bbp_get_pending_status_id(), bbp_get_reply_status( $reply_id ) ); 38 $this->expectOutputString( bbp_get_pending_status_id() ); 39 bbp_reply_status( $reply_id ); 40 } 41 42 /** 43 * @covers ::bbp_is_reply_public 44 */ 45 public function test_bbp_is_reply_public() { 46 $topic_id = $this->factory->topic->create(); 47 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 48 49 $this->assertTrue( bbp_is_reply_public( $reply_id ) ); 50 wp_update_post( array( 'ID' => $reply_id, 'post_status' => bbp_get_pending_status_id() ) ); 51 $this->assertFalse( bbp_is_reply_public( $reply_id ) ); 38 52 } 39 53 … … 115 129 /** 116 130 * @covers ::bbp_is_reply_trash 117 * @todo Implement test_bbp_is_reply_trash().118 131 */ 119 132 public function test_bbp_is_reply_trash() { 120 // Remove the following lines when you implement this test. 121 $this->markTestIncomplete( 122 'This test has not been implemented yet.' 123 ); 133 $topic_id = $this->factory->topic->create(); 134 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 135 136 $this->assertFalse( bbp_is_reply_trash( $reply_id ) ); 137 wp_trash_post( $reply_id ); 138 $this->assertTrue( bbp_is_reply_trash( $reply_id ) ); 124 139 } 125 140 … … 203 218 /** 204 219 * @covers ::bbp_is_reply_anonymous 205 * @todo Implement test_bbp_is_reply_anonymous().206 220 */ 207 221 public function test_bbp_is_reply_anonymous() { 208 // Remove the following lines when you implement this test. 209 $this->markTestIncomplete( 210 'This test has not been implemented yet.' 211 ); 222 $user_id = $this->factory->user->create(); 223 $topic_id = $this->factory->topic->create(); 224 $reply_id = $this->factory->reply->create( array( 225 'post_author' => $user_id, 226 'post_parent' => $topic_id, 227 ) ); 228 229 $this->assertFalse( bbp_is_reply_anonymous( $reply_id ) ); 230 update_post_meta( $reply_id, '_bbp_anonymous_name', 'Guest' ); 231 $this->assertTrue( bbp_is_reply_anonymous( $reply_id ) ); 232 delete_post_meta( $reply_id, '_bbp_anonymous_name' ); 233 update_post_meta( $reply_id, '_bbp_anonymous_email', 'guest@example.org' ); 234 $this->assertTrue( bbp_is_reply_anonymous( $reply_id ) ); 235 delete_post_meta( $reply_id, '_bbp_anonymous_email' ); 236 wp_update_post( array( 'ID' => $reply_id, 'post_author' => 0 ) ); 237 $this->assertTrue( bbp_is_reply_anonymous( $reply_id ) ); 212 238 } 213 239 } -
trunk/tests/phpunit/testcases/topics/template/status.php
r5749 r7778 12 12 /** 13 13 * @covers ::bbp_is_topic_sticky 14 * @todo Implement test_bbp_is_topic_sticky().15 14 */ 16 15 public function test_bbp_is_topic_sticky() { 17 // Remove the following lines when you implement this test. 18 $this->markTestIncomplete( 19 'This test has not been implemented yet.' 20 ); 16 $forum_id = $this->factory->forum->create(); 17 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 18 19 $this->assertFalse( bbp_is_topic_sticky( $topic_id ) ); 20 $this->assertTrue( bbp_stick_topic( $topic_id ) ); 21 $this->assertTrue( bbp_is_topic_sticky( $topic_id ) ); 22 $this->assertTrue( bbp_is_topic_sticky( $topic_id, false ) ); 21 23 } 22 24 23 25 /** 24 26 * @covers ::bbp_is_topic_super_sticky 25 * @todo Implement test_bbp_is_topic_super_sticky().26 27 */ 27 28 public function test_bbp_is_topic_super_sticky() { 28 // Remove the following lines when you implement this test. 29 $this->markTestIncomplete( 30 'This test has not been implemented yet.' 31 ); 29 $forum_id = $this->factory->forum->create(); 30 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 31 32 $this->assertFalse( bbp_is_topic_super_sticky( $topic_id ) ); 33 $this->assertTrue( bbp_stick_topic( $topic_id, true ) ); 34 $this->assertTrue( bbp_is_topic_super_sticky( $topic_id ) ); 35 $this->assertTrue( bbp_is_topic_sticky( $topic_id ) ); 36 $this->assertFalse( bbp_is_topic_sticky( $topic_id, false ) ); 32 37 } 33 38 34 39 /** 35 40 * @covers ::bbp_topic_status 36 * @todo Implement test_bbp_topic_status().37 41 */ 38 42 public function test_bbp_topic_status() { 39 // Remove the following lines when you implement this test.40 $this->markTestIncomplete( 41 'This test has not been implemented yet.'42 );43 $topic_id = $this->factory->topic->create(); 44 45 $this->expectOutputString( bbp_get_public_status_id() ); 46 bbp_topic_status( $topic_id ); 43 47 } 44 48 45 49 /** 46 50 * @covers ::bbp_get_topic_status 47 * @todo Implement test_bbp_get_topic_status().48 51 */ 49 52 public function test_bbp_get_topic_status() { 50 // Remove the following lines when you implement this test. 51 $this->markTestIncomplete( 52 'This test has not been implemented yet.' 53 ); 53 $topic_id = $this->factory->topic->create(); 54 55 $this->assertSame( bbp_get_public_status_id(), bbp_get_topic_status( $topic_id ) ); 56 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_closed_status_id() ) ); 57 $this->assertSame( bbp_get_closed_status_id(), bbp_get_topic_status( $topic_id ) ); 54 58 } 55 59 56 60 /** 57 61 * @covers ::bbp_is_topic_closed 58 * @todo Implement test_bbp_is_topic_closed().59 62 */ 60 63 public function test_bbp_is_topic_closed() { 61 // Remove the following lines when you implement this test. 62 $this->markTestIncomplete( 63 'This test has not been implemented yet.' 64 ); 64 $topic_id = $this->factory->topic->create(); 65 66 $this->assertFalse( bbp_is_topic_closed( $topic_id ) ); 67 bbp_close_topic( $topic_id ); 68 $this->assertTrue( bbp_is_topic_closed( $topic_id ) ); 65 69 } 66 70 67 71 /** 68 72 * @covers ::bbp_is_topic_open 69 * @todo Implement test_bbp_is_topic_open().70 73 */ 71 74 public function test_bbp_is_topic_open() { 72 // Remove the following lines when you implement this test. 73 $this->markTestIncomplete( 74 'This test has not been implemented yet.' 75 ); 75 $topic_id = $this->factory->topic->create(); 76 77 $this->assertTrue( bbp_is_topic_open( $topic_id ) ); 78 bbp_close_topic( $topic_id ); 79 $this->assertFalse( bbp_is_topic_open( $topic_id ) ); 80 bbp_open_topic( $topic_id ); 81 $this->assertTrue( bbp_is_topic_open( $topic_id ) ); 82 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_pending_status_id() ) ); 83 $this->assertTrue( bbp_is_topic_open( $topic_id ) ); 84 } 85 86 /** 87 * @covers ::bbp_is_topic_public 88 */ 89 public function test_bbp_is_topic_public() { 90 $topic_id = $this->factory->topic->create(); 91 92 $this->assertTrue( bbp_is_topic_public( $topic_id ) ); 93 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_closed_status_id() ) ); 94 $this->assertTrue( bbp_is_topic_public( $topic_id ) ); 95 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_pending_status_id() ) ); 96 $this->assertFalse( bbp_is_topic_public( $topic_id ) ); 76 97 } 77 98 78 99 /** 79 100 * @covers ::bbp_is_topic_published 80 * @todo Implement test_bbp_is_topic_published().81 101 */ 82 102 public function test_bbp_is_topic_published() { 83 // Remove the following lines when you implement this test. 84 $this->markTestIncomplete( 85 'This test has not been implemented yet.' 86 ); 103 $topic_id = $this->factory->topic->create(); 104 105 $this->assertTrue( bbp_is_topic_published( $topic_id ) ); 106 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_pending_status_id() ) ); 107 $this->assertFalse( bbp_is_topic_published( $topic_id ) ); 87 108 } 88 109 89 110 /** 90 111 * @covers ::bbp_is_topic_spam 91 * @todo Implement test_bbp_is_topic_spam().92 112 */ 93 113 public function test_bbp_is_topic_spam() { 94 // Remove the following lines when you implement this test. 95 $this->markTestIncomplete( 96 'This test has not been implemented yet.' 97 ); 114 $topic_id = $this->factory->topic->create(); 115 116 $this->assertFalse( bbp_is_topic_spam( $topic_id ) ); 117 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_spam_status_id() ) ); 118 $this->assertTrue( bbp_is_topic_spam( $topic_id ) ); 98 119 } 99 120 100 121 /** 101 122 * @covers ::bbp_is_topic_trash 102 * @todo Implement test_bbp_is_topic_trash().103 123 */ 104 124 public function test_bbp_is_topic_trash() { 105 // Remove the following lines when you implement this test. 106 $this->markTestIncomplete( 107 'This test has not been implemented yet.' 108 ); 125 $topic_id = $this->factory->topic->create(); 126 127 $this->assertFalse( bbp_is_topic_trash( $topic_id ) ); 128 wp_trash_post( $topic_id ); 129 $this->assertTrue( bbp_is_topic_trash( $topic_id ) ); 109 130 } 110 131 111 132 /** 112 133 * @covers ::bbp_is_topic_pending 113 * @todo Implement test_bbp_is_topic_pending().114 134 */ 115 135 public function test_bbp_is_topic_pending() { 116 // Remove the following lines when you implement this test. 117 $this->markTestIncomplete( 118 'This test has not been implemented yet.' 119 ); 136 $topic_id = $this->factory->topic->create(); 137 138 $this->assertFalse( bbp_is_topic_pending( $topic_id ) ); 139 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_pending_status_id() ) ); 140 $this->assertTrue( bbp_is_topic_pending( $topic_id ) ); 120 141 } 121 142 122 143 /** 123 144 * @covers ::bbp_is_topic_private 124 * @todo Implement test_bbp_is_topic_private().125 145 */ 126 146 public function test_bbp_is_topic_private() { 127 // Remove the following lines when you implement this test. 128 $this->markTestIncomplete( 129 'This test has not been implemented yet.' 130 ); 147 $topic_id = $this->factory->topic->create(); 148 149 $this->assertFalse( bbp_is_topic_private( $topic_id ) ); 150 wp_update_post( array( 'ID' => $topic_id, 'post_status' => bbp_get_private_status_id() ) ); 151 $this->assertTrue( bbp_is_topic_private( $topic_id ) ); 131 152 } 132 153 133 154 /** 134 155 * @covers ::bbp_is_topic_anonymous 135 * @todo Implement test_bbp_is_topic_anonymous().136 156 */ 137 157 public function test_bbp_is_topic_anonymous() { 138 // Remove the following lines when you implement this test. 139 $this->markTestIncomplete( 140 'This test has not been implemented yet.' 141 ); 158 $user_id = $this->factory->user->create(); 159 $topic_id = $this->factory->topic->create( array( 'post_author' => $user_id ) ); 160 161 $this->assertFalse( bbp_is_topic_anonymous( $topic_id ) ); 162 update_post_meta( $topic_id, '_bbp_anonymous_name', 'Guest' ); 163 $this->assertTrue( bbp_is_topic_anonymous( $topic_id ) ); 164 delete_post_meta( $topic_id, '_bbp_anonymous_name' ); 165 update_post_meta( $topic_id, '_bbp_anonymous_email', 'guest@example.org' ); 166 $this->assertTrue( bbp_is_topic_anonymous( $topic_id ) ); 167 delete_post_meta( $topic_id, '_bbp_anonymous_email' ); 168 wp_update_post( array( 'ID' => $topic_id, 'post_author' => 0 ) ); 169 $this->assertTrue( bbp_is_topic_anonymous( $topic_id ) ); 142 170 } 143 171 }
Note:
See TracChangeset
for help on using the changeset viewer.