Closed andrewmclagan closed 4 years ago
Makes CI/CD very hard.
Correct, although this is easy to set up. You can refer to the working examples which include this configuration in the .travis.yml
.
For local development, you probably already have a DB created, and WP PHPUnit can use the same one; it uses a different table prefix to avoid conflicting with your normal tables.
Ah ok, that makes sense. Although from the Travis config in the https://github.com/wp-phpunit/example-plugin/blob/master/.travis.yml repo I cant seem to see where the database is installed?
- mysql -u root -e "CREATE DATABASE $WP_DB_NAME;"
Would simply create an empty database, not install the wordpress tables?
Side note, in the example-plugin
repo, I noticed you upgraded the composer wordpress to "roots/wordpress": "^5.0",
is that what you would reccomend over the previous wordpress composer package?
Sorry I still cannot workout how the database is being populated in Travis? @aaemnnosttv
WP runs includes/install.php
during its internal bootstrap.php
which installs/resets the WP core tables. It happens right before the test runs; it isn't specific to Travis.
If my test database has not previously been installed through the Wordpress web-ui the tests silently fail.
If I install through the web ui they run perfectly.
Seems that the install script needs to be run BEFORE or INITIALLY?