/**
  * testRunAllTests method
  *
  * @return void
  * @access public
  */
 function testRunAllTests()
 {
     $folder = new Folder($this->Sut->_getTestsPath());
     $extension = str_replace('.', '\\.', TestManager::getExtension('test'));
     $out = $folder->findRecursive('.*' . $extension);
     $reporter = new CakeHtmlReporter();
     $list = TestManager::runAllTests($reporter, true);
     $this->assertEqual(count($out), count($list));
 }
Beispiel #2
0
 function main()
 {
     $this->doCoverage = in_array('cov', $this->args);
     App::import('Lib', 'Ci.JunitReporter');
     $this->_startCoverage('Clover Shell');
     $Manager = new TestManager();
     $Manager->appTest = true;
     $Manager->pluginTest = null;
     $Reporter =& new JunitReporter(null, array('app' => $Manager->appTest, 'plugin' => $Manager->pluginTest, 'group' => $this->type === 'group', 'codeCoverage' => false, 'coverage' => $this->_coverage));
     $this->out(__('Running app all', true));
     $result = $Manager->runAllTests($Reporter);
     $Manager->appTest = false;
     $plugins = App::objects('plugin', APP . 'plugins' . DS, false);
     foreach ($plugins as $plugin) {
         $Manager->pluginTest = $plugin;
         $Reporter =& new JunitReporter(null, array('app' => $Manager->appTest, 'plugin' => $Manager->pluginTest, 'group' => $this->type === 'group', 'codeCoverage' => false, 'coverage' => $this->_coverage));
         $this->hr();
         $plugin = Inflector::underscore($plugin);
         $this->out(sprintf(__('Running %s all', true), $plugin));
         $result = $result && $Manager->runAllTests($Reporter);
     }
     $this->_stopCoverage();
     return $result;
 }
Beispiel #3
0
}
function CakePHPTestSuiteFooter()
{
    switch (CAKE_TEST_OUTPUT) {
        case CAKE_TEST_OUTPUT_HTML:
            $baseUrl = BASE;
            include CAKE . 'tests' . DS . 'lib' . DS . 'footer.php';
            break;
    }
}
CakePHPTestHeader();
CakePHPTestSuiteHeader();
define('RUN_TEST_LINK', $_SERVER['PHP_SELF']);
if (isset($_GET['group'])) {
    if ('all' == $_GET['group']) {
        TestManager::runAllTests(CakeTestsGetReporter());
    } else {
        if (isset($_GET['app'])) {
            TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, CakeTestsGetReporter());
        } else {
            TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, CakeTestsGetReporter());
        }
    }
    CakePHPTestRunMore();
    CakePHPTestSuiteFooter();
    exit;
}
if (isset($_GET['case'])) {
    TestManager::runTestCase($_GET['case'], CakeTestsGetReporter());
    CakePHPTestRunMore();
    CakePHPTestSuiteFooter();
Beispiel #4
0
* Copyright 2004 BIT, Ltd. http://www.0x00.ru, mailto: bit@0x00.ru
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/
ob_start();
require_once LIMB_DIR . '/tests/lib/test_utils.php';
require_once LIMB_DIR . '/tests/lib/test_manager.php';
if (!(include_once SIMPLE_TEST . 'reporter.php')) {
    error('runtime', 'LIBRARY_REQUIRED', array('library' => 'Simple Test', 'path' => SIMPLE_TEST));
}
if (isset($_GET['all'])) {
    TestManager::runAllTests($_GET['all'], new HTMLReporter());
    echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Run more tests</a></p>";
    echo debug::parse_html_console();
    ob_end_flush();
    exit(0);
}
if (isset($_GET['group'])) {
    TestManager::runGroupTest(ucfirst($_GET['group']), $_GET['group'], new HTMLReporter());
    echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Run more tests</a></p>";
    echo debug::parse_html_console();
    ob_end_flush();
    exit(0);
}
if (isset($_GET['case'])) {
    TestManager::runTestCase($_GET['case'], new HTMLReporter());
    echo "<p><a href='" . $_SERVER['PHP_SELF'] . "?show=cases'>Run more tests</a></p>";
Beispiel #5
0
 /**
  * Executes the tests depending on $testToRun
  */
 function _runTest()
 {
     // Need to set some get variables as TestManager depends on them
     if (in_array($this->testToRun['section'], $this->plugins)) {
         $_GET['plugin'] = $this->testToRun['section'];
     } elseif (in_array(Inflector::Humanize($this->testToRun['section']), $this->plugins)) {
         $_GET['plugin'] = Inflector::Humanize($this->testToRun['section']);
     } elseif ($this->testToRun['section'] == 'app') {
         $_GET['app'] = true;
     }
     if ($this->testToRun['area'] == 'all') {
         TestManager::runAllTests(new TextReporter());
         return;
     } elseif ($this->testToRun['area'] == 'group') {
         $_GET['group'] == $this->testToRun['file'];
         if (isset($_GET['app'])) {
             TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, new TextReporter());
         } elseif (isset($_GET['plugin'])) {
             TestManager::runGroupTest(ucfirst($_GET['group']), APP . 'plugins' . DS . $_GET['plugin'] . DS . 'tests' . DS . 'groups', new TextReporter());
         } else {
             TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, new TextReporter());
         }
         return;
     } else {
         $_GET['case'] = 'cases' . DS . $this->testToRun['type'] . DS . $this->testToRun['file'] . '.test.php';
         TestManager::runTestCase($_GET['case'], new TextReporter());
         return;
     }
 }
Beispiel #6
0
 /**
  * Executes the tests depending on our settings
  *
  * @return void
  * @access private
  */
 function __run()
 {
     $reporter = new CLIReporter();
     $this->__setGetVars();
     if ($this->type == 'all') {
         return TestManager::runAllTests($reporter);
     }
     if ($this->doCoverage) {
         if (!extension_loaded('xdebug')) {
             $this->out('You must install Xdebug to use the CakePHP(tm) Code Coverage Analyzation. Download it from http://www.xdebug.org/docs/install');
             exit(0);
         }
     }
     if ($this->type == 'group') {
         $ucFirstGroup = ucfirst($this->file);
         $path = CORE_TEST_GROUPS;
         if ($this->category == 'app') {
             $path = APP_TEST_GROUPS;
         } elseif ($this->isPluginTest) {
             $path = APP . 'plugins' . DS . $this->category . DS . 'tests' . DS . 'groups';
         }
         if ($this->doCoverage) {
             require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
             CodeCoverageManager::start($ucFirstGroup, $reporter);
         }
         $result = TestManager::runGroupTest($ucFirstGroup, $reporter);
         if ($this->doCoverage) {
             CodeCoverageManager::report();
         }
         return $result;
     }
     $case = 'libs' . DS . $this->file . '.test.php';
     if ($this->category == 'app') {
         $case = $this->file . '.test.php';
     } elseif ($this->isPluginTest) {
         $case = $this->file . '.test.php';
     }
     if ($this->doCoverage) {
         require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
         CodeCoverageManager::start($case, $reporter);
     }
     $result = TestManager::runTestCase($case, $reporter);
     if ($this->doCoverage) {
         CodeCoverageManager::report();
     }
     return $result;
 }
Beispiel #7
0
                }
                break;
        }
    }
}
if (!@(include_once SIMPLE_TEST . 'runner.php')) {
    error('runtime', 'LIBRARY_REQUIRED', array('library' => 'Simple Test', 'path' => SIMPLE_TEST));
}
require_once LIMB_DIR . '/tests/lib/cli_reporter.php';
/* list grouptests */
if ($opt_list) {
    echo CLITestManager::getGroupTestList(TEST_GROUPS_DIR);
    echo CLITestManager::getTestCaseList(TEST_CASES_DIR);
    exit(0);
}
/* run a test case */
if ($opt_casefile) {
    TestManager::runTestCase($opt_casefile, new CLIReporter($opt_separator));
    echo debug::parse_cli_console();
    exit(0);
}
/* run a grouptest */
if ($opt_groupfile) {
    TestManager::runGroupTest($opt_groupfile, TEST_GROUPS_DIR, new CLIReporter($opt_separator));
    echo debug::parse_cli_console();
    exit(0);
}
/* run all tests */
TestManager::runAllTests(new CLIReporter($opt_separator));
echo debug::parse_cli_console();
exit(0);
Beispiel #8
0
            break;
        case DW_TESTS_OUTPUT_HTML:
        default:
            $footer = <<<EOD
  </body>
</html>
EOD;
            echo $footer;
            break;
    }
}
/** OUTPUT STARTS HERE **/
// If it's a group test
if (isset($_GET['group'])) {
    if ('all' == $_GET['group']) {
        TestManager::runAllTests(DW_TESTS_GetReporter());
    } else {
        TestManager::runGroupTest(ucfirst($_GET['group']), TEST_GROUPS, DW_TESTS_GetReporter());
    }
    DW_TESTS_PaintRunMore();
    exit;
}
// If it's a single test case
if (isset($_GET['case'])) {
    TestManager::runTestCase($_GET['case'], TEST_CASES, DW_TESTS_GetReporter());
    DW_TESTS_PaintRunMore();
    exit;
}
// Else it's the main page
DW_TESTS_PaintHeader();
DW_TESTS_PaintSuiteHeader();
Beispiel #9
0
 public function runAllTests(&$reporter)
 {
     $this->_uninstalldb4test($this->database['host'], $this->database['port'], $this->database['login'], $this->database['pwd'], $this->database['name'], $this->database['type']);
     $this->_installdb4test($this->database['host'], $this->database['port'], $this->database['login'], $this->database['pwd'], $this->database['name'], $this->database['type']);
     parent::runAllTests($reporter);
 }