コード例 #1
0
 function all()
 {
     $conf = jApp::config();
     if (!isset($conf->enableTests) || !$conf->enableTests) {
         // security
         $rep = $this->getResponse('html', true);
         $rep->title = 'Error';
         $rep->setHttpStatus('404', 'Not found');
         $rep->addContent('<p>404 Not Found</p>');
         return $rep;
     }
     $rep = $this->_prepareResponse();
     jClasses::inc("junittests~jhtmlrespreporter");
     jClasses::inc('junittests~junittestcase');
     jClasses::inc('junittests~junittestcasedb');
     $category = $this->category ? ' (' . $this->category . ')' : '';
     if (count($this->testsList)) {
         foreach ($this->testsList as $module => $tests) {
             $reporter = new jhtmlrespreporter();
             $reporter->setResponse($rep);
             jApp::pushCurrentModule($module);
             $group = new TestSuite('Tests' . $category . ' on module ' . $module);
             foreach ($this->testsList[$module] as $test) {
                 $group->addFile($conf->_modulesPathList[$module] . 'tests/' . $test[0]);
             }
             $group->run($reporter);
             jApp::popCurrentModule();
         }
     } else {
         $rep->body->assign('MAIN', '<p>no' . $category . ' tests available.</p>');
     }
     return $this->_finishResponse($rep);
 }
コード例 #2
0
 function all()
 {
     if (!isset($GLOBALS['gJConfig']->enableTests) || !$GLOBALS['gJConfig']->enableTests) {
         // security
         $rep = $this->getResponse('html', true);
         $rep->title = 'Error';
         $rep->setHttpStatus('404', 'Not found');
         $rep->addContent('<p>404 Not Found</p>');
         return $rep;
     }
     $rep = $this->_prepareResponse();
     jClasses::inc("junittests~jhtmlrespreporter");
     jClasses::inc('junittests~junittestcase');
     jClasses::inc('junittests~junittestcasedb');
     foreach ($this->testsList as $module => $tests) {
         $reporter = new jhtmlrespreporter();
         $reporter->setResponse($rep);
         jContext::push($module);
         $group = new GroupTest('Tests on module ' . $module);
         foreach ($this->testsList[$module] as $test) {
             $group->addTestFile($GLOBALS['gJConfig']->_modulesPathList[$module] . 'tests/' . $test[0]);
         }
         $group->run($reporter);
         jContext::pop();
     }
     return $this->_finishResponse($rep);
 }