Skip to content

Commit 8fe2f8f

Browse files
committed
Make additional adjustments to template
1 parent 804d71e commit 8fe2f8f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

plugins/optimization-detective/tests/test-optimization.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ public function set_up(): void {
3131
$this->original_request_uri = $_SERVER['REQUEST_URI'];
3232
$this->original_request_method = $_SERVER['REQUEST_METHOD'];
3333
$this->default_mimetype = (string) ini_get( 'default_mimetype' );
34-
$GLOBALS['template'] = '/path/to/theme/index.php';
3534
}
3635

3736
public function tear_down(): void {
3837
$_SERVER['REQUEST_URI'] = $this->original_request_uri;
3938
$_SERVER['REQUEST_METHOD'] = $this->original_request_method;
4039
ini_set( 'default_mimetype', $this->default_mimetype ); // phpcs:ignore WordPress.PHP.IniSet.Risky
4140
unset( $GLOBALS['wp_customize'] );
42-
unset( $GLOBALS['template'] );
4341
parent::tear_down();
4442
}
4543

tests/class-optimization-detective-test-helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ trait Optimization_Detective_Test_Helpers {
2727
*/
2828
public function populate_url_metrics( array $elements, bool $complete = true ): void {
2929
$slug = od_get_url_metrics_slug( od_get_normalized_query_vars() );
30-
$etag = od_get_current_url_metrics_etag( new OD_Tag_Visitor_Registry(), new WP_Query(), 'index.php' ); // Note: Tests rely on the od_current_url_metrics_etag_data filter to set the desired value.
30+
$etag = od_get_current_url_metrics_etag( new OD_Tag_Visitor_Registry(), new WP_Query(), trailingslashit( get_template_directory() ) . 'index.php' ); // Note: Tests rely on the od_current_url_metrics_etag_data filter to set the desired value.
3131
$sample_size = $complete ? od_get_url_metrics_breakpoint_sample_size() : 1;
3232
foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $viewport_width ) {
3333
for ( $i = 0; $i < $sample_size; $i++ ) {
@@ -81,7 +81,7 @@ public function get_sample_dom_rect(): array {
8181
public function get_sample_url_metric( array $params ): OD_URL_Metric {
8282
$params = array_merge(
8383
array(
84-
'etag' => od_get_current_url_metrics_etag( new OD_Tag_Visitor_Registry(), new WP_Query(), 'index.php' ), // Note: Tests rely on the od_current_url_metrics_etag_data filter to set the desired value.
84+
'etag' => od_get_current_url_metrics_etag( new OD_Tag_Visitor_Registry(), new WP_Query(), trailingslashit( get_template_directory() ) . 'index.php' ), // Note: Tests rely on the od_current_url_metrics_etag_data filter to set the desired value.
8585
'url' => home_url( '/' ),
8686
'viewport_width' => 480,
8787
'elements' => array(),

0 commit comments

Comments
 (0)