-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathset-up.php
More file actions
39 lines (37 loc) · 1.21 KB
/
set-up.php
File metadata and controls
39 lines (37 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
return static function ( Test_Image_Prioritizer_Helper $test_case ): void {
add_filter(
'od_breakpoint_max_widths',
static function () {
return array( 480, 600, 782 );
}
);
$slug = od_get_url_metrics_slug( od_get_normalized_query_vars() );
$sample_size = od_get_url_metrics_breakpoint_sample_size();
// Populate the mobile and desktop viewport groups only.
foreach ( array( 400, 800 ) as $viewport_width ) {
for ( $i = 0; $i < $sample_size; $i++ ) {
OD_URL_Metrics_Post_Type::store_url_metric(
$slug,
$test_case->get_sample_url_metric(
array(
'viewport_width' => $viewport_width,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::MAIN]/*[2][self::ARTICLE]/*[2][self::FIGURE]/*[1][self::IMG]',
'isLCP' => $viewport_width > 600,
'intersectionRatio' => $viewport_width > 600 ? 1.0 : 0.1,
),
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::MAIN]/*[4][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'boundingClientRect' => array( 'top' => 100000 ),
),
),
)
)
);
}
}
};