Changeset 60253 for trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php
- Timestamp:
- 05/26/2025 02:34:12 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php
r51566 r60253 5 5 */ 6 6 class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase { 7 8 /** 9 * ID of the first user. 10 * 11 * @var int 12 */ 13 public static $user_id_1; 14 15 /** 16 * ID of the second user. 17 * 18 * @var int 19 */ 20 public static $user_id_2; 21 22 /** 23 * Set up the shared fixture. 24 * 25 * @param WP_UnitTest_Factory $factory Factory instance. 26 */ 27 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 28 self::$user_id_1 = $factory->user->create(); 29 self::$user_id_2 = $factory->user->create(); 30 } 7 31 8 32 public function test_post_type_post() { … … 60 84 public function test_public_only_true_should_not_allow_any_private_posts_for_loggedin_user() { 61 85 $current_user = get_current_user_id(); 62 $u = self:: factory()->user->create();86 $u = self::$user_id_1; 63 87 wp_set_current_user( $u ); 64 88 … … 71 95 public function test_public_only_should_default_to_false() { 72 96 $current_user = get_current_user_id(); 73 $u = self:: factory()->user->create();97 $u = self::$user_id_1; 74 98 wp_set_current_user( $u ); 75 99 … … 81 105 public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_current_user_matches_post_author() { 82 106 $current_user = get_current_user_id(); 83 $u = self:: factory()->user->create();107 $u = self::$user_id_1; 84 108 wp_set_current_user( $u ); 85 109 … … 92 116 public function test_public_only_false_should_not_allow_access_to_private_posts_if_current_user_is_not_post_author() { 93 117 $current_user = get_current_user_id(); 94 $u1 = self:: factory()->user->create();95 $u2 = self:: factory()->user->create();118 $u1 = self::$user_id_1; 119 $u2 = self::$user_id_2; 96 120 wp_set_current_user( $u1 ); 97 121 … … 104 128 public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_post_author_is_not_provided() { 105 129 $current_user = get_current_user_id(); 106 $u = self:: factory()->user->create();130 $u = self::$user_id_1; 107 131 wp_set_current_user( $u ); 108 132
Note: See TracChangeset
for help on using the changeset viewer.