mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making the test suite load again
This commit is contained in:
parent
1b38d7c851
commit
f8b51bfd92
6 changed files with 36 additions and 21 deletions
|
@ -20,8 +20,8 @@
|
|||
*/
|
||||
|
||||
App::uses('CakeTestSuiteDispatcher', 'TestSuite');
|
||||
App::uses('TestRunner', 'TestSuite');
|
||||
App::uses('TestManager', 'TestSuite');
|
||||
App::uses('CakeTestSuiteCommand', 'TestSuite');
|
||||
App::uses('CakeTestLoader', 'TestSuite');
|
||||
|
||||
class TestSuiteShell extends Shell {
|
||||
|
||||
|
@ -163,7 +163,6 @@ class TestSuiteShell extends Shell {
|
|||
public function initialize() {
|
||||
$this->_dispatcher = new CakeTestSuiteDispatcher();
|
||||
$this->_dispatcher->loadTestFramework();
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_command.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -406,6 +406,15 @@ class MissingModelException extends CakeException {
|
|||
protected $_messageTemplate = 'Model %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception Raised when a test loader could not be found
|
||||
*
|
||||
* @package cake.libs
|
||||
*/
|
||||
class MissingTestLoaderException extends CakeException {
|
||||
protected $_messageTemplate = 'Test loader %s could not be found.';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exception class for Cache. This exception will be thrown from Cache when it
|
||||
|
|
|
@ -30,7 +30,7 @@ App::uses('CakeTestFixture', 'TestSuite/Fixture');
|
|||
abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* The class responsible for managinf the creation, loading and removing of fixtures
|
||||
* The class responsible for managing the creation, loading and removing of fixtures
|
||||
*
|
||||
* @var CakeFixtureManager
|
||||
* @access public
|
||||
|
|
|
@ -16,17 +16,14 @@
|
|||
* @since CakePHP(tm) v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
define('CORE_TEST_CASES', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'cases');
|
||||
define('APP_TEST_CASES', TESTS . 'cases');
|
||||
|
||||
require 'PHPUnit/TextUI/Command.php';
|
||||
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_runner.php';
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_loader.php';
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_suite.php';
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_case.php';
|
||||
require_once CAKE_TESTS_LIB . 'controller_test_case.php';
|
||||
|
||||
App::uses('CakeTestRunner', 'TestSuite');
|
||||
App::uses('CakeTestLoader', 'TestSuite');
|
||||
App::uses('CakeTestSuite', 'TestSuite');
|
||||
App::uses('CakeTestCase', 'TestSuite');
|
||||
App::uses('ControllerTestCase', 'TestSuite');
|
||||
|
||||
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
|
||||
|
||||
|
@ -43,6 +40,9 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
|
|||
* @param array $params list of options to be used for this run
|
||||
*/
|
||||
public function __construct($loader, $params = array()) {
|
||||
if (!class_exists($loader)) {
|
||||
throw new MissingTestLoaderException;
|
||||
}
|
||||
$this->arguments['loader'] = $loader;
|
||||
$this->arguments['test'] = $params['case'];
|
||||
$this->arguments['testFile'] = $params;
|
||||
|
@ -161,13 +161,14 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
|
|||
|
||||
$type = strtolower($reporter);
|
||||
$coreClass = 'Cake' . ucwords($reporter) . 'Reporter';
|
||||
$coreFile = CAKE_TESTS_LIB . 'reporter/cake_' . $type . '_reporter.php';
|
||||
App::uses($coreClass, 'TestSuite/Reporter');
|
||||
|
||||
$appClass = $reporter . 'Reporter';
|
||||
$appFile = APPLIBS . 'test_suite/reporter/' . $type . '_reporter.php';
|
||||
if (include_once $coreFile) {
|
||||
App::uses($appClass, 'TestSuite/Reporter');
|
||||
|
||||
if (!class_exists($appClass)) {
|
||||
$object = new $coreClass(null, $this->_params);
|
||||
} elseif (include_once $appFile) {
|
||||
} else {
|
||||
$object = new $appClass(null, $this->_params);
|
||||
}
|
||||
return $this->arguments['printer'] = $object;
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
define('CORE_TEST_CASES', LIBS . 'tests' . DS . 'cases');
|
||||
define('APP_TEST_CASES', TESTS . 'cases');
|
||||
|
||||
App::uses('CakeTestSuiteCommand', 'TestSuite');
|
||||
|
||||
/**
|
||||
* CakeTestSuiteDispatcher handles web requests to the test suite and runs the correct action.
|
||||
*
|
||||
|
@ -87,8 +92,6 @@ class CakeTestSuiteDispatcher {
|
|||
$this->_checkPHPUnit();
|
||||
$this->_parseParams();
|
||||
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_command.php';
|
||||
|
||||
if ($this->params['case']) {
|
||||
$value = $this->_runTestCase();
|
||||
} else {
|
||||
|
|
|
@ -19,9 +19,12 @@
|
|||
|
||||
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
|
||||
|
||||
require_once CAKE . 'libs' . DS . 'dispatcher.php';
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_case.php';
|
||||
App::import('Core', array('Router', 'CakeRequest', 'CakeResponse', 'Helper'));
|
||||
App::uses('Dispatcher', 'Routing');
|
||||
App::uses('CakeTestCase', 'TestSuite');
|
||||
App::uses('Router', 'Routing');
|
||||
App::uses('CakeRequest', 'Network');
|
||||
App::uses('CakeResponse', 'Network');
|
||||
App::uses('Helper', 'View');
|
||||
|
||||
/**
|
||||
* ControllerTestDispatcher class
|
||||
|
|
Loading…
Reference in a new issue