Changeset 61170
- Timestamp:
- 11/06/2025 09:11:10 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/isPostStatusViewable.php
r60809 r61170 3 3 /** 4 4 * @group post 5 * 6 * @covers is_post_status_viewable 5 7 */ 6 8 class Tests_Post_IsPostStatusViewable extends WP_UnitTestCase { … … 22 24 * 23 25 * @ticket 49380 26 * 24 27 * @dataProvider data_custom_post_statuses 25 28 * … … 47 50 * } 48 51 */ 49 public function data_custom_post_statuses() {52 public static function data_custom_post_statuses() { 50 53 return array( 51 // 0. False for non-publicly queryable types. 52 array( 54 'false for non-publicly queryable types' => array( 53 55 array( 54 56 'publicly_queryable' => false, … … 58 60 false, 59 61 ), 60 // 1. True for publicly queryable types. 61 array( 62 'true for publicly queryable types' => array( 62 63 array( 63 64 'publicly_queryable' => true, … … 67 68 true, 68 69 ), 69 // 2. False for built-in non-public types. 70 array( 70 'false for built-in non-public types' => array( 71 71 array( 72 72 'publicly_queryable' => false, … … 76 76 false, 77 77 ), 78 // 3. False for non-built-in public types. 79 array( 78 'false for non-built-in public types' => array( 80 79 array( 81 80 'publicly_queryable' => false, … … 85 84 false, 86 85 ), 87 // 4. True for built-in public types. 88 array( 86 'true for built-in public types' => array( 89 87 array( 90 88 'publicly_queryable' => false, … … 100 98 * Test built-in and unregistered post status. 101 99 * 102 * @dataProvider data_built_unregistered_in_status_types103 100 * @ticket 49380 101 * 102 * @dataProvider data_built_in_and_unregistered_status_types 104 103 * 105 104 * @param mixed $status Post status to check. 106 105 * @param bool $expected Expected viewable status. 107 106 */ 108 public function test_built_ unregistered_in_status_types( $status, $expected ) {107 public function test_built_in_and_unregistered_status_types( $status, $expected ) { 109 108 // Test status passed as string. 110 109 $this->assertSame( $expected, is_post_status_viewable( $status ) ); … … 121 120 * } 122 121 */ 123 public function data_built_unregistered_in_status_types() {122 public static function data_built_in_and_unregistered_status_types() { 124 123 return array( 125 array( 'publish', true ),126 array( 'future', false ),127 array( 'draft', false ),128 array( 'pending', false ),129 array( 'private', false ),130 array( 'trash', false ),131 array( 'auto-draft', false ),132 array( 'inherit', false ),133 array( 'request-pending', false ),134 array( 'request-confirmed', false ),135 array( 'request-failed', false ),136 array( 'request-completed', false ),124 'publish' => array( 'publish', true ), 125 'future' => array( 'future', false ), 126 'draft' => array( 'draft', false ), 127 'pending' => array( 'pending', false ), 128 'private' => array( 'private', false ), 129 'trash' => array( 'trash', false ), 130 'auto-draft' => array( 'auto-draft', false ), 131 'inherit' => array( 'inherit', false ), 132 'request-pending' => array( 'request-pending', false ), 133 'request-confirmed' => array( 'request-confirmed', false ), 134 'request-failed' => array( 'request-failed', false ), 135 'request-completed' => array( 'request-completed', false ), 137 136 138 137 // Various unregistered statuses. 139 array( 'unregistered-status', false ), 140 array( false, false ), 141 array( true, false ), 142 array( 20, false ), 143 array( '', false ), 138 'unregistered' => array( 'unregistered-status', false ), 139 'false' => array( false, false ), 140 'true' => array( true, false ), 141 'number 20' => array( 20, false ), 142 'null' => array( null, false ), 143 'empty string' => array( '', false ), 144 144 ); 145 145 }
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)