Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"require-dev": {
"wp-cli/entity-command": "^1.3 || ^2 || ^3",
"wp-cli/wp-cli-tests": "^5"
"wp-cli/wp-cli-tests": "dev-setup-commands-step as 5.3.99"
},
"config": {
"process-timeout": 7200,
Expand Down
36 changes: 24 additions & 12 deletions features/transient-patch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from transient can be inserted at any depth.
Given a WP install
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient patch insert my_key fuz baz`
Then STDOUT should be:
Expand Down Expand Up @@ -73,8 +75,10 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from transient can be updated at any depth.
Given a WP install
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient patch update my_key foo baz`
Then STDOUT should be:
Expand Down Expand Up @@ -132,8 +136,10 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from transient can be deleted at any depth.
Given a WP install
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient patch delete my_key foo`
Then STDOUT should be:
Expand Down Expand Up @@ -179,8 +185,10 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from site transient can be inserted at any depth.
Given a WP multisite install
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient patch insert my_key fuz baz --network`
Then STDOUT should be:
Expand Down Expand Up @@ -238,8 +246,10 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from site transient can be updated at any depth.
Given a WP multisite install
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient patch update my_key foo baz --network`
Then STDOUT should be:
Expand Down Expand Up @@ -297,8 +307,10 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from site transient can be deleted at any depth.
Given a WP multisite install
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient patch delete my_key foo --network`
Then STDOUT should be:
Expand Down
12 changes: 8 additions & 4 deletions features/transient-pluck.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ Feature: Pluck command available for the transient cache

Scenario: Nested values from transient can be retrieved at any depth.
Given a WP install
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient pluck my_key foo`
Then STDOUT should be:
Expand Down Expand Up @@ -37,8 +39,10 @@ Feature: Pluck command available for the transient cache

Scenario: Nested values from site transient can be retrieved at any depth.
Given a WP multisite install
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
And these setup commands:
| command |
| wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );" |
| wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" |

When I run `wp transient pluck my_key foo --network`
Then STDOUT should be:
Expand Down
110 changes: 64 additions & 46 deletions features/transient.feature
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ Feature: Manage WordPress transient cache
Error: Please specify transient key, or use --all or --expired.
"""

When I run `wp transient set foo bar`
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`
Given these setup commands:
| command |
| wp transient set foo bar |
| wp transient set foo2 bar2 600 |
| wp transient set foo3 bar3 --network |
| wp transient set foo4 bar4 600 --network |

And I run `wp transient delete --all`
Then STDOUT should be:
Expand Down Expand Up @@ -129,13 +131,17 @@ Feature: Manage WordPress transient cache
@skip-object-cache
Scenario: Deleting expired transients on single site
Given a WP install
And I run `wp transient set foo bar 600`
And I run `wp transient set foo2 bar2 600`
And I run `wp transient set foo3 bar3 600 --network`
And I run `wp transient set foo4 bar4 600 --network`
And these setup commands:
| command |
| wp transient set foo bar 600 |
| wp transient set foo2 bar2 600 |
| wp transient set foo3 bar3 600 --network |
| wp transient set foo4 bar4 600 --network |
# Change timeout to be in the past.
And I run `wp option update _transient_timeout_foo 1321009871`
And I run `wp option update _site_transient_timeout_foo3 1321009871`
And these setup commands:
| command |
| wp option update _transient_timeout_foo 1321009871 |
| wp option update _site_transient_timeout_foo3 1321009871 |

When I run `wp transient delete --expired`
Then STDOUT should be:
Expand Down Expand Up @@ -216,11 +222,13 @@ Feature: Manage WordPress transient cache
Error: Please specify transient key, or use --all or --expired.
"""

When I run `wp transient set foo bar`
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 --url=example.com/foo transient set foo5 bar5 --network`
Given these setup commands:
| command |
| wp transient set foo bar |
| wp transient set foo2 bar2 600 |
| wp transient set foo3 bar3 --network |
| wp transient set foo4 bar4 600 --network |
When I run `wp --url=example.com/foo transient set foo5 bar5 --network`
And I run `wp --url=example.com/foo transient set foo6 bar6 600 --network`
And I run `wp transient delete --all`
Then STDOUT should be:
Expand Down Expand Up @@ -298,15 +306,19 @@ Feature: Manage WordPress transient cache
Scenario: Deleting expired transients on multisite
Given a WP multisite install
And I run `wp site create --slug=foo`
And I run `wp transient set foo bar 600`
And I run `wp transient set foo2 bar2 600`
And I run `wp transient set foo3 bar3 600 --network`
And I run `wp transient set foo4 bar4 600 --network`
And these setup commands:
| command |
| wp transient set foo bar 600 |
| wp transient set foo2 bar2 600 |
| wp transient set foo3 bar3 600 --network |
| wp transient set foo4 bar4 600 --network |
And I run `wp --url=example.com/foo transient set foo5 bar5 600 --network`
And I run `wp --url=example.com/foo transient set foo6 bar6 600 --network`
# Change timeout to be in the past.
And I run `wp option update _transient_timeout_foo 1321009871`
And I run `wp site option update _site_transient_timeout_foo3 1321009871`
And these setup commands:
| command |
| wp option update _transient_timeout_foo 1321009871 |
| wp site option update _site_transient_timeout_foo3 1321009871 |
And I run `wp --url=example.com/foo site option update _site_transient_timeout_foo5 1321009871`

When I run `wp transient delete --expired`
Expand Down Expand Up @@ -398,16 +410,18 @@ Feature: Manage WordPress transient cache
@skip-object-cache
Scenario: List transients on single site
Given a WP install
And I run `wp transient set foo bar`
And I run `wp transient set foo2 bar2 610`
And I run `wp option update _transient_timeout_foo2 95649119999`
And I run `wp transient set foo3 bar3 300`
And I run `wp option update _transient_timeout_foo3 1321009871`
And I run `wp transient set foo4 bar4 --network`
And I run `wp transient set foo5 bar5 610 --network`
And I run `wp option update _site_transient_timeout_foo5 95649119999`
And I run `wp transient set foo6 bar6 300 --network`
And I run `wp option update _site_transient_timeout_foo6 1321009871`
And these setup commands:
| command |
| wp transient set foo bar |
| wp transient set foo2 bar2 610 |
| wp option update _transient_timeout_foo2 95649119999 |
| wp transient set foo3 bar3 300 |
| wp option update _transient_timeout_foo3 1321009871 |
| wp transient set foo4 bar4 --network |
| wp transient set foo5 bar5 610 --network |
| wp option update _site_transient_timeout_foo5 95649119999 |
| wp transient set foo6 bar6 300 --network |
| wp option update _site_transient_timeout_foo6 1321009871 |

When I run `wp transient list --format=csv`
Then STDOUT should contain:
Expand Down Expand Up @@ -457,16 +471,18 @@ 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 transient set foo bar`
And I run `wp transient set foo2 bar2 610`
And I run `wp option update _transient_timeout_foo2 95649119999`
And I run `wp transient set foo3 bar3 300`
And I run `wp option update _transient_timeout_foo3 1321009871`
And I run `wp transient set foo4 bar4 --network`
And I run `wp transient set foo5 bar5 610 --network`
And I run `wp site option update _site_transient_timeout_foo5 95649119999`
And I run `wp transient set foo6 bar6 300 --network`
And I run `wp site option update _site_transient_timeout_foo6 1321009871`
And these setup commands:
| command |
| wp transient set foo bar |
| wp transient set foo2 bar2 610 |
| wp option update _transient_timeout_foo2 95649119999 |
| wp transient set foo3 bar3 300 |
| wp option update _transient_timeout_foo3 1321009871 |
| wp transient set foo4 bar4 --network |
| wp transient set foo5 bar5 610 --network |
| wp site option update _site_transient_timeout_foo5 95649119999 |
| wp transient set foo6 bar6 300 --network |
| wp site option update _site_transient_timeout_foo6 1321009871 |

When I run `wp transient list --format=csv`
Then STDOUT should contain:
Expand Down Expand Up @@ -513,11 +529,13 @@ Feature: Manage WordPress transient cache
@skip-object-cache
Scenario: List transients with search and exclude pattern
Given a WP install
And I run `wp transient set foo bar`
And I run `wp transient set foo2 bar2`
And I run `wp transient set foo3 bar3`
And I run `wp transient set foo4 bar4 --network`
And I run `wp transient set foo5 bar5 --network`
And these setup commands:
| command |
| wp transient set foo bar |
| wp transient set foo2 bar2 |
| wp transient set foo3 bar3 |
| wp transient set foo4 bar4 --network |
| wp transient set foo5 bar5 --network |

When I run `wp transient list --format=csv --fields=name --search="foo"`
Then STDOUT should be:
Expand Down
Loading