定制 frozzare/wp-test-suite 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

frozzare/wp-test-suite

Composer 安装命令:

composer require frozzare/wp-test-suite

包简介

Run WordPress test easy

README 文档

README

Build Status No Maintenance Intended

Instead of adding a boostrap.php to every plugin you do you can just install this package and point to the bootstrap.php. For small plugins this should be enough. If you require something more advanced this isn't the package for your project.

Install

composer require frozzare/wp-test-suite

Example

Example .travis.yml:

language: php

php:
  - 5.4
  - 5.5
  - 5.6

env:
  - WP_VERSION=latest WP_MULTISITE=0

install:
  - travis_retry composer install --no-interaction --prefer-source

before_script:
  - bash vendor/frozzare/wp-test-suite/bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 $WP_VERSION

script: vendor/bin/phpunit

Example phpunit.xml.dist:

<phpunit
  bootstrap="vendor/frozzare/wp-test-suite/bootstrap.php"
  backupGlobals="false"
  colors="true"
  convertErrorsToExceptions="true"
  convertNoticesToExceptions="true"
  convertWarningsToExceptions="true"
  >
  <php>
    <const name="WTS_PLUGIN_FILE_NAME" value="simple-gtm.php" />
  </php>
  <testsuites>
    <testsuite name="Simple GTM Test Suite">
      <directory suffix=".php">./tests/</directory>
    </testsuite>
  </testsuites>
  <logging>
    <log type="coverage-clover" target="./tmp/clover.xml" charset="UTF-8" />
  </logging>
</phpunit>

Example of using your own tests/boostrap.php with WordPress Test Suite:

require __DIR__ . '/../vendor/autoload.php';

WP_Test_Suite::load_plugins( [
  __DIR__ . '/../simple-gtm.php'
] );

WP_Test_Suite::run();

Documentation

Without a bootstrap.php

install-wp-tests.sh

This package include install-wp-tests.sh and the path is:

vendor/frozzare/wp-test-suite/bin/install-wp-tests.sh
WTS_PLUGIN_FILE_NAME

With this constant you don't have to create your own boostrap.php. Just include WTS_PLUGIN_FILE_NAME const in your phpunit.xml.dist with the plugin file name that should be loaded.

With a bootstrap.php

WP_Test_Suite::load_plugins

A array of plugin paths or a string of a plugin path to load.

WP_Test_Suite::load_files

A array of file paths or a string of a file path to load.

WP_Test_Suite::set_test_root

Set a new test root path. It will try to autoload from:

  • WP_DEVELOP_DIR/tests/phpunit
  • /tmp/wordpress-develop/tests/phpunit
  • /tmp/wordpress-tests-lib
  • /srv/www/wordpress-develop/tests/phpunit
  • /srv/www/wordpress-develop/public_html/tests/phpunit

License

MIT © Fredrik Forsmo

统计信息

  • 总下载量: 26.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 2
  • 依赖项目数: 27
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固