Skip to content

Commit

Permalink
Use wp eval to set the transient
Browse files Browse the repository at this point in the history
  • Loading branch information
petitphp committed Dec 4, 2023
1 parent fec699b commit c5cc6f4
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions features/transient-patch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@ Feature: Patch command available for the transient cache

Scenario: Nested values from transient can be updated at any depth.
Given a WP install
And a wp-content/mu-plugins/test-harness.php file:
"""php
<?php
$set_foo = function(){
set_transient( 'my_key', ['foo' => 'bar'] );
set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );
};
WP_CLI::add_hook( 'before_invoke:transient patch', $set_foo );
"""
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `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

0 comments on commit c5cc6f4

Please sign in to comment.