diff --git a/composer.json b/composer.json index 48b7aaa..d4db0ac 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,10 @@ "phpstan/extension-installer": "^1.1" }, "scripts": { - "test": "php tests/product-versions-remote-download-regression.php" + "test": [ + "php tests/downloads-page-woocommerce-guard-regression.php", + "php tests/product-versions-remote-download-regression.php" + ] }, "config": { "allow-plugins": { diff --git a/inc/class-downloads-page.php b/inc/class-downloads-page.php index c7a58e9..16f93b9 100644 --- a/inc/class-downloads-page.php +++ b/inc/class-downloads-page.php @@ -53,7 +53,7 @@ public function override_downloads_template(string $template, string $template_n */ public function enqueue_assets(): void { - if ( ! is_account_page()) { + if ( ! function_exists('is_account_page') || ! \is_account_page()) { return; } diff --git a/tests/downloads-page-woocommerce-guard-regression.php b/tests/downloads-page-woocommerce-guard-regression.php new file mode 100644 index 0000000..0f979b7 --- /dev/null +++ b/tests/downloads-page-woocommerce-guard-regression.php @@ -0,0 +1,35 @@ +newInstanceWithoutConstructor(); + + $downloads->enqueue_assets(); + + fwrite(STDOUT, "Downloads_Page WooCommerce guard regression checks passed.\n"); +}