-
Notifications
You must be signed in to change notification settings - Fork 5
Release 2.4.0 : Improve WordPress site support in slic here
#247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice usage of preinitialized hooks! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?php | ||
| /** | ||
| * Disable persistent object caching inside Slic test containers. | ||
| * | ||
| * WordPress automatically loads `object-cache.php` from `WP_CONTENT_DIR` before | ||
| * normal plugins. A project's drop-in can retain data between tests or require | ||
| * services and configuration that are not part of the test environment. | ||
| * | ||
| * `slic-stack.yml` bind-mounts this file read-only at | ||
| * `/slic-disable-object-cache.php` in both the WordPress and Slic/Codeception | ||
| * containers. Their PHP configuration loads it with `auto_prepend_file`, before | ||
| * WordPress begins bootstrapping. Unlike mounting over the drop-in itself, this | ||
| * does not create, replace, or remove anything in the host content directory. | ||
| * | ||
| * WordPress supports registering filters before its plugin API is loaded using | ||
| * this array structure. When `wp-includes/plugin.php` loads, it converts the | ||
| * entry into a `WP_Hook`. Later, `wp_start_object_cache()` applies the filter and | ||
| * skips the project's drop-in. WordPress then loads its built-in, non-persistent | ||
| * `WP_Object_Cache` implementation instead. | ||
| */ | ||
| $GLOBALS['wp_filter']['enable_loading_object_cache_dropin'][10][] = [ | ||
| 'function' => static function () { | ||
| return false; | ||
| }, | ||
|
Comment on lines
+22
to
+24
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just seemed weird not using arrow function. Do we want to be compatible with prior 7.4 ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was no specific reason, happy to update it. |
||
| 'accepted_args' => 0, | ||
| ]; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im curious about as to why we should have this functionality in slic's core. Codeception is firing events which we can utilize to actually implement them in speficic cases where we need them.
For example we could utilize BEFORE/AFTER SUITE events to accomplish this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I'm can only assume this functionality was originally added to
slicto make tests stop failing because of an existing object cache and they were difficult to debug?I don't know the actual history behind the feature, but what I do know is before this,
slicwas physically deleting and restoring theobject-cache.phpwould can affect the host (e.g. remove it from a repo if it's committed because of host mapping) which is not good.I'm open to anything after this merge to make something better, but for now I need it to not physically delete the object-cache.php file from my host machine when those are mapped in the container.