Closed ataylorme closed 5 years ago
@paulgibbs here is a better failure example.
I tracked this down to sticky posts. I am using the wp-cli driver and even when running wp-cli commands directly outside of Behat sticky a post shows up when I expect a different post as the result when using wp post list
.
I think this is a result of wp-cli running WP_Query
and the default functionality of WP_Query
to be returning sticky posts unless ignore_sticky_posts
is set to true
.
I'm not familiar enough with the drivers to know:
ignore_sticky_posts
to true
in the wp-cli driverignore_sticky_posts
to true
in the wp-cli driverHi. Yep, you found the correct fix.
I've tested this, and the underlying queries, as best as I can, and it is safe to always set ignore_sticky_posts
for both drivers, so that's what I've done in the attached PR.
Sorry for taking a while to look at this
Great, thanks @paulgibbs. It threw me off for a while before I figured out what was going on.
Expected behavior
getContentFromTitle
does not return the correct post when using an exact-match title parameter.Current behavior
A seemingly random, incorrect post is returned
Possible solution
Steps to reproduce
Context
I am attempting to write custom tests for the Give donation form to provide a real-world WordHat example
I am using the wpcli driver but have tried the php driver locally as well.
I also created a custom step that passes
$post_type
as well togetContentFromTitle
and still got an incorrect post back.None of my tests are using JavaScript due to similar issues as outlined in #182 with admin login issues in a headless (Docker) environment.
In CircleCI the wpcli driver is being run against a remote URL on Pantheon, not a local URL. When testing locally the wpcli driver is used but against a local WordPress installation.
Your environment
3.0.0
goutte