- Timestamp:
- 03/06/2026 06:02:38 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php
r59965 r61856 164 164 * @ticket 45016 165 165 * @ticket 61021 166 * @ticket 62574 .166 * @ticket 62574 167 167 */ 168 168 public function test_get_items() { 169 wp_set_current_user( self::$admin_id ); 170 $request = new WP_REST_Request( 'GET', self::$themes_route ); 171 172 $response = rest_get_server()->dispatch( $request ); 173 174 $this->assertSame( 200, $response->get_status() ); 175 $data = $response->get_data(); 176 177 $fields = array( 178 '_links', 179 'author', 180 'author_uri', 181 'description', 182 'is_block_theme', 183 'name', 184 'requires_php', 185 'requires_wp', 186 'screenshot', 187 'status', 188 'stylesheet', 189 'stylesheet_uri', 190 'tags', 191 'template', 192 'template_uri', 193 'textdomain', 194 'theme_uri', 195 'version', 196 ); 197 $this->assertIsArray( $data ); 198 $this->assertNotEmpty( $data ); 199 $this->assertSameSets( $fields, array_keys( $data[0] ) ); 200 201 $this->assertContains( 'twentytwenty', wp_list_pluck( $data, 'stylesheet' ) ); 202 $this->assertContains( get_stylesheet(), wp_list_pluck( $data, 'stylesheet' ) ); 203 } 204 205 /** 206 * Test retrieving a collection of active themes. 207 * 208 * @ticket 64719 209 */ 210 public function test_get_items_active() { 211 wp_set_current_user( self::$admin_id ); 212 169 213 $response = self::perform_active_theme_request(); 170 214 … … 197 241 ); 198 242 $this->assertIsArray( $data ); 199 $this->assert NotEmpty($data );243 $this->assertCount( 1, $data ); 200 244 $this->assertSameSets( $fields, array_keys( $data[0] ) ); 245 $this->assertEquals( array( 'rest-api' ), wp_list_pluck( $data, 'stylesheet' ) ); 201 246 } 202 247
Note: See TracChangeset
for help on using the changeset viewer.