code coverage support for plugins

typo fix in testsuite shell

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6734 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2008-04-29 18:24:52 +00:00
parent 5ea06cb29c
commit e38afee93d
5 changed files with 13 additions and 7 deletions

View file

@ -69,6 +69,7 @@ if (isset($corePath[0])) {
} else { } else {
define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH); define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
} }
require_once CAKE_TESTS_LIB . 'test_manager.php'; require_once CAKE_TESTS_LIB . 'test_manager.php';
if (Configure::read('debug') < 1) { if (Configure::read('debug') < 1) {

View file

@ -282,7 +282,7 @@ class TestSuiteShell extends Shell {
*/ */
function __installSimpleTest() { function __installSimpleTest() {
if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) { if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
$this->err('Sorry,. Simpletest could not be found. Download it from http://simpletest.org and install it to your vendors directory.'); $this->err('Sorry, Simpletest could not be found. Download it from http://simpletest.org and install it to your vendors directory.');
exit; exit;
} }
} }

View file

@ -84,6 +84,10 @@ class CodeCoverageManagerTest extends UnitTestCase {
$expected = $manager->__testObjectFileFromCaseFile('helpers/some_file.test.php', true); $expected = $manager->__testObjectFileFromCaseFile('helpers/some_file.test.php', true);
$this->assertIdentical(APP.'views'.DS.'helpers'.DS.'some_file.php', $expected); $this->assertIdentical(APP.'views'.DS.'helpers'.DS.'some_file.php', $expected);
$manager->pluginTest = 'bugs';
$expected = $manager->__testObjectFileFromCaseFile('models/some_file.test.php', false);
$this->assertIdentical(APP.'plugins'.DS.'bugs'.DS.'models'.DS.'some_file.php', $expected);
} }
function testOfHtmlReport() { function testOfHtmlReport() {

View file

@ -99,7 +99,7 @@ class CodeCoverageManager {
} }
if (isset($_GET['plugin'])) { if (isset($_GET['plugin'])) {
$manager->pluginTest = true; $manager->pluginTest = $_GET['plugin'];
} }
$manager->testCaseFile = $testCaseFile; $manager->testCaseFile = $testCaseFile;
@ -312,9 +312,13 @@ class CodeCoverageManager {
* @access private * @access private
*/ */
function __testObjectFileFromCaseFile($file, $isApp = true) { function __testObjectFileFromCaseFile($file, $isApp = true) {
$manager = CodeCoverageManager::getInstance();
$path = ROOT.DS; $path = ROOT.DS;
if ($isApp) { if ($isApp) {
$path .= APP_DIR.DS; $path .= APP_DIR.DS;
} elseif (!!$manager->pluginTest) {
$path .= APP_DIR.DS.'plugins'.DS.$manager->pluginTest.DS;
} else { } else {
$path .= CAKE; $path .= CAKE;
} }

View file

@ -455,13 +455,10 @@ if (function_exists('caketestsgetreporter')) {
$query = '?case='.$_GET['case']; $query = '?case='.$_GET['case'];
if (isset($_GET['app'])) { if (isset($_GET['app'])) {
$query .= '&amp;app=true'; $query .= '&amp;app=true';
} elseif (isset($_GET['plugin'])) {
$query .= '&amp;plugin=' . $_GET['plugin'];
} }
$query .= '&amp;code_coverage=true'; $query .= '&amp;code_coverage=true';
// else if (isset($_GET['plugin'])) {
// $show = '?show=cases&amp;plugin=' . $_GET['plugin'];
// } else {
// $show = '?show=cases';
// }
echo "<p><a href='" . RUN_TEST_LINK . $query . "'>Analyze Code Coverage</a></p>\n"; echo "<p><a href='" . RUN_TEST_LINK . $query . "'>Analyze Code Coverage</a></p>\n";
} }
break; break;