Skip to content

Commit 952f04c

Browse files
committed
Set default parameter value for test case helper function
Signed-off-by: Shyamsundar Gadde <[email protected]>
1 parent 3540d9e commit 952f04c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

plugins/optimization-detective/tests/test-class-od-url-metrics-group-collection.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ public function data_provider_test_get_common_lcp_element(): array {
730730
$xpath1 = '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::IMG]/*[1]';
731731
$xpath2 = '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::IMG]/*[2]';
732732

733-
$get_sample_url_metric = function ( int $viewport_width, string $lcp_element_xpath, bool $is_lcp ): OD_URL_Metric {
733+
$get_sample_url_metric = function ( int $viewport_width, string $lcp_element_xpath, bool $is_lcp = true ): OD_URL_Metric {
734734
return $this->get_sample_url_metric(
735735
array(
736736
'viewport_width' => $viewport_width,
@@ -745,9 +745,9 @@ public function data_provider_test_get_common_lcp_element(): array {
745745
return array(
746746
'all_groups_have_common_lcp' => array(
747747
'url_metrics' => array(
748-
$get_sample_url_metric( 400, $xpath1, true ),
749-
$get_sample_url_metric( 600, $xpath1, true ),
750-
$get_sample_url_metric( 1000, $xpath1, true ),
748+
$get_sample_url_metric( 400, $xpath1 ),
749+
$get_sample_url_metric( 600, $xpath1 ),
750+
$get_sample_url_metric( 1000, $xpath1 ),
751751
),
752752
'expected' => array(
753753
'type' => OD_Element::class,
@@ -760,22 +760,22 @@ public function data_provider_test_get_common_lcp_element(): array {
760760
),
761761
'empty_first_group' => array(
762762
'url_metrics' => array(
763-
$get_sample_url_metric( 600, $xpath1, true ),
764-
$get_sample_url_metric( 1000, $xpath1, true ),
763+
$get_sample_url_metric( 600, $xpath1 ),
764+
$get_sample_url_metric( 1000, $xpath1 ),
765765
),
766766
'expected' => null,
767767
),
768768
'empty_last_group' => array(
769769
'url_metrics' => array(
770-
$get_sample_url_metric( 400, $xpath1, true ),
771-
$get_sample_url_metric( 600, $xpath1, true ),
770+
$get_sample_url_metric( 400, $xpath1 ),
771+
$get_sample_url_metric( 600, $xpath1 ),
772772
),
773773
'expected' => null,
774774
),
775775
'first_and_last_common_lcp_others_empty' => array(
776776
'url_metrics' => array(
777-
$get_sample_url_metric( 400, $xpath1, true ),
778-
$get_sample_url_metric( 1000, $xpath1, true ),
777+
$get_sample_url_metric( 400, $xpath1 ),
778+
$get_sample_url_metric( 1000, $xpath1 ),
779779
),
780780
'expected' => array(
781781
'type' => OD_Element::class,
@@ -784,17 +784,17 @@ public function data_provider_test_get_common_lcp_element(): array {
784784
),
785785
'intermediate_groups_conflict' => array(
786786
'url_metrics' => array(
787-
$get_sample_url_metric( 400, $xpath1, true ),
788-
$get_sample_url_metric( 600, $xpath2, true ),
789-
$get_sample_url_metric( 1000, $xpath1, true ),
787+
$get_sample_url_metric( 400, $xpath1 ),
788+
$get_sample_url_metric( 600, $xpath2 ),
789+
$get_sample_url_metric( 1000, $xpath1 ),
790790
),
791791
'expected' => null,
792792
),
793793
'first_and_last_lcp_mismatch' => array(
794794
'url_metrics' => array(
795-
$get_sample_url_metric( 400, $xpath1, true ),
796-
$get_sample_url_metric( 600, $xpath1, true ),
797-
$get_sample_url_metric( 1000, $xpath2, true ),
795+
$get_sample_url_metric( 400, $xpath1 ),
796+
$get_sample_url_metric( 600, $xpath1 ),
797+
$get_sample_url_metric( 1000, $xpath2 ),
798798
),
799799
'expected' => null,
800800
),

0 commit comments

Comments
 (0)