Changeset 58420
- Timestamp:
- 06/16/2024 10:15:33 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/script-modules/wpScriptModules.php
r57987 r58420 123 123 124 124 $this->assertCount( 1, $enqueued_script_modules ); 125 $this->assert False( isset( $enqueued_script_modules['foo'] ));126 $this->assert True( isset( $enqueued_script_modules['bar'] ));125 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 126 $this->assertArrayHasKey( 'bar', $enqueued_script_modules ); 127 127 } 128 128 … … 150 150 151 151 $this->assertCount( 1, $enqueued_script_modules ); 152 $this->assert False( isset( $enqueued_script_modules['foo'] ));153 $this->assert True( isset( $enqueued_script_modules['bar'] ));152 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 153 $this->assertArrayHasKey( 'bar', $enqueued_script_modules ); 154 154 } 155 155 … … 169 169 170 170 $this->assertCount( 0, $enqueued_script_modules ); 171 $this->assert False( isset( $enqueued_script_modules['unexistent'] ));171 $this->assertArrayNotHasKey( 'unexistent', $enqueued_script_modules ); 172 172 } 173 173 … … 191 191 192 192 $this->assertCount( 0, $enqueued_script_modules ); 193 $this->assert False( isset( $enqueued_script_modules['foo'] ));193 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 194 194 195 195 $this->script_modules->deregister( 'foo' ); // Dequeued. … … 197 197 198 198 $this->assertCount( 0, $enqueued_script_modules ); 199 $this->assert False( isset( $enqueued_script_modules['foo'] ));199 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 200 200 } 201 201 … … 219 219 $this->assertCount( 1, $enqueued_script_modules ); 220 220 $this->assertStringStartsWith( '/foo.js', $enqueued_script_modules['foo'] ); 221 $this->assert False( isset( $enqueued_script_modules['bar'] ));221 $this->assertArrayNotHasKey( 'bar', $enqueued_script_modules ); 222 222 } 223 223 … … 243 243 244 244 $this->assertCount( 1, $enqueued_script_modules ); 245 $this->assert False( isset( $enqueued_script_modules['foo'] ));246 $this->assert True( isset( $enqueued_script_modules['bar'] ));245 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 246 $this->assertArrayHasKey( 'bar', $enqueued_script_modules ); 247 247 } 248 248 … … 267 267 $this->assertCount( 1, $import_map ); 268 268 $this->assertStringStartsWith( '/dep.js', $import_map['dep'] ); 269 $this->assert False( isset( $import_map['no-dep'] ));269 $this->assertArrayNotHasKey( 'no-dep', $import_map ); 270 270 } 271 271 … … 341 341 $this->assertStringStartsWith( '/nested-static-dep.js', $import_map['nested-static-dep'] ); 342 342 $this->assertStringStartsWith( '/nested-dynamic-dep.js', $import_map['nested-dynamic-dep'] ); 343 $this->assert False( isset( $import_map['no-dep'] ));343 $this->assertArrayNotHasKey( 'no-dep', $import_map ); 344 344 } 345 345 … … 410 410 $this->assertStringStartsWith( '/static-dep.js', $preloaded_script_modules['static-dep'] ); 411 411 $this->assertStringStartsWith( '/nested-static-dep.js', $preloaded_script_modules['nested-static-dep'] ); 412 $this->assert False( isset( $preloaded_script_modules['no-dep'] ));413 $this->assert False( isset( $preloaded_script_modules['dynamic-dep'] ));414 $this->assert False( isset( $preloaded_script_modules['nested-dynamic-dep'] ));412 $this->assertArrayNotHasKey( 'dynamic-dep', $preloaded_script_modules ); 413 $this->assertArrayNotHasKey( 'nested-dynamic-dep', $preloaded_script_modules ); 414 $this->assertArrayNotHasKey( 'no-dep', $preloaded_script_modules ); 415 415 } 416 416 … … 446 446 $this->assertCount( 1, $preloaded_script_modules ); 447 447 $this->assertStringStartsWith( '/static-dep.js', $preloaded_script_modules['static-dep'] ); 448 $this->assert False( isset( $preloaded_script_modules['dynamic-dep'] ));449 $this->assert False( isset( $preloaded_script_modules['nested-static-dep'] ));450 $this->assert False( isset( $preloaded_script_modules['no-dep'] ));448 $this->assertArrayNotHasKey( 'dynamic-dep', $preloaded_script_modules ); 449 $this->assertArrayNotHasKey( 'nested-dynamic-dep', $preloaded_script_modules ); 450 $this->assertArrayNotHasKey( 'no-dep', $preloaded_script_modules ); 451 451 } 452 452 … … 477 477 478 478 $this->assertCount( 1, $preloaded_script_modules ); 479 $this->assert True( isset( $preloaded_script_modules['dep'] ));480 $this->assert False( isset( $preloaded_script_modules['enqueued-dep'] ));479 $this->assertArrayHasKey( 'dep', $preloaded_script_modules ); 480 $this->assertArrayNotHasKey( 'enqueued-dep', $preloaded_script_modules ); 481 481 } 482 482 … … 508 508 509 509 $this->assertCount( 2, $import_map ); 510 $this->assert True( isset( $import_map['dep'] ));511 $this->assert True( isset( $import_map['enqueued-dep'] ));510 $this->assertArrayHasKey( 'dep', $import_map ); 511 $this->assertArrayHasKey( 'enqueued-dep', $import_map ); 512 512 } 513 513 … … 532 532 533 533 $result = $get_src->invoke( $this->script_modules, 'module_with_version' ); 534 $this->assert Equals( 'http://example.com/module.js?ver=1.0', $result );534 $this->assertSame( 'http://example.com/module.js?ver=1.0', $result ); 535 535 536 536 $this->script_modules->register( … … 542 542 543 543 $result = $get_src->invoke( $this->script_modules, 'module_without_version' ); 544 $this->assert Equals( 'http://example.com/module.js', $result );544 $this->assertSame( 'http://example.com/module.js', $result ); 545 545 546 546 $this->script_modules->register( … … 552 552 553 553 $result = $get_src->invoke( $this->script_modules, 'module_with_wp_version' ); 554 $this->assert Equals( 'http://example.com/module.js?ver=' . get_bloginfo( 'version' ), $result );554 $this->assertSame( 'http://example.com/module.js?ver=' . get_bloginfo( 'version' ), $result ); 555 555 556 556 $this->script_modules->register( … … 562 562 563 563 $result = $get_src->invoke( $this->script_modules, 'module_with_existing_query_string' ); 564 $this->assert Equals( 'http://example.com/module.js?foo=bar&ver=1.0', $result );564 $this->assertSame( 'http://example.com/module.js?foo=bar&ver=1.0', $result ); 565 565 566 566 // Filter the version to include the ID in the final URL, to test the filter, this should affect the tests below. … … 575 575 576 576 $result = $get_src->invoke( $this->script_modules, 'module_without_version' ); 577 $this->assert Equals( 'http://example.com/module.js?script_module_id=module_without_version', $result );577 $this->assertSame( 'http://example.com/module.js?script_module_id=module_without_version', $result ); 578 578 579 579 $result = $get_src->invoke( $this->script_modules, 'module_with_existing_query_string' ); 580 $this->assert Equals( 'http://example.com/module.js?foo=bar&ver=1.0&script_module_id=module_with_existing_query_string', $result );580 $this->assertSame( 'http://example.com/module.js?foo=bar&ver=1.0&script_module_id=module_with_existing_query_string', $result ); 581 581 } 582 582 … … 607 607 608 608 $enqueued_script_modules = $this->get_enqueued_script_modules(); 609 $this->assert Equals( '/foo.js?ver=1.0', $enqueued_script_modules['foo'] );609 $this->assertSame( '/foo.js?ver=1.0', $enqueued_script_modules['foo'] ); 610 610 611 611 $import_map = $this->get_import_map(); 612 $this->assert Equals( '/dep.js?ver=2.0', $import_map['dep'] );612 $this->assertSame( '/dep.js?ver=2.0', $import_map['dep'] ); 613 613 614 614 $preloaded_script_modules = $this->get_preloaded_script_modules(); 615 $this->assert Equals( '/dep.js?ver=2.0', $preloaded_script_modules['dep'] );615 $this->assertSame( '/dep.js?ver=2.0', $preloaded_script_modules['dep'] ); 616 616 } 617 617 … … 631 631 632 632 $this->assertCount( 0, $enqueued_script_modules ); 633 $this->assert False( isset( $enqueued_script_modules['foo'] ));633 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 634 634 } 635 635 … … 667 667 668 668 $this->assertCount( 0, $enqueued_script_modules ); 669 $this->assert False( isset( $enqueued_script_modules['foo'] ));669 $this->assertArrayNotHasKey( 'foo', $enqueued_script_modules ); 670 670 671 671 $this->script_modules->enqueue( 'foo', '/foo.js' ); // Valid src. … … 696 696 697 697 $this->assertCount( 1, $enqueued_script_modules ); 698 $this->assert Equals( '/foo.js?ver=1.0', $enqueued_script_modules['foo'] );698 $this->assertSame( '/foo.js?ver=1.0', $enqueued_script_modules['foo'] ); 699 699 $this->assertCount( 1, $import_map ); 700 700 $this->assertStringStartsWith( '/dep.js', $import_map['dep'] ); … … 709 709 $import_map_polyfill = get_echo( array( $this->script_modules, 'print_import_map' ) ); 710 710 711 $this->assert Equals( '', $import_map_polyfill );711 $this->assertSame( '', $import_map_polyfill ); 712 712 } 713 713 … … 731 731 $id = $p->get_attribute( 'id' ); 732 732 733 $this->assert Equals( 'wp-load-polyfill-importmap', $id );733 $this->assertSame( 'wp-load-polyfill-importmap', $id ); 734 734 } 735 735 }
Note: See TracChangeset
for help on using the changeset viewer.