After missing my blocktime last week to having too many projects open, I came back to my open pull request against the WPCLI
- Remove language translation check from core update process by bgturner · Pull Request #192 · wp-cli/core-command · GitHub
The main piece of feedback was:
ensure the language installation is reliably disabled across all wp versions.
So, how to do it!?
Learning more about Behat
Using my notes from the last OSS session, I was able to set Behat to use the MySQL instance from a Local site.
The next thing to learn more about is actually writing new functional tests with Behat. I’ve only ever skimmed this tool’s functionality and have never used it to write my own tests. So what do I need to do to start?
From reading the Behat Getting Started guide, the terminology looks like:
- Behat is a tool to do Behavor Driven Design (BDD)
- The format of the tests are written in Gherkin
- Each feature is one file
- Each feature file contains a number of different scenarios
So far so good – this feels like other testing tools! One thing I appreciate with other testing frameworks is to be able to zero in on one specific test to run. So using gherkin’s language: “How do I run specific features, or even specific scenarios?”
Looking at the Behat documentation for Gherkin filters, it looks like we can do both!
./vendor/bin/behat features/core.feature # run a feature ./vendor/bin/behat --name='Update from ZIP file' # run a scenario
Now, how to write a new test?
As I started to investigate how other WPCLI functional tests were written, I realized that I didn’t know what sorts of steps were available to me out of the box.
For example, what exactly am I getting when I write a scenario that starts with
Given a WP install?
As it turns out, there’s an existing issue in the WPCLI handbook (ie the documentation repo) that is asking to clarify how to write Behat tests:
Four years since that was created, and I gues I’m as good a person as any to start writing that content, so I forked the repo and pushed up a