在Travis CI上对Wordpress插件进行集成测试

时间:2019-12-06 06:57:17

标签: php wordpress woocommerce travis-ci

我正在尝试在Travis CI平台上对我的插件进行测试,并创建了具有以下内容的.travis.yml文件,并且由于其插件基于woocommerce,因此希望与它一起提供的WooCommerce一起运行。 / p>

所以.travis.yml的内容是:

dist: trusty

language: php

notifications:
  email:
    on_success: never
    on_failure: change

services:
  - mysql

cache:
  directories:
    - $HOME/.composer/cache

matrix:
  include:
    - php: 7.2
      env: WP_VERSION=latest WP_MULTISITE=0 TEST_PACKAGE="wp-cli/wp-cli-bundle wp-cli/wp-cli"

before_script:
  - export PATH="$HOME/.composer/vendor/bin:$PATH"
  - wp plugin install woocommerce --activate
  - wp core update-db --network
  - |
    if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
      phpenv config-rm xdebug.ini
    else
      echo "xdebug.ini does not exist"
    fi
  - |
    if [[ ! -z "$WP_VERSION" ]] ; then
      bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
      composer global require "phpunit/phpunit=4.8.*|5.7.*"
    fi
  - |
    if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
      composer global require wp-coding-standards/wpcs
      phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
    fi

script:
  - |
    if [[ ! -z "$WP_VERSION" ]] ; then
      phpunit
      WP_MULTISITE=0 phpunit
    fi
  - |
    if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
      phpcs
    fi
branches:
  only:
    - master
    - wbctests

在构建时,我被困在Travis CI控制台中的关键点

$ wp plugin install woocommerce --activate
wp: command not found
The command "wp plugin install woocommerce --activate" failed and exited with 127 during .

有帮助吗?

0 个答案:

没有答案