Turns partial paths used on the testsuite console and web UI into full file paths.
Inheritance: extends CakeTestLoader
Ejemplo n.º 1
0
 /**
  * Generate a test case list in plain text.
  * Creates as series of url's for tests that can be run.
  * One case per line.
  *
  * @return void
  */
 public function testCaseList()
 {
     // CUSTOMIZE MODIFY 2014/07/02 ryuring
     // >>>
     //$testCases = parent::testCaseList();
     // ---
     $testCases = BaserTestLoader::generateTestList($this->params);
     $baser = $this->params['baser'];
     // <<<
     $app = $this->params['app'];
     $plugin = $this->params['plugin'];
     $buffer = "Core Test Cases:\n";
     // CUSTOMIZE MODIFY 2014/07/02 ryuring
     // >>>
     //if ($app) {
     // ---
     if ($baser) {
         $buffer = "Baser Test Cases:\n";
         $urlExtra = '&baser=true';
     } elseif ($app) {
         // <<<
         $buffer = "App Test Cases:\n";
     } elseif ($plugin) {
         $buffer = Inflector::humanize($plugin) . " Test Cases:\n";
     }
     if (count($testCases) < 1) {
         $buffer .= 'EMPTY';
         echo $buffer;
     }
     foreach ($testCases as $testCase) {
         $buffer .= $_SERVER['SERVER_NAME'] . $this->baseUrl() . "?case=" . $testCase . "&output=text\n";
     }
     $buffer .= "\n";
     echo $buffer;
 }
Ejemplo n.º 2
0
 /**
  * Retrieves and paints the list of tests cases in an HTML format.
  *
  * @return void
  */
 public function testCaseList()
 {
     // CUSTOMIZE MODIFY 2014/07/02
     // >>>
     //$testCases = parent::testCaseList();
     // ---
     $testCases = BaserTestLoader::generateTestList($this->params);
     $baser = $this->params['baser'];
     // <<<
     $core = $this->params['core'];
     $plugin = $this->params['plugin'];
     $buffer = "<h3>App Test Cases:</h3>\n<ul>";
     $urlExtra = null;
     if ($core) {
         $buffer = "<h3>Core Test Cases:</h3>\n<ul>";
         $urlExtra = '&core=true';
         // CUSTOMIZE ADD 2014/07/02 ryuring
         // >>>
     } elseif ($baser) {
         $buffer = "<h3>Baser Test Cases:</h3>\n<ul>";
         $urlExtra = '&baser=true';
         // <<<
     } elseif ($plugin) {
         $buffer = "<h3>" . Inflector::humanize($plugin) . " Test Cases:</h3>\n<ul>";
         $urlExtra = '&plugin=' . $plugin;
     }
     if (count($testCases) < 1) {
         $buffer .= "<strong>EMPTY</strong>";
     }
     foreach ($testCases as $testCase) {
         $title = explode(DS, str_replace('.test.php', '', $testCase));
         $title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
         $title = implode(' / ', $title);
         $buffer .= "<li><a href='" . $this->baseUrl() . "?case=" . urlencode($testCase) . $urlExtra . "'>" . $title . "</a></li>\n";
     }
     $buffer .= "</ul>\n";
     echo $buffer;
 }
Ejemplo n.º 3
0
 /**
  * Shows a list of available test cases and gives the option to run one of them
  *
  * @return void
  */
 public function available()
 {
     $params = $this->_parseArgs();
     $testCases = BaserTestLoader::generateTestList($params);
     $baser = $params['baser'];
     $app = $params['app'];
     $plugin = $params['plugin'];
     $title = "Core Test Cases:";
     $category = 'core';
     if ($baser) {
         $title = "Baser Test Cases:";
         $category = 'baser';
     } elseif ($app) {
         $title = "App Test Cases:";
         $category = 'app';
     } elseif ($plugin) {
         $title = Inflector::humanize($plugin) . " Test Cases:";
         $category = $plugin;
     }
     if (empty($testCases)) {
         $this->out(__d('cake_console', "No test cases available \n\n"));
         return $this->out($this->OptionParser->help());
     }
     $this->out($title);
     $i = 1;
     $cases = array();
     foreach ($testCases as $testCaseFile => $testCase) {
         $case = str_replace('Test.php', '', $testCase);
         $this->out("[{$i}] {$case}");
         $cases[$i] = $case;
         $i++;
     }
     while ($choice = $this->in(__d('cake_console', 'What test case would you like to run?'), null, 'q')) {
         if (is_numeric($choice) && isset($cases[$choice])) {
             $this->args[0] = $category;
             $this->args[1] = $cases[$choice];
             $this->_run($this->_parseArgs(), $this->_runnerOptions());
             break;
         }
         if (is_string($choice) && in_array($choice, $cases)) {
             $this->args[0] = $category;
             $this->args[1] = $choice;
             $this->_run($this->_parseArgs(), $this->_runnerOptions());
             break;
         }
         if ($choice == 'q') {
             break;
         }
     }
 }