Download the PHP package johnpbloch/wp-unit-test-project without Composer

On this page you can find all versions of the php package johnpbloch/wp-unit-test-project. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-unit-test-project

WP Unit Test Project

I created this as an easy way to get a unit test suite started for testing WordPress plugins (and themes, I suppose).

Getting Started

To create a new project, you'll need Composer. You can use either a global installation or a local one. These instructions will work for global installations, but if you are using the PHAR in this project, just replace composer with php composer.phar in any commands that use composer.

To install, simply run the following command:

my-project is the name of the directory in which it will install the package.

This installs a base package along with all the necessary dependencies. One of these dependencies is PHPUnit itself. You don't have to use the version installed by the package, but I thought it would be a good idea to include it too. This will work no matter where PHPUnit is installed as long as you are able to invoke it.

To run the tests, simply run PHPUnit:

I like to add ./vendor/bin to the front of my environment $PATH so that I can omit the path part of the command:

If you're using Windows your command will be:

Next Steps

After you've installed the package, you'll want to edit composer.json to change the name from johnpbloch/wp-unit-test-project to something more appropriate to your project.

Now you need to import your project and write some tests for it!

Adding your project's code as a dependency in Composer is the recommended way to include it in this package, but using a git submodule or SVN external would also work.

Adding Tests to your Test Suite

By default, this package is configured to treat any PHP file in the tests directory as a unit test case. If you need to add other PHP files to the repo, either put them in a different directory or use a different file extension (such as .inc).

To create a new test, just create a new PHP file in the tests directory. This package comes with a custom TestCase class that extends PHPUnit's core TestCase. You should use the bundled test case when creating your test classes:

Other Resources


All versions of wp-unit-test-project with dependencies

PHP Build Version
Package Version
Requires 10up/wp_mock Version dev-master
phpunit/phpunit Version ~3.7@stable
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package johnpbloch/wp-unit-test-project contains the following files

Loading the files please wait ....