Skip to content

Prevent effective asset cache headers audit from running on local/development environments #2035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 6, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add the test case to run for the local env
  • Loading branch information
hbhalodia committed Jun 4, 2025

Verified

This commit was signed with the committer’s verified signature.
hbhalodia Hit Bhalodia
commit 85573d763722903d7473ab6153ffee987e4dcd1b
Original file line number Diff line number Diff line change
@@ -28,6 +28,21 @@ public function setUp(): void {
add_filter( 'pre_http_request', array( $this, 'mock_http_requests' ), 10, 3 );
}

/**
* Test that the effective caching headers test is added to the site health tests.
*
* @covers ::perflab_effective_asset_cache_headers_add_test
*/
public function test_perflab_effective_asset_cache_headers_add_test(): void {
$tests = array(
'direct' => array(),
);

$tests = perflab_effective_asset_cache_headers_add_test( $tests );

$this->assertArrayNotHasKey( 'effective_asset_cache_headers', $tests['direct'] );
}

/**
* Test that the effective caching headers test is attached to the site status tests.
*

Unchanged files with check annotations Beta

return $tests;
}
add_filter( 'site_status_tests', 'perflab_effective_asset_cache_headers_add_test', 100 );

Check warning on line 41 in plugins/performance-lab/includes/site-health/effective-asset-cache-headers/hooks.php

Codecov / codecov/patch

plugins/performance-lab/includes/site-health/effective-asset-cache-headers/hooks.php#L41

Added line #L41 was not covered by tests