定制 tn-xfive/wp-unit-tests-scaffold 二次开发

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

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

tn-xfive/wp-unit-tests-scaffold

最新稳定版本:v1.1.1

Composer 安装命令:

composer require --dev tn-xfive/wp-unit-tests-scaffold

包简介

Scaffold PHPUnit tests setup for WordPress themes and plugins.

README 文档

README

Tests setup and boilerplate for testing WordPress with PHPUnit.

Usage in projects

To start using PHPUnit for unit testing in WordPress first install PHPUnit in your project (prefereably with Composer: composer require --dev phpunit/phpunit:"^9.5", see https://docs.phpunit.de/en/12.4/installation.html#composer). We need version 9.5 to be compatible with WordPress tests SDK.

Then install WordPress tests SDK with composer require --dev wp-phpunit/wp-phpunit:"^6.9" and composer require --dev yoast/phpunit-polyfills:"^2.0".

Then navigate to your project root and run the following commands:

  1. composer require --dev tn-xfive/wp-unit-tests-scaffold
  2. vendor/bin/scaffold

See wp-tests-config-sample.php file in /tests directory and edit it as instructed.

We are assuming here, that your project root is a WordPress theme or a plugin. If the root is a different folder, then after installation adjust tests/bootstrap.php accordingly to point to a proper wp-load.php location.

Test file boilerplate

There is a boilerplate test file prefilled with some handy test case examples. You can copy them elsewhere and populate the file with your own tests.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-08