Fixing several errors when running the testsuite

This commit is contained in:
José Lorenzo Rodríguez 2010-12-11 01:17:55 -04:30
parent 4389764050
commit 8e5bd76752
23 changed files with 37 additions and 24 deletions

View file

@ -285,8 +285,7 @@ class App {
if (!empty($paths[$type])) { if (!empty($paths[$type])) {
$path = array_flip(array_flip(array_merge( $path = array_flip(array_flip(array_merge(
(array)$paths[$type], self::$__packages[$type], $merge (array)$paths[$type], self::$__packages[$type])));
)));
self::$__packages[$type] = array_values($path); self::$__packages[$type] = array_values($path);
} else { } else {
$path = array_flip(array_flip(self::$__packages[$type])); $path = array_flip(array_flip(self::$__packages[$type]));

View file

@ -19,7 +19,7 @@
* @since CakePHP(tm) v 1.2.0.0 * @since CakePHP(tm) v 1.2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('ObjectCollection', 'Core'); App::uses('ObjectCollection', 'Utility');
/** /**
* Model behavior collection class. * Model behavior collection class.

View file

@ -18,6 +18,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('DataSource', 'Model/Datasource');
App::uses('String', 'Utility'); App::uses('String', 'Utility');
App::uses('View', 'View'); App::uses('View', 'View');

View file

@ -18,7 +18,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('CakeSocket', 'Core'); App::uses('CakeSocket', 'Core');
App::uses('Router', 'Core'); App::uses('Router', 'Routing');
/** /**
* Cake network socket connection class. * Cake network socket connection class.

View file

@ -286,7 +286,7 @@ class Router {
* @return array Array of routes * @return array Array of routes
*/ */
public static function redirect($route, $url, $options) { public static function redirect($route, $url, $options) {
App::uses('RedirectRoute', 'Core'); App::uses('RedirectRoute', 'Routing/Route');
$options['routeClass'] = 'RedirectRoute'; $options['routeClass'] = 'RedirectRoute';
return self::connect($route, $url, $options); return self::connect($route, $url, $options);
} }

View file

@ -21,7 +21,6 @@
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('CakeFixtureManager', 'TestSuite/Fixture'); App::uses('CakeFixtureManager', 'TestSuite/Fixture');
App::uses('CakeTestModel', 'TestSuite/Fixture');
App::uses('CakeTestFixture', 'TestSuite/Fixture'); App::uses('CakeTestFixture', 'TestSuite/Fixture');
/** /**
@ -30,7 +29,7 @@ App::uses('CakeTestFixture', 'TestSuite/Fixture');
* @package cake * @package cake
* @subpackage cake.cake.tests.lib * @subpackage cake.cake.tests.lib
*/ */
class CakeTestCase extends PHPUnit_Framework_TestCase { abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
/** /**
* The class responsible for managinf the creation, loading and removing of fixtures * The class responsible for managinf the creation, loading and removing of fixtures

View file

@ -18,6 +18,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('TestManager', 'TestSuite');
/** /**
* CakeTestSuiteDispatcher handles web requests to the test suite and runs the correct action. * CakeTestSuiteDispatcher handles web requests to the test suite and runs the correct action.
* *
@ -201,7 +202,6 @@ class CakeTestSuiteDispatcher {
*/ */
function &getManager() { function &getManager() {
if (empty($this->Manager)) { if (empty($this->Manager)) {
require_once CAKE_TESTS_LIB . 'test_manager.php';
$this->Manager = new $this->_managerClass($this->params); $this->Manager = new $this->_managerClass($this->params);
} }
return $this->Manager; return $this->Manager;
@ -217,13 +217,13 @@ class CakeTestSuiteDispatcher {
if (!self::$_Reporter) { if (!self::$_Reporter) {
$type = strtolower($this->params['output']); $type = strtolower($this->params['output']);
$coreClass = 'Cake' . ucwords($this->params['output']) . 'Reporter'; $coreClass = 'Cake' . ucwords($this->params['output']) . 'Reporter';
$coreFile = CAKE_TESTS_LIB . 'reporter/cake_' . $type . '_reporter.php';
$appClass = $this->params['output'] . 'Reporter'; $appClass = $this->params['output'] . 'Reporter';
$appFile = APPLIBS . 'test_suite/reporter/' . $type . '_reporter.php'; App::uses($coreClass, 'TestSuite/Reporter');
if (include_once $coreFile) { App::uses($appClass, 'TestSuite/Reporter');
if (class_exists($coreClass)) {
self::$_Reporter = new $coreClass(null, $this->params); self::$_Reporter = new $coreClass(null, $this->params);
} elseif (include_once $appFile) { } elseif (class_exists($appClass)) {
self::$_Reporter = new $appClass(null, $this->params); self::$_Reporter = new $appClass(null, $this->params);
} }
} }

View file

@ -17,10 +17,11 @@
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
require_once dirname(__FILE__) . '/base_coverage_report.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('BaseCoverageReport', 'TestSuite/Coverage');
class HtmlCoverageReport extends BaseCoverageReport { class HtmlCoverageReport extends BaseCoverageReport {
/** /**

View file

@ -19,6 +19,9 @@
*/ */
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('ConnectionManager', 'Model');
App::uses('ClassRegistry', 'Utility');
class CakeFixtureManager { class CakeFixtureManager {
/** /**
@ -100,6 +103,7 @@ class CakeFixtureManager {
if (isset($this->_loaded[$fixture])) { if (isset($this->_loaded[$fixture])) {
continue; continue;
} }
if (strpos($fixture, 'core.') === 0) { if (strpos($fixture, 'core.') === 0) {
$fixture = substr($fixture, strlen('core.')); $fixture = substr($fixture, strlen('core.'));
foreach (App::core('cake') as $key => $path) { foreach (App::core('cake') as $key => $path) {

View file

@ -17,7 +17,7 @@
* @since CakePHP(tm) v 1.2.0.4433 * @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
include_once dirname(__FILE__) . DS . 'cake_base_reporter.php'; App::uses('CakeBaseReporter', 'TestSuite/Reporter');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');

View file

@ -23,9 +23,11 @@ define('APP_TEST_CASES', TESTS . 'cases');
define('APP_TEST_GROUPS', TESTS . 'groups'); define('APP_TEST_GROUPS', TESTS . 'groups');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('CakeTestSuite', 'TestSuite'); App::uses('CakeTestSuite', 'TestSuite');
App::uses('CakeTestCase', 'TestSuite'); App::uses('CakeTestCase', 'TestSuite');
App::uses('CakeFixtureManager', 'TestSuite/Fixture'); App::uses('CakeFixtureManager', 'TestSuite/Fixture');
App::uses('CakeTestModel', 'TestSuite/Fixture');
/** /**
* TestManager is the base class that handles loading and initiating the running * TestManager is the base class that handles loading and initiating the running

View file

@ -20,7 +20,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('Router', 'Core'); App::uses('Router', 'Routing');
/** /**
* Abstract base class for all other Helpers in CakePHP. * Abstract base class for all other Helpers in CakePHP.

View file

@ -23,7 +23,8 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('JsHelper', 'Helper'); App::uses('JsHelper', 'View/Helper');
App::uses('JsBaseEngineHelper', 'View/Helper');
class JqueryEngineHelper extends JsBaseEngineHelper { class JqueryEngineHelper extends JsBaseEngineHelper {
/** /**

View file

@ -16,7 +16,7 @@
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('ObjectCollection', 'Core'); App::uses('ObjectCollection', 'Utility');
class HelperCollection extends ObjectCollection { class HelperCollection extends ObjectCollection {

View file

@ -22,6 +22,7 @@
* Included libraries. * Included libraries.
*/ */
App::uses('HelperCollection', 'View'); App::uses('HelperCollection', 'View');
App::uses('Router', 'Routing');
/** /**
* View, the V in the MVC triad. * View, the V in the MVC triad.

View file

@ -145,7 +145,7 @@ if (!defined('CAKE_TESTS')) {
/** /**
* Path to the test suite. * Path to the test suite.
*/ */
define('CAKE_TESTS_LIB', CAKE_TESTS.'lib'.DS); define('CAKE_TESTS_LIB', LIBS . 'TestSuite' . DS);
/** /**
* Path to the controller test directory. * Path to the controller test directory.

View file

@ -24,7 +24,7 @@ App::uses('Controller', 'Controller');
App::uses('CakeHtmlReporter', 'TestSuite/Reporter'); App::uses('CakeHtmlReporter', 'TestSuite/Reporter');
if (!class_exists('AppController', false)) { if (!class_exists('AppController', false)) {
require_once LIBS . 'Controller' . DS . 'app_controller.php'; require_once LIBS . 'Controller' . DS . 'AppController.php';
} elseif (!defined('APP_CONTROLLER_EXISTS')) { } elseif (!defined('APP_CONTROLLER_EXISTS')) {
define('APP_CONTROLLER_EXISTS', true); define('APP_CONTROLLER_EXISTS', true);
} }
@ -38,8 +38,8 @@ if (!class_exists('AppController', false)) {
class CakeTestCaseTest extends CakeTestCase { class CakeTestCaseTest extends CakeTestCase {
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
require_once TEST_CAKE_CORE_INCLUDE_PATH . DS . 'tests' . DS . 'fixtures' . DS . 'assert_tags_test_case.php'; require_once LIBS . 'tests' . DS . 'fixtures' . DS . 'assert_tags_test_case.php';
require_once TEST_CAKE_CORE_INCLUDE_PATH . DS . 'tests' . DS . 'fixtures' . DS . 'fixturized_test_case.php'; require_once LIBS . 'tests' . DS . 'fixtures' . DS . 'fixturized_test_case.php';
} }
/** /**

View file

@ -18,6 +18,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('DboSource', 'Model/Datasource'); App::uses('DboSource', 'Model/Datasource');
App::uses('Model', 'Model');
/** /**
* CakeTestFixtureTestFixture class * CakeTestFixtureTestFixture class

View file

@ -18,7 +18,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
require_once CAKE . 'tests' . DS . 'lib' . DS . 'coverage' . DS . 'html_coverage_report.php'; App::uses('HtmlCoverageReport', 'TestSuite/Coverage');
class HtmlCoverageReportTest extends CakeTestCase { class HtmlCoverageReportTest extends CakeTestCase {
/** /**

View file

@ -18,6 +18,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('Set', 'Utility'); App::uses('Set', 'Utility');
App::uses('Model', 'Model');
/** /**
* SetTest class * SetTest class

View file

@ -20,6 +20,7 @@
App::uses('View', 'View'); App::uses('View', 'View');
App::uses('Helper', 'View'); App::uses('Helper', 'View');
App::uses('Model', 'Model');
App::uses('Router', 'Routing'); App::uses('Router', 'Routing');
/** /**

View file

@ -17,8 +17,9 @@
* @since CakePHP(tm) v 1.2.0.4206 * @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('View', 'View'); App::uses('View', 'View');
App::uses('TextHelper', 'Helper'); App::uses('TextHelper', 'View/Helper');
/** /**
* TextHelperTest class * TextHelperTest class

View file

@ -19,6 +19,7 @@
*/ */
App::uses('View', 'View'); App::uses('View', 'View');
App::uses('Helper', 'View');
App::uses('Controller', 'Controller'); App::uses('Controller', 'Controller');
App::uses('CacheHelper', 'View/Helper'); App::uses('CacheHelper', 'View/Helper');
App::uses('ErrorHandler', 'Error'); App::uses('ErrorHandler', 'Error');