/WordPress-TDD

Sample codes for TDD with WordPress.

Primary LanguagePHP

WordPress-TDD

Introduction

Test Driven Development with WordPress. Sample codes derived from notes in this StackOverflow question.

WordPress Testing framework developed by Nikolay Bachiyski. His framework is a wrapper around PHPUnit and is now being integrated as the defacto test runner in WordPress Unit Tests for the WordPress Core.

Setup

  1. Clone this Git Repository

     $ git clone git://github.com/miccheng/WordPress-TDD.git
    
  2. Initialize Git submodule for WordPress-Tests.

     $ git submodule init
     $ git submodule update
    
  3. Copy my-plugin folder into your current WordPress installation.

  4. Enable the MyPlugin module.

  5. Copy WordPress-Tests folder to the same folder level as your WordPress installation.

  6. Copy unittests-config-sample.php to unittests-config.php. Edit the new file and update the database, path setting.

  7. In console/terminal, cd to the my-plugin folder.

  8. Type: phpunit.

Next Steps