Skip to content

Commit

Permalink
Temporarily work around errors related to non-hashes being supplied f…
Browse files Browse the repository at this point in the history
…or ETag
  • Loading branch information
westonruter committed Dec 1, 2024
1 parent a430c56 commit bcc34c9
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'intersectionRatio' => 0,
),
),
false
null
);

// This tests how the Embed Optimizer plugin plays along with other tag visitors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
false
null
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Intentionally omitting resizedBoundingClientRect here to test behavior when data isn't supplied.
),
),
'embeds'
md5( 'embeds' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
'embeds'
md5( 'embeds' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
od_get_url_metrics_slug( od_get_normalized_query_vars() ),
$test_case->get_sample_url_metric(
array(
'etag' => 'embeds',
'etag' => md5( 'embeds' ),
'viewport_width' => $viewport_width,
'elements' => $elements,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
'embeds'
md5( 'embeds' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
false
null
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
false
null
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
'embeds'
md5( 'embeds' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
od_get_url_metrics_slug( od_get_normalized_query_vars() ),
$test_case->get_sample_url_metric(
array(
'etag' => 'embeds',
'etag' => md5( 'embeds' ),
'viewport_width' => $viewport_width,
'elements' => $elements,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
),
'embeds'
md5( 'embeds' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'intersectionRatio' => 0.0,
),
),
false
null
);

// Check what happens when there are too many bookmarks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'isLCP' => true,
),
),
'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video'
md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$slug,
$test_case->get_sample_url_metric(
array(
'etag' => 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video',
'etag' => md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' ),
'viewport_width' => $viewport_width,
'elements' => array(
array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'isLCP' => true,
),
),
'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video'
md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::IMG]',
),
),
'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video'
md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$slug,
$test_case->get_sample_url_metric(
array(
'etag' => 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video',
'etag' => md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' ),
'viewport_width' => $viewport_width,
'elements' => array(
array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'isLCP' => true,
),
),
'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video'
md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' )
);
},
'buffer' => '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static function () use ( $mobile_breakpoint, $tablet_breakpoint ): array {
$slug,
$test_case->get_sample_url_metric(
array(
'etag' => 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video',
'etag' => md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' ),
'viewport_width' => $viewport_width,
'element' => array(
'xpath' => sprintf( '/*[1][self::HTML]/*[2][self::BODY]/*[%d][self::DIV]', $div_index + 1 ),
Expand Down
2 changes: 1 addition & 1 deletion plugins/image-prioritizer/tests/test-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function data_provider_test_auto_sizes(): array {
* @phpstan-param array{ xpath: string, isLCP: bool, intersectionRatio: int } $element_metrics
*/
public function test_auto_sizes( array $element_metrics, string $buffer, string $expected ): void {
$this->populate_url_metrics( array( $element_metrics ), 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' );
$this->populate_url_metrics( array( $element_metrics ), md5( 'image-prioritizer/img,image-prioritizer/background-image,image-prioritizer/video' ) );

$html_start_doc = '<html lang="en"><head><meta charset="utf-8"><title>...</title></head><body>';
$html_end_doc = '</body></html>';
Expand Down
2 changes: 1 addition & 1 deletion tests/class-optimization-detective-test-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function get_sample_dom_rect(): array {
* Gets a sample URL metric.
*
* @phpstan-param array{
* etag?: string,
* etag?: non-empty-string,
* url?: string,
* viewport_width?: int,
* viewport_height?: int,
Expand Down

0 comments on commit bcc34c9

Please sign in to comment.