- Timestamp:
- 01/24/2023 02:34:10 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php
r54088 r55125 93 93 ) 94 94 ); 95 96 $test_registry->register( 97 'test/three', 98 array( 99 'title' => 'Pattern Three', 100 'categories' => array( 'test', 'buttons', 'query' ), 101 'content' => '<!-- wp:paragraph --><p>Three</p><!-- /wp:paragraph -->', 102 ) 103 ); 95 104 } 96 105 … … 173 182 174 183 /** 184 * Tests the proper migration of old core pattern categories to new ones. 185 * 186 * @since 6.2.0 187 * 188 * @ticket 57532 189 * 190 * @covers WP_REST_Block_Patterns_Controller::get_items 191 */ 192 public function test_get_items_migrate_pattern_categories() { 193 wp_set_current_user( self::$admin_id ); 194 195 $request = new WP_REST_Request( 'GET', static::REQUEST_ROUTE ); 196 $request['_fields'] = 'name,categories'; 197 $response = rest_get_server()->dispatch( $request ); 198 $data = $response->get_data(); 199 200 $this->assertIsArray( $data, 'WP_REST_Block_Patterns_Controller::get_items() should return an array' ); 201 $this->assertGreaterThanOrEqual( 3, count( $data ), 'WP_REST_Block_Patterns_Controller::get_items() should return at least 3 items' ); 202 $this->assertSame( 203 array( 204 'name' => 'test/one', 205 'categories' => array( 'test' ), 206 ), 207 $data[0], 208 'WP_REST_Block_Patterns_Controller::get_items() should return test/one' 209 ); 210 $this->assertSame( 211 array( 212 'name' => 'test/two', 213 'categories' => array( 'test' ), 214 ), 215 $data[1], 216 'WP_REST_Block_Patterns_Controller::get_items() should return test/two' 217 ); 218 $this->assertSame( 219 array( 220 'name' => 'test/three', 221 'categories' => array( 'test', 'call-to-action', 'posts' ), 222 ), 223 $data[2], 224 'WP_REST_Block_Patterns_Controller::get_items() should return test/three' 225 ); 226 } 227 228 /** 175 229 * @doesNotPerformAssertions 176 230 */
Note: See TracChangeset
for help on using the changeset viewer.