Changeset 60253 for trunk/tests/phpunit/tests/query/conditionals.php
- Timestamp:
- 05/26/2025 02:34:12 PM (8 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/query/conditionals.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/conditionals.php
r56559 r60253 15 15 protected $post_ids; 16 16 17 /** 18 * ID of the user-a. 19 * 20 * @var int 21 */ 22 public static $user_a_id; 23 24 /** 25 * Set up the shared fixture. 26 * 27 * @param WP_UnitTest_Factory $factory Factory instance. 28 */ 29 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 30 self::$user_a_id = $factory->user->create( array( 'user_login' => 'user-a' ) ); 31 } 32 17 33 public function set_up() { 18 34 parent::set_up(); … … 589 605 // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]', 590 606 public function test_author_feed() { 591 self::factory()->user->create( array( 'user_login' => 'user-a' ) );592 607 // Check the long form. 593 608 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); … … 608 623 public function test_author_paged() { 609 624 update_option( 'posts_per_page', 2 ); 610 $user_id = self:: factory()->user->create( array( 'user_login' => 'user-a' ) );625 $user_id = self::$user_a_id; 611 626 self::factory()->post->create_many( 3, array( 'post_author' => $user_id ) ); 612 627 $this->go_to( '/author/user-a/page/2/' ); … … 616 631 // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]', 617 632 public function test_author() { 618 $user_id = self:: factory()->user->create( array( 'user_login' => 'user-a' ) );633 $user_id = self::$user_a_id; 619 634 self::factory()->post->create( array( 'post_author' => $user_id ) ); 620 635 $this->go_to( '/author/user-a/' ); … … 623 638 624 639 public function test_author_with_no_posts() { 625 $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );626 640 $this->go_to( '/author/user-a/' ); 627 641 $this->assertQueryTrue( 'is_archive', 'is_author' ); … … 1123 1137 */ 1124 1138 public function test_is_author_with_nicename_that_begins_with_a_number_that_clashes_with_another_author_id() { 1125 $u1 = self:: factory()->user->create();1139 $u1 = self::$user_a_id; 1126 1140 1127 1141 $u2_name = $u1 . '_user'; … … 1280 1294 1281 1295 // We need a non-post that shares an ID with a post assigned a template. 1282 $user_id = self:: factory()->user->create();1296 $user_id = self::$user_a_id; 1283 1297 if ( ! get_post( $user_id ) ) { 1284 1298 $post_id = self::factory()->post->create( array( 'post_type' => 'post' ) ); … … 1353 1367 */ 1354 1368 public function test_is_author_should_not_match_numeric_id_to_nickname_beginning_with_id() { 1355 $u1 = self::factory()->user->create( 1356 array( 1357 'nickname' => 'Foo', 1358 'user_nicename' => 'foo', 1359 ) 1360 ); 1369 $u1 = self::$user_a_id; 1361 1370 $u2 = self::factory()->user->create( 1362 1371 array( … … 1376 1385 */ 1377 1386 public function test_is_author_should_not_match_numeric_id_to_user_nicename_beginning_with_id() { 1378 $u1 = self::factory()->user->create( 1379 array( 1380 'nickname' => 'Foo', 1381 'user_nicename' => 'foo', 1382 ) 1383 ); 1387 $u1 = self::$user_a_id; 1384 1388 $u2 = self::factory()->user->create( 1385 1389 array(
Note: See TracChangeset
for help on using the changeset viewer.