PHPUnit can be included as a phar file.

No need to install phpunit in order to run unit tests.  Simply place
'phpunit.phar' in the vendors folder.
This commit is contained in:
Lawrence Barsanti 2014-11-24 14:51:36 -05:00
parent 08674bae2b
commit bb5088cda3
4 changed files with 15 additions and 3 deletions

View file

@ -15,7 +15,9 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if (!defined('__PHPUNIT_PHAR__')) {
require_once 'PHPUnit/TextUI/TestRunner.php';
}
App::uses('CakeFixtureManager', 'TestSuite/Fixture');

View file

@ -16,7 +16,9 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if (!defined('__PHPUNIT_PHAR__')) {
require_once 'PHPUnit/TextUI/Command.php';
}
App::uses('CakeTestRunner', 'TestSuite');
App::uses('CakeTestLoader', 'TestSuite');

View file

@ -151,6 +151,12 @@ class CakeTestSuiteDispatcher {
} elseif (is_dir($vendor . DS . 'PHPUnit')) {
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
break;
} elseif (is_file($vendor . DS . 'phpunit.phar')) {
$backup = $GLOBALS['_SERVER']['SCRIPT_NAME'];
$GLOBALS['_SERVER']['SCRIPT_NAME'] = '-';
$included = include_once $vendor . DS . 'phpunit.phar';
$GLOBALS['_SERVER']['SCRIPT_NAME'] = $backup;
return $included;
}
}
include 'PHPUnit' . DS . 'Autoload.php';

View file

@ -15,7 +15,9 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if (!defined('__PHPUNIT_PHAR__')) {
require_once 'PHPUnit/TextUI/ResultPrinter.php';
}
/**
* CakeBaseReporter contains common reporting features used in the CakePHP Test suite