Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Improved WordPress tests
branch: master

This branch is 10 commits ahead, 18 commits behind nb:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
.gitignore
README.md
TestAll.php
TestMUPlugins.php
TestPlugins.php
TestThemes.php
build.xml
init.php
phpunit.xml
test_go_to.php
test_hello.php
test_test.php
test_texturize.php
unittests-config-sample.php

README.md

About

This is a fork of Nikolay Bachiyski's alternative WordPress testing framework. The fork makes testing plugins easier.

Rationale

WordPress already has an automated testing suite. What you see here is an alternative testing framework, with the following goals:

  • faster
  • runs every test case in a clean WordPress install
  • uses the default PHPUnit runner, instead of custom one
  • doesn't encourage or support the usage of shared/prebuilt fixtures

It uses SQL transactions to clean up automatically after each test.

Installation

  1. Install PHPUnit http://phpunit.de
  2. Clone the project.
  3. Copy unittests-config-sample.php to unittests-config.php.
  4. Edit the config. USE A NEW DATABASE, BECAUSE ALL THE DATA INSIDE WILL BE DELETED.
  5. $ phpunit TestAll # test plugins and all tests
  6. $ phpunit TestPlugins # test just plugins activated in unittests-config.php
  7. $ phpunit test_test.php

Writing Tests for Plugins

Plugin tests should be stored in a wp-tests directory inside the plugin's root directory. Each file should be prepended with "test_" so that the test suite can automatically discover each test case.

Do not include or require the tests within your plugin.

Something went wrong with that request. Please try again.