Skip to content

The core test lib for testing WordPress theme, plugins, widgets, libraries etc.

Notifications You must be signed in to change notification settings

Mekom/WP-CoreTestLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP-CoreTestLib

This library allows for easy testing of WordPress plugins, themes widgets, libraries. You name it.

Setup

You need to have access to a database server to make use of this library.

Clone this repo into your tests directory

$ cd my-project/
$ cd tests/
$ git clone https://github.com/mekom/WP-CoreTestLib

Copy the config sample into the root of your tests directory.

note: Your config file should be besides the WP-CoreTestLib directory, and not inside it.

my-project/
    tests/
        WP-CoreTestLib/
            wp-test-config-sample.php
        wp-test-config.php
$ cd my-project/tests/
$ cp WP-CoreTestLib/wp-test-config-sample.php wp-test-config.php

Supply the correct settings for database access to the my-project/tests/wp-test-config.php file. (Remember: Using 127.0.0.1 instead of localhost might be preferable)

Include the WP-CoreTestLib/bootstrap.php file from your PHPUnit bootstrap file.

my-project/tests/bootstrap.php

require __DIR__ . "/WP-CoreTestLib/bootstrap.php";

Great! That should be it. You now be able to test WordPress things, and have access to some special wordpress testing functions. You can google the "wordpress testing library" to find out which these are.

But I'll list some of them for you

The Api

###WP_UnitTestCase This is the class you should extend instead of `PHPUnitTestCase

About

The core test lib for testing WordPress theme, plugins, widgets, libraries etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published