Changeset 7767
- Timestamp:
- 10/02/2026 07:44:53 AM (3 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/replies/functions/status.php
r7475 r7767 12 12 /** 13 13 * @covers ::bbp_get_reply_statuses 14 * @todo Implement test_bbp_get_reply_statuses().15 14 */ 16 15 public function test_bbp_get_reply_statuses() { 17 // Remove the following lines when you implement this test. 18 $this->markTestIncomplete( 19 'This test has not been implemented yet.' 16 $statuses = array( 17 bbp_get_public_status_id() => _x( 'Publish', 'Publish the reply', 'bbpress' ), 18 bbp_get_spam_status_id() => _x( 'Spam', 'Spam the reply', 'bbpress' ), 19 bbp_get_trash_status_id() => _x( 'Trash', 'Trash the reply', 'bbpress' ), 20 bbp_get_pending_status_id() => _x( 'Pending', 'Mark reply as pending', 'bbpress' ), 20 21 ); 22 $this->assertSame( $statuses, bbp_get_reply_statuses() ); 23 24 $reply_id = 123; 25 $filter = function( $available, $id ) use ( $reply_id ) { 26 $this->assertSame( $reply_id, $id ); 27 $available['archived'] = 'Archived'; 28 return $available; 29 }; 30 add_filter( 'bbp_get_reply_statuses', $filter, 10, 2 ); 31 try { 32 $statuses['archived'] = 'Archived'; 33 $this->assertSame( $statuses, bbp_get_reply_statuses( $reply_id ) ); 34 } finally { 35 remove_filter( 'bbp_get_reply_statuses', $filter ); 36 } 37 } 38 39 /** 40 * @covers ::bbp_get_reply_toggles 41 */ 42 public function test_bbp_get_reply_toggles() { 43 $toggles = array( 44 'bbp_toggle_reply_spam', 45 'bbp_toggle_reply_trash', 46 'bbp_toggle_reply_approve', 47 ); 48 $this->assertSame( $toggles, bbp_get_reply_toggles() ); 49 50 $reply_id = 123; 51 $filter = function( $available, $id ) use ( $reply_id ) { 52 $this->assertSame( $reply_id, $id ); 53 $available[] = 'bbp_toggle_reply_archive'; 54 return $available; 55 }; 56 add_filter( 'bbp_get_toggle_reply_actions', $filter, 10, 2 ); 57 try { 58 $toggles[] = 'bbp_toggle_reply_archive'; 59 $this->assertSame( $toggles, bbp_get_reply_toggles( $reply_id ) ); 60 } finally { 61 remove_filter( 'bbp_get_toggle_reply_actions', $filter ); 62 } 63 } 64 65 /** 66 * @covers ::bbp_get_public_reply_statuses 67 */ 68 public function test_bbp_get_public_reply_statuses() { 69 $this->assertSame( array( bbp_get_public_status_id() ), bbp_get_public_reply_statuses() ); 70 71 $filter = function( $statuses ) { 72 $statuses[] = 'archived'; 73 return $statuses; 74 }; 75 add_filter( 'bbp_get_public_reply_statuses', $filter ); 76 try { 77 $this->assertSame( array( bbp_get_public_status_id(), 'archived' ), bbp_get_public_reply_statuses() ); 78 } finally { 79 remove_filter( 'bbp_get_public_reply_statuses', $filter ); 80 } 81 } 82 83 /** 84 * @covers ::bbp_get_non_public_reply_statuses 85 */ 86 public function test_bbp_get_non_public_reply_statuses() { 87 $statuses = array( 88 bbp_get_trash_status_id(), 89 bbp_get_spam_status_id(), 90 bbp_get_pending_status_id(), 91 ); 92 $this->assertSame( $statuses, bbp_get_non_public_reply_statuses() ); 93 94 $filter = function( $available ) { 95 $available[] = 'archived'; 96 return $available; 97 }; 98 add_filter( 'bbp_get_non_public_reply_statuses', $filter ); 99 try { 100 $statuses[] = 'archived'; 101 $this->assertSame( $statuses, bbp_get_non_public_reply_statuses() ); 102 } finally { 103 remove_filter( 'bbp_get_non_public_reply_statuses', $filter ); 104 } 21 105 } 22 106
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)