diff --git a/plugins/woocommerce/changelog/fix-unit-nightly b/plugins/woocommerce/changelog/fix-unit-nightly new file mode 100644 index 00000000000..acaf6bd11e7 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-unit-nightly @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Fixes a unit test for WP nightly. No functional change. + + diff --git a/plugins/woocommerce/tests/legacy/unit-tests/core/template-cache.php b/plugins/woocommerce/tests/legacy/unit-tests/core/template-cache.php index f1658e17d8d..d429115615b 100644 --- a/plugins/woocommerce/tests/legacy/unit-tests/core/template-cache.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/core/template-cache.php @@ -57,8 +57,10 @@ class WC_Template_Cache extends WC_Unit_Test_Case { $cached_templates = wp_cache_get( 'cached_templates', 'woocommerce' ); wc_clear_template_cache(); - foreach ( (array) $cached_templates as $template ) { - $this->assertEmpty( wp_cache_get( $template, 'woocommerce' ) ); + if ( $cached_templates ) { + foreach ( (array) $cached_templates as $template ) { + $this->assertEmpty( wp_cache_get( $template, 'woocommerce' ) ); + } } $this->assertEmpty( wp_cache_get( 'cached_templates', 'woocommerce' ) ); }