Changeset 56143 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 07/05/2023 09:36:23 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r56065 r56143 5096 5096 5097 5097 /** 5098 * @ticket 58635 5099 * 5100 * @covers ::wp_get_loading_optimization_attributes 5101 */ 5102 public function test_wp_get_loading_optimization_attributes_header_block_template_increase_media_count() { 5103 $attr = $this->get_width_height_for_high_priority(); 5104 wp_get_loading_optimization_attributes( 'img', $attr, 'template_part_' . WP_TEMPLATE_PART_AREA_HEADER ); 5105 5106 // Images with a certain minimum size in the header of the page are also counted towards the threshold. 5107 $this->assertSame( 1, wp_increase_content_media_count( 0 ) ); 5108 } 5109 5110 /** 5111 * @ticket 58635 5112 * 5113 * @covers ::wp_get_loading_optimization_attributes 5114 */ 5115 public function test_wp_get_loading_optimization_attributes_header_image_tag_increase_media_count() { 5116 $attr = $this->get_width_height_for_high_priority(); 5117 wp_get_loading_optimization_attributes( 'img', $attr, 'get_header_image_tag' ); 5118 5119 // Images with a certain minimum size in the header of the page are also counted towards the threshold. 5120 $this->assertSame( 1, wp_increase_content_media_count( 0 ) ); 5121 } 5122 5123 /** 5124 * @ticket 58635 5125 * 5126 * @covers ::wp_get_loading_optimization_attributes 5127 * 5128 * @dataProvider data_wp_get_loading_attr_default_before_and_no_loop 5129 * 5130 * @param string $context Context for the element for which the `loading` attribute value is requested. 5131 */ 5132 public function test_wp_get_loading_optimization_attributes_image_before_loop_increase_media_count( $context ) { 5133 global $wp_query; 5134 5135 $wp_query = $this->get_new_wp_query_for_published_post(); 5136 $this->set_main_query( $wp_query ); 5137 do_action( 'get_header' ); 5138 5139 $attr = $this->get_width_height_for_high_priority(); 5140 wp_get_loading_optimization_attributes( 'img', $attr, $context ); 5141 5142 // Images with a certain minimum size in the header of the page are also counted towards the threshold. 5143 $this->assertSame( 1, wp_increase_content_media_count( 0 ) ); 5144 } 5145 5146 /** 5098 5147 * Helper method to keep track of the last context returned by the 'wp_get_attachment_image_context' filter. 5099 5148 *
Note: See TracChangeset
for help on using the changeset viewer.