@@ -749,10 +749,7 @@ public function data_provider_test_get_common_lcp_element(): array {
749
749
$ get_sample_url_metric ( 600 , $ xpath1 ),
750
750
$ get_sample_url_metric ( 1000 , $ xpath1 ),
751
751
),
752
- 'expected ' => array (
753
- 'type ' => OD_Element::class,
754
- 'xpath ' => $ xpath1 ,
755
- ),
752
+ 'expected ' => $ xpath1 ,
756
753
),
757
754
'no_url_metrics ' => array (
758
755
'url_metrics ' => array (),
@@ -777,10 +774,7 @@ public function data_provider_test_get_common_lcp_element(): array {
777
774
$ get_sample_url_metric ( 400 , $ xpath1 ),
778
775
$ get_sample_url_metric ( 1000 , $ xpath1 ),
779
776
),
780
- 'expected ' => array (
781
- 'type ' => OD_Element::class,
782
- 'xpath ' => $ xpath1 ,
783
- ),
777
+ 'expected ' => $ xpath1 ,
784
778
),
785
779
'intermediate_groups_conflict ' => array (
786
780
'url_metrics ' => array (
@@ -817,9 +811,9 @@ public function data_provider_test_get_common_lcp_element(): array {
817
811
* @dataProvider data_provider_test_get_common_lcp_element
818
812
*
819
813
* @param OD_URL_Metric[] $url_metrics URL Metrics.
820
- * @param mixed $expected Expected.
814
+ * @param string|null $expected Expected.
821
815
*/
822
- public function test_get_common_lcp_element ( array $ url_metrics , $ expected ): void {
816
+ public function test_get_common_lcp_element ( array $ url_metrics , ? string $ expected ): void {
823
817
$ breakpoints = array ( 480 , 800 );
824
818
$ sample_size = 3 ;
825
819
$ current_etag = md5 ( '' );
@@ -834,9 +828,9 @@ public function test_get_common_lcp_element( array $url_metrics, $expected ): vo
834
828
$ this ->assertCount ( 3 , $ group_collection );
835
829
836
830
$ common_lcp_element = $ group_collection ->get_common_lcp_element ();
837
- if ( is_array ( $ expected ) ) {
838
- $ this ->assertInstanceOf ( $ expected [ ' type ' ] , $ common_lcp_element );
839
- $ this ->assertSame ( $ expected[ ' xpath ' ] , $ common_lcp_element ->get_xpath () );
831
+ if ( is_string ( $ expected ) ) {
832
+ $ this ->assertInstanceOf ( OD_Element::class , $ common_lcp_element );
833
+ $ this ->assertSame ( $ expected , $ common_lcp_element ->get_xpath () );
840
834
} else {
841
835
$ this ->assertNull ( $ common_lcp_element );
842
836
}
0 commit comments