Changeset 7795
- Timestamp:
- 10/04/2026 09:01:45 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/testcases/admin/tools.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/admin/tools.php
r7762 r7795 911 911 /** 912 912 * @covers ::bbp_admin_repair_sticky 913 * @todo Implement test_bbp_admin_repair_sticky().914 913 */ 915 914 public function test_bbp_admin_repair_sticky() { 916 // Remove the following lines when you implement this test. 917 $this->markTestIncomplete( 918 'This test has not been implemented yet.' 919 ); 915 $first_forum = $this->factory->forum->create(); 916 $second_forum = $this->factory->forum->create(); 917 $topic_id = $this->factory->topic->create( array( 'post_parent' => $first_forum ) ); 918 update_post_meta( $first_forum, '_bbp_sticky_topics', array( $topic_id ) ); 919 update_post_meta( $second_forum, '_bbp_sticky_topics', array( $topic_id ) ); 920 921 $this->assertSame( 0, bbp_admin_repair_sticky()[0] ); 922 $this->assertSame( array( $topic_id ), get_post_meta( $first_forum, '_bbp_sticky_topics', true ) ); 923 $this->assertSame( '', get_post_meta( $second_forum, '_bbp_sticky_topics', true ) ); 920 924 } 921 925 922 926 /** 923 927 * @covers ::bbp_admin_repair_closed_topics 924 * @todo Implement test_bbp_admin_repair_closed_topics().925 928 */ 926 929 public function test_bbp_admin_repair_closed_topics() { 927 // Remove the following lines when you implement this test. 928 $this->markTestIncomplete( 929 'This test has not been implemented yet.' 930 ); 930 $topic_id = $this->factory->topic->create( array( 'post_status' => bbp_get_closed_status_id() ) ); 931 delete_post_meta( $topic_id, '_bbp_status' ); 932 933 $result = bbp_admin_repair_closed_topics(); 934 $this->assertSame( 0, $result[0] ); 935 $this->assertStringContainsString( '1 closed topic repaired', $result[1] ); 936 $this->assertSame( 'publish', get_post_meta( $topic_id, '_bbp_status', true ) ); 937 $this->assertStringContainsString( '0 closed topics repaired', bbp_admin_repair_closed_topics()[1] ); 931 938 } 932 939 … … 999 1006 /** 1000 1007 * @covers ::bbp_admin_repair_topic_meta 1001 * @todo Implement test_bbp_admin_repair_topic_meta().1002 1008 */ 1003 1009 public function test_bbp_admin_repair_topic_meta() { 1004 // Remove the following lines when you implement this test. 1005 $this->markTestIncomplete( 1006 'This test has not been implemented yet.' 1007 ); 1010 $forum_id = $this->factory->forum->create(); 1011 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 1012 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 1013 update_post_meta( $topic_id, '_bbp_topic_id', 999 ); 1014 update_post_meta( $reply_id, '_bbp_topic_id', 999 ); 1015 1016 $this->assertSame( 0, bbp_admin_repair_topic_meta()[0] ); 1017 $this->assertSame( (string) $topic_id, get_post_meta( $topic_id, '_bbp_topic_id', true ) ); 1018 $this->assertSame( (string) $topic_id, get_post_meta( $reply_id, '_bbp_topic_id', true ) ); 1008 1019 } 1009 1020 1010 1021 /** 1011 1022 * @covers ::bbp_admin_repair_reply_menu_order 1012 * @todo Implement test_bbp_admin_repair_reply_menu_order().1013 1023 */ 1014 1024 public function test_bbp_admin_repair_reply_menu_order() { 1015 // Remove the following lines when you implement this test. 1016 $this->markTestIncomplete( 1017 'This test has not been implemented yet.' 1018 ); 1025 $topic_id = $this->factory->topic->create(); 1026 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 1027 update_post_meta( $reply_id, '_bbp_reply_to', $reply_id ); 1028 1029 $this->assertSame( 1, bbp_admin_repair_reply_menu_order()[0] ); 1030 $this->assertFalse( metadata_exists( 'post', $reply_id, '_bbp_reply_to' ) ); 1019 1031 } 1020 1032
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)