Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHPUnit files needed to run PHPUnit as standalone in CakePHP 2.x
branch: dev

This branch is 6 commits ahead, 5 commits behind Hyra:master

Failed to load latest commit information.
Console/Command update 3.7 to 3.7.32
Test/Case/Console/Command documentation
Vendor/exe rewrite and support for windows
README.md Update README.md

README.md

PHPUnit installer as CakePHP standalone plugin

WARNING

This plugin is deprecated as of now since the PEAR channel for it has been shut down. Please composer your app and use that to include PHPUnit or simply use the phar file (Support for this has been added in recent 2.x versions, as well).

What?

This "installer" prepares all the dependencies needed to use PHPUnit with CakePHP 2.x through the use of vendor files.

PHPUnit installer now supports 3.7 (default, currently 3.7.32), 3.6 and maybe 4.0 (careful, that version is not yet fully working with CakePHP).

Why?

Because I'm a fan of self-contained systems. Sure, installing PHPUnit through PEAR systemwide is supposed to be "easy", but when you're working on multiple workstations and deploy to different hosting setups its just nice to know you have everything within reach.

Requirements

PHP5.3 and CakePHP2.x (>= 2.3)

Note: This is ONLY for non-composer apps. Using composer for CakePHP2+ apps is highly recommended, though. Thus modern apps shouldn't need this plugin, at all :)

Install the Plugin

Install this plugin to your app/Plugin folder by cloning it to a folder called "Phpunit"

Make sure you got either CakePlugin::loadAll() - or specifically CakePlugin::load('Phpunit') in your bootstrap! Otherwise the plugin will not be available.

Usage

To install PHPUnit to your CakePHP 2.x install you can use the Shell.

Run cake Phpunit.Phpunit install directly from your console. This will download and extract all the necessary files, and put them in your specified Vendor folder.

You can now use PHPUnit through the CLI or your favourite browser. Try it by running:

cake testsuite core Basics

If all went well you will see the PHPUnit run the CakePHP basic tests.

It works with Mac OSX, Linux and Windows. Please report any problems.

Autoload

If you have it installed in your ROOT vendors and get (fatal) errors while baking put this at the top of the VENDORS/PHPUnit/Autoload.php file:

if (strpos(get_include_path(), dirname(dirname(__FILE__))) === false) {
    set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__)));
}

This way the vendors folder itself is also an include path and those errors will go away. The PHPUnit files are checked/included prior to baking unit tests. So if you did not already set the path in your system, you need to do it this way.

Checking for updates

Running Phpunit.Phpunit info you can check for updates. This is mainly for maintaining the plugin and keeping it up to date.

Credits

Mark Scherer (dereuromark) and Stef van den Ham (Hyra)

Something went wrong with that request. Please try again.