Changeset 46251 for trunk/tests/phpunit/tests/multisite.php
- Timestamp:
- 09/23/2019 05:34:20 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite.php
r45607 r46251 35 35 $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] ); 36 36 } 37 38 /** 39 * @ticket 37392 40 */ 41 function test_wp_count_sites() { 42 // create a random number of sites with each status. 43 $site_ids = array( 44 'public' => self::factory()->blog->create_many( 45 random_int( 0, 5 ), 46 array( 'meta' => array( 'public' => 1 ) ) 47 ), 48 'archived' => self::factory()->blog->create_many( 49 random_int( 0, 5 ), 50 array( 'meta' => array( 'archived' => 1 ) ) 51 ), 52 'mature' => self::factory()->blog->create_many( 53 random_int( 0, 5 ), 54 array( 'meta' => array( 'mature' => 1 ) ) 55 ), 56 'spam' => self::factory()->blog->create_many( 57 random_int( 0, 5 ), 58 array( 'meta' => array( 'spam' => 1 ) ) 59 ), 60 'deleted' => self::factory()->blog->create_many( 61 random_int( 0, 5 ), 62 array( 'meta' => array( 'deleted' => 1 ) ) 63 ), 64 ); 65 66 $counts = wp_count_sites(); 67 68 $counts_by_status = array_map( 'count', $site_ids ); 69 $expected = array_merge( 70 array( 'all' => array_sum( $counts_by_status ) ), 71 $counts_by_status 72 ); 73 // add 1 to all & public for the main site. 74 $expected['all'] += 1; 75 $expected['public'] += 1; 76 77 $this->assertEquals( $expected, $counts ); 78 } 37 79 } 38 80
Note: See TracChangeset
for help on using the changeset viewer.