From 4414ef1ec68f7d25afc56dbe27ed37fba61f974a Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sun, 4 Aug 2024 17:12:37 +0200 Subject: [PATCH 1/2] Make transient test more robust against added transients by core --- features/transient.feature | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/features/transient.feature b/features/transient.feature index 65f14057..3bcc3085 100644 --- a/features/transient.feature +++ b/features/transient.feature @@ -405,9 +405,14 @@ Feature: Manage WordPress transient cache When I run `wp transient list --format=csv` Then STDOUT should contain: """ - name,value,expiration foo,bar,false + """ + And STDOUT should contain: + """ foo2,bar2,95649119999 + """ + And STDOUT should contain: + """ foo3,bar3,1321009871 """ @@ -458,9 +463,14 @@ Feature: Manage WordPress transient cache When I run `wp transient list --format=csv` Then STDOUT should contain: """ - name,value,expiration foo,bar,false + """ + And STDOUT should contain: + """ foo2,bar2,95649119999 + """ + And STDOUT should contain: + """ foo3,bar3,1321009871 """ From fb3c95e37a3ef5355576711709546b6d2eb28a80 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sun, 4 Aug 2024 17:58:12 +0200 Subject: [PATCH 2/2] Disable WP-CRON when testing transient deletion --- features/transient.feature | 3 +++ 1 file changed, 3 insertions(+) diff --git a/features/transient.feature b/features/transient.feature index 3bcc3085..3902da95 100644 --- a/features/transient.feature +++ b/features/transient.feature @@ -60,6 +60,8 @@ Feature: Manage WordPress transient cache # We set `WP_DEVELOPMENT_MODE` to stop WordPress from automatically creating # additional transients which cause some steps to fail when testing. And I run `wp config set WP_DEVELOPMENT_MODE all` + And I run `wp config set DISABLE_WP_CRON true --raw` + And I run `wp transient list --format=count` And save STDOUT as {EXISTING_TRANSIENTS} And I run `expr {EXISTING_TRANSIENTS} + 2` @@ -75,6 +77,7 @@ Feature: Manage WordPress transient cache And I run `wp transient set foo2 bar2 600` And I run `wp transient set foo3 bar3 --network` And I run `wp transient set foo4 bar4 600 --network` + And I run `wp transient delete --all` Then STDOUT should be: """