Is there any reference of Implementing WorPress (WP_UnitTestCase) using Gitlab CI?
I have already tried configuring the .gitlab-ci.yml
, it implements the build, but no test are runned.
This is the .gitlab-ci.yml file:
image: php:5.6
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: wordpress_tests
MYSQL_ROOT_PASSWORD: mysql
before_script:
# Install dependencies
- bash ci/docker_install.sh wordpress_tests root mysql tutum-wordpress latest
stages:
- test
# test:PHP5.3:MySQL:
# image: tetraweb/php:5.3
# script:
# - phpunit --configuration phpunit.xml.dist
test:PHP5.4:MySQL:
image: tetraweb/php:5.4
services:
- tutum/wordpress:latest
script:
- phpunit --configuration phpunit.xml.dist
# test:PHP5.6:MySQL:
# image: php:5.6
# script:
# - phpunit --configuration phpunit.xml.dist
# test:PHP7:MySQL:
# image: php:7
# script:
# - phpunit --configuration phpunit.xml.dist
After a lot of trial and error I got it working for me, you can see the tests for PHP5.3 through PHP7.0 are running properly for a test plugin I created here
This is how my .gitlab-ci.yml looks like. and the shell script to setup the environment is here
To use this in your project,just copy the .gitlab-ci.yml
, bin/install_gitlab_tests.sh
to your project.
I had a similar issue. Looks like it was a wordpress compatibility problem with phpunit 6.0. Fixed by downgranding phpunit to 5.6. See: https://github.com/wp-cli/wp-cli/issues/3802
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With