Automattic / wordbless

WorDBless allows you to use WordPress core functions in your PHPUnit tests without having to set up a database and the whole WordPress environment
Other
130 stars 6 forks source link

Change the option array merge order in Options::get_all_options #45

Closed kbrown9 closed 3 years ago

kbrown9 commented 3 years ago

Change the option array merge order in Options::get_all_options so that the $options class property is merged last. This will allow tests to use update_option to change the value of options that have a default value, such as the 'home' option.

Also add a unit test that verifies that update_option will change the value of an option that has a default value. Note that without this branch's change to Options::get_all_options, the new unit test should fail.

kbrown9 commented 3 years ago

It looks like some of the tests are failing because, in WP 5.6, untrashed posts are returned to draft status.

leogermani commented 3 years ago

Also add a unit test that verifies that update_option will change the value of an option that has a default value. Note that without this branch's change to Options::get_all_options, the new unit test should fail.

Yes, this was changed here: core.trac.wordpress.org/ticket/23022

What do you think? Should we simply update the test to reflect the latest behavior? or should we add a version check there?

Or even, should we add a test to the filter they left in wp_untrash_post for folks who want to keep the old behavior?

szepeviktor commented 3 years ago

should we add a version check there

Definitely.