From e675b116e9d8c2d533a6dec89178cda21bbc99f1 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 11 Oct 2022 17:30:23 -0700 Subject: [PATCH 1/2] Make transients delete test more robust --- features/transient.feature | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/transient.feature b/features/transient.feature index 33d296e3a..19d65fd01 100644 --- a/features/transient.feature +++ b/features/transient.feature @@ -57,6 +57,10 @@ Feature: Manage WordPress transient cache Scenario: Deleting all transients on single site Given a WP install + And I run `wp transient list --format=count` + And save STDOUT as {EXISTING_TRANSIENTS} + And I run `expr {EXISTING_TRANSIENTS} + 2` + And save STDOUT as {EXPECTED_TRANSIENTS} When I try `wp transient delete` Then STDERR should be: @@ -71,7 +75,7 @@ Feature: Manage WordPress transient cache And I run `wp transient delete --all` Then STDOUT should be: """ - Success: 2 transients deleted from the database. + Success: {EXPECTED_TRANSIENTS} transients deleted from the database. """ When I try `wp transient get foo` From be15fc6558a4d661e98d11a01f9c236cbc14b639 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 11 Oct 2022 17:40:08 -0700 Subject: [PATCH 2/2] Further improve tests --- features/transient.feature | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/features/transient.feature b/features/transient.feature index 19d65fd01..467e5b180 100644 --- a/features/transient.feature +++ b/features/transient.feature @@ -194,6 +194,10 @@ Feature: Manage WordPress transient cache Scenario: Deleting all transients on multisite Given a WP multisite install And I run `wp site create --slug=foo` + And I run `wp transient list --format=count` + And save STDOUT as {EXISTING_TRANSIENTS} + And I run `expr {EXISTING_TRANSIENTS} + 2` + And save STDOUT as {EXPECTED_TRANSIENTS} When I try `wp transient delete` Then STDERR should be: @@ -210,7 +214,7 @@ Feature: Manage WordPress transient cache And I run `wp transient delete --all` Then STDOUT should be: """ - Success: 2 transients deleted from the database. + Success: {EXPECTED_TRANSIENTS} transients deleted from the database. """ When I try `wp transient get foo` @@ -393,7 +397,7 @@ Feature: Manage WordPress transient cache And I run `wp option update _site_transient_timeout_foo6 1321009871` When I run `wp transient list --format=csv` - Then STDOUT should be: + Then STDOUT should contain: """ name,value,expiration foo,bar,false @@ -438,7 +442,7 @@ Feature: Manage WordPress transient cache And I run `wp site option update _site_transient_timeout_foo6 1321009871` When I run `wp transient list --format=csv` - Then STDOUT should be: + Then STDOUT should contain: """ name,value,expiration foo,bar,false