mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making the testsuite run again
This commit is contained in:
parent
4a287faa1e
commit
848461f7a0
9 changed files with 22 additions and 35 deletions
|
@ -114,7 +114,7 @@ class ExtractTask extends Shell {
|
|||
$this->__paths = explode(',', $this->params['paths']);
|
||||
} else {
|
||||
$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) {
|
||||
$response = $this->in($message, null, $defaultPath);
|
||||
if (strtoupper($response) === 'Q') {
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
* @since CakePHP(tm) v 1.2.0.4433
|
||||
* @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 {
|
||||
|
||||
/**
|
||||
|
@ -155,8 +160,6 @@ class TestSuiteShell extends Shell {
|
|||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_dispatcher.php';
|
||||
|
||||
$corePath = App::core('cake');
|
||||
if (isset($corePath[0])) {
|
||||
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->loadTestFramework();
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_manager.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,8 +254,6 @@ class TestSuiteShell extends Shell {
|
|||
* @return void
|
||||
*/
|
||||
protected function run($runnerArgs, $options = array()) {
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_runner.php';
|
||||
|
||||
restore_error_handler();
|
||||
restore_error_handler();
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ class ConnectionManager {
|
|||
if (!empty(self::$config->{$name})) {
|
||||
self::$_connectionsEnum[$name] = self::_connectionData(self::$config->{$name});
|
||||
} else {
|
||||
throw new MissingConnectionException(array('class' => 'ConnectionManager'));
|
||||
throw new MissingConnectionException(array('class' => $name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
|
||||
|
||||
require_once CAKE_TESTS_LIB . 'cake_fixture_manager.php';
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_model.php';
|
||||
require_once CAKE_TESTS_LIB . 'cake_test_fixture.php';
|
||||
App::uses('CakeFixtureManager', 'TestSuite/Fixture');
|
||||
App::uses('CakeTestModel', 'TestSuite/Fixture');
|
||||
App::uses('CakeTestFixture', 'TestSuite/Fixture');
|
||||
|
||||
/**
|
||||
* CakeTestCase class
|
||||
|
|
|
@ -55,7 +55,7 @@ class CakeFixtureManager {
|
|||
* @param CakeTestCase $test the test case to inspect
|
||||
* @return void
|
||||
*/
|
||||
public function fixturize(CakeTestCase $test) {
|
||||
public function fixturize($test) {
|
||||
if (empty($test->fixtures) || !empty($this->_processed[get_class($test)])) {
|
||||
$test->db = $this->_db;
|
||||
return;
|
||||
|
@ -81,22 +81,7 @@ class CakeFixtureManager {
|
|||
if ($this->_initialized) {
|
||||
return;
|
||||
}
|
||||
$testDbAvailable = in_array('test', array_keys(ConnectionManager::enumConnectionObjects()));
|
||||
|
||||
$_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'));
|
||||
}
|
||||
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
$this->_db = $db;
|
||||
ClassRegistry::config(array('ds' => 'test'));
|
||||
$this->_initialized = true;
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
* @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.
|
||||
|
|
|
@ -17,13 +17,15 @@
|
|||
* @since CakePHP(tm) v 1.2.0.4433
|
||||
* @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_GROUPS', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'groups');
|
||||
define('CORE_TEST_CASES', LIBS . 'tests' . DS . 'cases');
|
||||
define('CORE_TEST_GROUPS', LIBS . 'tests' . DS . 'groups');
|
||||
define('APP_TEST_CASES', TESTS . 'cases');
|
||||
define('APP_TEST_GROUPS', TESTS . 'groups');
|
||||
|
||||
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
|
||||
|
@ -88,8 +90,6 @@ class TestManager {
|
|||
* @return void
|
||||
*/
|
||||
public function __construct($params = array()) {
|
||||
require_once(CAKE_TESTS_LIB . 'cake_test_case.php');
|
||||
|
||||
$this->params = $params;
|
||||
if (isset($params['app'])) {
|
||||
$this->appTest = true;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
require 'PHPUnit/TextUI/Command.php';
|
||||
require_once 'test_manager.php';
|
||||
App::uses('TestManager', 'TestSuite');
|
||||
|
||||
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
* @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
|
||||
|
|
Loading…
Reference in a new issue