Making the testsuite run again

This commit is contained in:
José Lorenzo Rodríguez 2010-12-08 01:49:36 -04:30
parent 4a287faa1e
commit 848461f7a0
9 changed files with 22 additions and 35 deletions

View file

@ -114,7 +114,7 @@ class ExtractTask extends Shell {
$this->__paths = explode(',', $this->params['paths']); $this->__paths = explode(',', $this->params['paths']);
} else { } else {
$defaultPath = APP_PATH; $defaultPath = APP_PATH;
$message = __("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one", $this->Dispatch->params['root'] . DS . 'myapp'); $message = __("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one", $defaultPath);
while (true) { while (true) {
$response = $this->in($message, null, $defaultPath); $response = $this->in($message, null, $defaultPath);
if (strtoupper($response) === 'Q') { if (strtoupper($response) === 'Q') {

View file

@ -19,6 +19,11 @@
* @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)
*/ */
App::uses('CakeTestSuiteDispatcher', 'TestSuite');
App::uses('TestRunner', 'TestSuite');
App::uses('TestManager', 'TestSuite');
class TestSuiteShell extends Shell { class TestSuiteShell extends Shell {
/** /**
@ -155,8 +160,6 @@ class TestSuiteShell extends Shell {
* @return void * @return void
*/ */
public function initialize() { public function initialize() {
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_dispatcher.php';
$corePath = App::core('cake'); $corePath = App::core('cake');
if (isset($corePath[0])) { if (isset($corePath[0])) {
define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS); define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS);
@ -166,7 +169,6 @@ class TestSuiteShell extends Shell {
$this->_dispatcher = new CakeTestSuiteDispatcher(); $this->_dispatcher = new CakeTestSuiteDispatcher();
$this->_dispatcher->loadTestFramework(); $this->_dispatcher->loadTestFramework();
require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_manager.php';
} }
/** /**
@ -252,8 +254,6 @@ class TestSuiteShell extends Shell {
* @return void * @return void
*/ */
protected function run($runnerArgs, $options = array()) { protected function run($runnerArgs, $options = array()) {
require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_runner.php';
restore_error_handler(); restore_error_handler();
restore_error_handler(); restore_error_handler();

View file

@ -230,7 +230,7 @@ class ConnectionManager {
if (!empty(self::$config->{$name})) { if (!empty(self::$config->{$name})) {
self::$_connectionsEnum[$name] = self::_connectionData(self::$config->{$name}); self::$_connectionsEnum[$name] = self::_connectionData(self::$config->{$name});
} else { } else {
throw new MissingConnectionException(array('class' => 'ConnectionManager')); throw new MissingConnectionException(array('class' => $name));
} }
} }

View file

@ -20,9 +20,9 @@
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
require_once CAKE_TESTS_LIB . 'cake_fixture_manager.php'; App::uses('CakeFixtureManager', 'TestSuite/Fixture');
require_once CAKE_TESTS_LIB . 'cake_test_model.php'; App::uses('CakeTestModel', 'TestSuite/Fixture');
require_once CAKE_TESTS_LIB . 'cake_test_fixture.php'; App::uses('CakeTestFixture', 'TestSuite/Fixture');
/** /**
* CakeTestCase class * CakeTestCase class

View file

@ -55,7 +55,7 @@ class CakeFixtureManager {
* @param CakeTestCase $test the test case to inspect * @param CakeTestCase $test the test case to inspect
* @return void * @return void
*/ */
public function fixturize(CakeTestCase $test) { public function fixturize($test) {
if (empty($test->fixtures) || !empty($this->_processed[get_class($test)])) { if (empty($test->fixtures) || !empty($this->_processed[get_class($test)])) {
$test->db = $this->_db; $test->db = $this->_db;
return; return;
@ -81,22 +81,7 @@ class CakeFixtureManager {
if ($this->_initialized) { if ($this->_initialized) {
return; return;
} }
$testDbAvailable = in_array('test', array_keys(ConnectionManager::enumConnectionObjects())); $db = ConnectionManager::getDataSource('test');
$_prefix = null;
if ($testDbAvailable) {
// Try for test DB
@$db = ConnectionManager::getDataSource('test');
$testDbAvailable = $db->isConnected();
} else {
throw new MissingConnectionException(__('You need to create a $test datasource connection to start using fixtures'));
}
if (!$testDbAvailable) {
throw new MissingConnectionException(__('Unable to connect to the $test datasource'));
}
$this->_db = $db; $this->_db = $db;
ClassRegistry::config(array('ds' => 'test')); ClassRegistry::config(array('ds' => 'test'));
$this->_initialized = true; $this->_initialized = true;

View file

@ -17,7 +17,8 @@
* @since CakePHP(tm) v 1.2.0.4667 * @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
require_once LIBS.'model'.DS.'model.php';
App::uses('Model', 'Model');
/** /**
* Short description for class. * Short description for class.

View file

@ -17,13 +17,15 @@
* @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)
*/ */
define('CORE_TEST_CASES', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'cases'); define('CORE_TEST_CASES', LIBS . 'tests' . DS . 'cases');
define('CORE_TEST_GROUPS', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'groups'); define('CORE_TEST_GROUPS', LIBS . 'tests' . DS . 'groups');
define('APP_TEST_CASES', TESTS . 'cases'); 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');
require_once CAKE_TESTS_LIB . 'cake_test_suite.php'; App::uses('CakeTestSuite', 'TestSuite');
App::uses('CakeTestCase', 'TestSuite');
App::uses('CakeFixtureManager', '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
@ -88,8 +90,6 @@ class TestManager {
* @return void * @return void
*/ */
public function __construct($params = array()) { public function __construct($params = array()) {
require_once(CAKE_TESTS_LIB . 'cake_test_case.php');
$this->params = $params; $this->params = $params;
if (isset($params['app'])) { if (isset($params['app'])) {
$this->appTest = true; $this->appTest = true;

View file

@ -20,7 +20,7 @@
require 'PHPUnit/TextUI/Command.php'; require 'PHPUnit/TextUI/Command.php';
require_once 'test_manager.php'; App::uses('TestManager', 'TestSuite');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT'); PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');

View file

@ -17,7 +17,8 @@
* @since CakePHP(tm) v 1.2.0.5432 * @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Xml'); App::uses('Xml', 'Utility');
App::uses('CakeTestModel', 'TestSuite/Fixture');
/** /**
* Article class * Article class