paulgibbs / behat-wordpress-extension

WordHat: Behat for WordPress
https://wordhat.info
GNU General Public License v3.0
106 stars 20 forks source link

Implement update methods for the drivers #249

Open johnbillion opened 5 years ago

johnbillion commented 5 years ago

Expected behaviour

The drivers included in Wordhat should include update() methods in their ContentElement classes so that a context can call $this->getDriver()->content->update($args) to update an existing post.

Current behaviour

None of the drivers implement the ContentElement::update() method, so this is not possible.

Context

As a workaround, I tried calling the create() method (via the createContent() method available on the context) and including an ID argument, but this doesn't work with the Wpcli driver. The error is:

Error: Content, title, and excerpt are empty.

WP-CLI doesn't support the --ID argument for wp post create and returns this error for a standalone command such as:

wp post create --ID=123 --post_status=publish

Your environment

paulgibbs commented 5 years ago

Thanks for creating this report, @johnbillion. On the face of it, it's a pretty big oversight. I'll have to have a think and trawl through git history to see if I had a reason for not including these (I have a suspicion that an earlier version may have removed them), but generally I think this is something that should be re-added soon.