Skip to content
Merged
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
26 changes: 13 additions & 13 deletions features/cache-patch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ Feature: Patch command available for the object cache
And a wp-content/mu-plugins/test-harness.php file:
"""php
<?php
$set_foo = function(){
wp_cache_set( 'my_key', ['foo' => 'bar'] );
wp_cache_set( 'other_key', ['fuz' => 'biz'] );
wp_cache_set( 'my_key_in_group', ['fuz' => 'biz'], 'my_group' );

$complex_key = (object) [
'foo' => (object) [
'bar' => (object) [
'baz' => 2,
],
],
];
wp_cache_set( 'complex_key', $complex_key );
$set_foo = function () {
wp_cache_set( 'my_key', [ 'foo' => 'bar' ] );
wp_cache_set( 'other_key', [ 'fuz' => 'biz' ] );
wp_cache_set( 'my_key_in_group', [ 'fuz' => 'biz' ], 'my_group' );

$complex_key = (object) [
'foo' => (object) [
'bar' => (object) [
'baz' => 2,
],
],
];
wp_cache_set( 'complex_key', $complex_key );
};

WP_CLI::add_hook( 'before_invoke:cache patch', $set_foo );
Expand Down
8 changes: 4 additions & 4 deletions features/cache-pluck.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Feature: Pluck command available for the object cache
And a wp-content/mu-plugins/test-harness.php file:
"""php
<?php
$set_foo = function(){
wp_cache_set( 'my_key', ['foo' => 'bar'] );
wp_cache_set( 'my_key_2', ['foo' => ['bar' => 'baz']] );
wp_cache_set( 'my_key_3', ['foo' => 'bar_custom'], 'my_custom_group' );
$set_foo = function () {
wp_cache_set( 'my_key', [ 'foo' => 'bar' ] );
wp_cache_set( 'my_key_2', [ 'foo' => [ 'bar' => 'baz' ] ] );
wp_cache_set( 'my_key_3', [ 'foo' => 'bar_custom' ], 'my_custom_group' );
};

WP_CLI::add_hook( 'before_invoke:cache pluck', $set_foo );
Expand Down
34 changes: 17 additions & 17 deletions features/cache.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Feature: Managed the WordPress object cache
Scenario: Default group is 'default'
Given a WP install
And a wp-content/mu-plugins/test-harness.php file:
"""
"""php
<?php
$set_foo = function(){
wp_cache_set( 'foo', 'bar' );
$set_foo = function () {
wp_cache_set( 'foo', 'bar' );
};
$set_foo_value = function() {
wp_cache_set( 'foo', 2 );
$set_foo_value = function () {
wp_cache_set( 'foo', 2 );
};
$log_foo_value = function() {
WP_CLI::log( var_export( wp_cache_get( 'foo' ), true ) );
$log_foo_value = function () {
WP_CLI::log( var_export( wp_cache_get( 'foo' ), true ) );
};
WP_CLI::add_hook( 'before_invoke:cache get', $set_foo );
WP_CLI::add_hook( 'before_invoke:cache delete', $set_foo );
Expand Down Expand Up @@ -150,12 +150,12 @@ Feature: Managed the WordPress object cache
"""php
<?php
class Dummy_Object_Cache extends WP_Object_Cache {
public function flush_group( $group ) {
if ( $group === 'permanent_root_cache' ) {
return false;
public function flush_group( $group ) {
if ( $group === 'permanent_root_cache' ) {
return false;
}
return parent::flush_group( $group );
}
return parent::flush_group( $group );
}
}
$GLOBALS['wp_object_cache'] = new Dummy_Object_Cache();
"""
Expand All @@ -172,12 +172,12 @@ Feature: Managed the WordPress object cache
"""php
<?php
class Dummy_Object_Cache extends WP_Object_Cache {
public function flush_group( $group ) {
if ( $group === 'permanent_root_cache' ) {
return false;
public function flush_group( $group ) {
if ( $group === 'permanent_root_cache' ) {
return false;
}
return parent::flush_group( $group );
}
return parent::flush_group( $group );
}
}
$GLOBALS['wp_object_cache'] = new Dummy_Object_Cache();
"""
Expand Down