Changeset 61323 for trunk/tests/phpunit/tests/dependencies/styles.php
- Timestamp:
- 11/30/2025 12:54:26 AM (8 weeks ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/dependencies/styles.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/dependencies/styles.php
r61084 r61323 815 815 $this->assertEqualHTML( $expected, $printed ); 816 816 } 817 818 /** 819 * Tests that WP_Styles emits a _doing_it_wrong() notice for missing dependencies. 820 * 821 * @ticket 64229 822 * @covers WP_Dependencies::all_deps 823 */ 824 public function test_wp_style_doing_it_wrong_for_missing_dependencies() { 825 $expected_incorrect_usage = 'WP_Styles::add'; 826 $this->setExpectedIncorrectUsage( $expected_incorrect_usage ); 827 828 wp_enqueue_style( 829 'main-style', 830 '/main-style.css', 831 array( 'missing-style-dep' ) 832 ); 833 834 $markup = get_echo( 'wp_print_styles' ); 835 $this->assertStringNotContainsString( 'main-style.css', $markup, 'Expected style to be absent.' ); 836 837 $this->assertArrayHasKey( 838 $expected_incorrect_usage, 839 $this->caught_doing_it_wrong, 840 "Expected $expected_incorrect_usage to trigger a _doing_it_wrong() notice for missing dependency." 841 ); 842 843 $this->assertStringContainsString( 844 'The style with the handle "main-style" was enqueued with dependencies that are not registered: missing-style-dep', 845 $this->caught_doing_it_wrong[ $expected_incorrect_usage ], 846 'Expected _doing_it_wrong() notice to indicate missing dependencies for enqueued styles.' 847 ); 848 } 817 849 }
Note: See TracChangeset
for help on using the changeset viewer.