Changeset 57559 for trunk/tests/phpunit/tests/blocks/register.php
- Timestamp:
- 02/08/2024 08:16:59 AM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/register.php
r57493 r57559 61 61 } 62 62 63 foreach ( wp_scripts()->registered as $script_handle => $script ) { 64 if ( str_starts_with( $script_handle, 'unit-tests-' ) ) { 65 wp_deregister_script( $script_handle ); 66 } 67 } 68 63 69 parent::tear_down(); 64 70 } … … 227 233 228 234 /** 229 * @expectedIncorrectUsage register_block_script_handle 230 * @ticket 50263 231 */ 232 public function test_missing_asset_file_register_block_script_handle() { 235 * @ticket 50263 236 */ 237 public function test_handle_passed_register_block_script_handle() { 238 $metadata = array( 239 'script' => 'test-script-handle', 240 ); 241 $result = register_block_script_handle( $metadata, 'script' ); 242 243 $this->assertSame( 'test-script-handle', $result ); 244 } 245 246 public function test_handles_passed_register_block_script_handles() { 247 $metadata = array( 248 'script' => array( 'test-script-handle', 'test-script-handle-2' ), 249 ); 250 251 $result = register_block_script_handle( $metadata, 'script' ); 252 $this->assertSame( 'test-script-handle', $result ); 253 254 $result = register_block_script_handle( $metadata, 'script', 1 ); 255 $this->assertSame( 'test-script-handle-2', $result, 1 ); 256 } 257 258 /** 259 * @ticket 50263 260 * @ticket 60460 261 */ 262 public function test_missing_asset_file_register_block_script_handle_with_default_settings() { 233 263 $metadata = array( 234 264 'file' => __FILE__, … … 238 268 $result = register_block_script_handle( $metadata, 'script' ); 239 269 240 $this->assertFalse( $result ); 241 } 242 243 /** 244 * @ticket 50263 245 */ 246 public function test_handle_passed_register_block_script_handle() { 247 $metadata = array( 248 'script' => 'test-script-handle', 249 ); 250 $result = register_block_script_handle( $metadata, 'script' ); 251 252 $this->assertSame( 'test-script-handle', $result ); 253 } 254 255 public function test_handles_passed_register_block_script_handles() { 256 $metadata = array( 257 'script' => array( 'test-script-handle', 'test-script-handle-2' ), 258 ); 259 260 $result = register_block_script_handle( $metadata, 'script' ); 261 $this->assertSame( 'test-script-handle', $result ); 262 263 $result = register_block_script_handle( $metadata, 'script', 1 ); 264 $this->assertSame( 'test-script-handle-2', $result, 1 ); 270 $this->assertSame( 'unit-tests-test-block-script', $result ); 265 271 } 266 272
Note: See TracChangeset
for help on using the changeset viewer.