Skip to content
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
Update the function to use only one return statement
  • Loading branch information
hbhalodia committed Jun 6, 2025
commit f56f9d63a6e1ac3f70c96d54942e8f5b71298d28
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@
function perflab_effective_asset_cache_headers_add_test( array $tests ): array {
/*
* Static assets are expected to not have effective cache headers in non-production environments.
* Hence bail early.
*
* GH Issue: https://github.com/WordPress/performance/issues/2031
*/
if ( in_array( wp_get_environment_type(), array( 'local', 'development' ), true ) ) {
return $tests;
if ( ! in_array( wp_get_environment_type(), array( 'local', 'development' ), true ) ) {
$tests['direct']['effective_asset_cache_headers'] = array(
'label' => __( 'Effective Caching Headers', 'performance-lab' ),
'test' => 'perflab_effective_asset_cache_headers_assets_test',
);

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

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L31 - L34 were not covered by tests
}

$tests['direct']['effective_asset_cache_headers'] = array(
'label' => __( 'Effective Caching Headers', 'performance-lab' ),
'test' => 'perflab_effective_asset_cache_headers_assets_test',
);

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