- Timestamp:
- 11/30/2025 12:54:26 AM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/script-modules/wpScriptModules.php
r61073 r61323 2060 2060 ); 2061 2061 2062 $deregister( array( 'b', 'c ' ) );2062 $deregister( array( 'b', 'c' ) ); 2063 2063 2064 2064 // Test that registered dependency in footer doesn't place dependant in footer. … … 2313 2313 ); 2314 2314 } 2315 2316 /** 2317 * Tests that a missing script module dependency triggers a _doing_it_wrong() notice. 2318 * 2319 * @ticket 64229 2320 * @covers WP_Script_Modules::sort_item_dependencies 2321 */ 2322 public function test_missing_script_module_dependency_triggers_incorrect_usage() { 2323 $expected_incorrect_usage = 'WP_Script_Modules::register'; 2324 $this->setExpectedIncorrectUsage( $expected_incorrect_usage ); 2325 2326 $this->script_modules->enqueue( 'main-module', '/main-module.js', array( 'missing-mod-dep' ) ); 2327 2328 $markup = get_echo( array( $this->script_modules, 'print_enqueued_script_modules' ) ); 2329 $this->assertStringNotContainsString( 'main-module.js', $markup, 'Expected script module to be absent.' ); 2330 2331 $this->assertArrayHasKey( 2332 $expected_incorrect_usage, 2333 $this->caught_doing_it_wrong, 2334 'Expected WP_Script_Modules::register to be reported via doing_it_wrong().' 2335 ); 2336 2337 // Assert the message mentions the missing dependency handle. 2338 $this->assertStringContainsString( 2339 'The script module with the ID "main-module" was enqueued with dependencies that are not registered: missing-mod-dep', 2340 $this->caught_doing_it_wrong[ $expected_incorrect_usage ] 2341 ); 2342 } 2315 2343 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)