@@ -760,7 +760,7 @@ public function data_provider_to_test_image_prioritizer_filter_rest_request_befo
760
760
};
761
761
762
762
return array (
763
- 'invalid_external_bg_image ' => array (
763
+ 'invalid_external_bg_image ' => array (
764
764
'set_up ' => static function () use ( $ get_sample_url_metric_data , $ create_request ): WP_REST_Request {
765
765
$ url_metric_data = $ get_sample_url_metric_data ();
766
766
@@ -786,7 +786,7 @@ public function data_provider_to_test_image_prioritizer_filter_rest_request_befo
786
786
},
787
787
),
788
788
789
- 'valid_external_bg_image ' => array (
789
+ 'valid_external_bg_image ' => array (
790
790
'set_up ' => static function () use ( $ get_sample_url_metric_data , $ create_request ): WP_REST_Request {
791
791
$ url_metric_data = $ get_sample_url_metric_data ();
792
792
$ image_url = home_url ( '/good.jpg ' );
@@ -846,7 +846,26 @@ static function ( $pre, $parsed_args, $url ) use ( $image_url ) {
846
846
},
847
847
),
848
848
849
- 'not_store_post_request ' => array (
849
+ 'invalid_external_bg_image_variant_route ' => array (
850
+ 'set_up ' => static function () use ( $ get_sample_url_metric_data , $ create_request ): WP_REST_Request {
851
+ $ url_metric_data = $ get_sample_url_metric_data ();
852
+
853
+ $ url_metric_data ['lcpElementExternalBackgroundImage ' ] = array (
854
+ 'url ' => 'https://bad-origin.example.com/image.jpg ' ,
855
+ 'tag ' => 'DIV ' ,
856
+ 'id ' => null ,
857
+ 'class ' => null ,
858
+ );
859
+ $ request = $ create_request ( $ url_metric_data );
860
+ $ request ->set_route ( str_replace ( 'store ' , 'STORE ' , $ request ->get_route () ) );
861
+ return $ request ;
862
+ },
863
+ 'assert ' => function ( WP_REST_Request $ request ): void {
864
+ $ this ->assertArrayNotHasKey ( 'lcpElementExternalBackgroundImage ' , $ request );
865
+ },
866
+ ),
867
+
868
+ 'not_store_post_request ' => array (
850
869
'set_up ' => static function () use ( $ get_sample_url_metric_data , $ create_request ): WP_REST_Request {
851
870
$ url_metric_data = $ get_sample_url_metric_data ();
852
871
$ url_metric_data ['lcpElementExternalBackgroundImage ' ] = 'https://totally-different.example.com/ ' ;
@@ -860,7 +879,7 @@ static function ( $pre, $parsed_args, $url ) use ( $image_url ) {
860
879
},
861
880
),
862
881
863
- 'not_store_request ' => array (
882
+ 'not_store_request ' => array (
864
883
'set_up ' => static function () use ( $ get_sample_url_metric_data , $ create_request ): WP_REST_Request {
865
884
$ url_metric_data = $ get_sample_url_metric_data ();
866
885
$ url_metric_data ['lcpElementExternalBackgroundImage ' ] = 'https://totally-different.example.com/ ' ;
0 commit comments