Renaming tests folders and making tests runnable again

This commit is contained in:
Jose Lorenzo Rodriguez 2011-04-10 20:08:24 -04:30
parent 7f31cfb173
commit 0263ffc74e
278 changed files with 21 additions and 24 deletions

View file

@ -38,7 +38,7 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
*/
protected function _resolveTestFile($filePath, $params) {
$basePath = $this->_basePath($params) . DS . $filePath;
$ending = '.test.php';
$ending = 'Test.php';
return (strpos($basePath, $ending) === (strlen($basePath) - strlen($ending))) ? $basePath : $basePath . $ending;
}
@ -56,7 +56,7 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
$result = APP_TEST_CASES;
} else if (!empty($params['plugin'])) {
$pluginPath = App::pluginPath($params['plugin']);
$result = $pluginPath . 'tests' . DS . 'cases';
$result = $pluginPath . 'tests' . DS . 'Case';
}
return $result;
}
@ -72,7 +72,9 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
$testCases = array();
foreach ($fileList as $testCaseFile) {
$testCases[$testCaseFile] = str_replace($directory . DS, '', $testCaseFile);
$case = str_replace($directory . DS, '', $testCaseFile);
$case = str_replace('Test.php', '', $case);
$testCases[$testCaseFile] = $case;
}
return $testCases;
}
@ -92,7 +94,7 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
$files = new RegexIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)),
'/.*\.test.php$/'
'/.*Test.php$/'
);
foreach ($files as $file) {

View file

@ -17,8 +17,8 @@
* @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');
define('CORE_TEST_CASES', LIBS . 'tests' . DS . 'Case');
define('APP_TEST_CASES', TESTS . 'Case');
App::uses('CakeTestSuiteCommand', 'TestSuite');

View file

@ -105,43 +105,38 @@ class CakeFixtureManager {
if (strpos($fixture, 'core.') === 0) {
$fixture = substr($fixture, strlen('core.'));
$fixturePaths[] = LIBS . 'tests' . DS . 'fixtures';
$fixturePaths[] = LIBS . 'tests' . DS . 'Fixture';
} elseif (strpos($fixture, 'app.') === 0) {
$fixture = substr($fixture, strlen('app.'));
$fixturePaths = array(
TESTS . 'fixtures',
VENDORS . 'tests' . DS . 'fixtures'
TESTS . 'Fixture'
);
} elseif (strpos($fixture, 'plugin.') === 0) {
$parts = explode('.', $fixture, 3);
$pluginName = $parts[1];
$fixture = $parts[2];
$fixturePaths = array(
App::pluginPath($pluginName) . 'tests' . DS . 'fixtures',
TESTS . 'fixtures',
VENDORS . 'tests' . DS . 'fixtures'
App::pluginPath($pluginName) . 'tests' . DS . 'Fixture',
TESTS . 'Fixture'
);
} else {
$fixturePaths = array(
TESTS . 'fixtures',
VENDORS . 'tests' . DS . 'fixtures',
LIBS . DS . 'cake' . DS . 'tests' . DS . 'fixtures'
TESTS . 'Fixture',
LIBS . 'tests' . DS . 'Fixture'
);
}
foreach ($fixturePaths as $path) {
if (is_readable($path . DS . $fixture . '_fixture.php')) {
$fixtureFile = $path . DS . $fixture . '_fixture.php';
$className = Inflector::camelize($fixture);
if (is_readable($path . DS . $className . 'Fixture.php')) {
$fixtureFile = $path . DS . $className . 'Fixture.php';
require_once($fixtureFile);
$fixtureClass = $className . 'Fixture';
$this->_loaded[$fixtureIndex] = new $fixtureClass($this->_db);
$this->_fixtureMap[$fixtureClass] = $this->_loaded[$fixtureIndex];
break;
}
}
if (isset($fixtureFile)) {
require_once($fixtureFile);
$fixtureClass = Inflector::camelize($fixture) . 'Fixture';
$this->_loaded[$fixtureIndex] = new $fixtureClass($this->_db);
$this->_fixtureMap[$fixtureClass] = $this->_loaded[$fixtureIndex];
}
}
}

Some files were not shown because too many files have changed in this diff Show more