/**
  * Gets us the base path to look for the test files
  *
  * @param string $isApp
  * @return void
  * @access public
  */
 function __getTestFilesPath($isApp = true)
 {
     $manager = CodeCoverageManager::getInstance();
     $path = ROOT . DS;
     if ($isApp) {
         $path .= APP_DIR . DS;
     } elseif (!!$manager->pluginTest) {
         $pluginPath = APP . 'plugins' . DS . $manager->pluginTest . DS;
         $pluginPaths = Configure::read('pluginPaths');
         foreach ($pluginPaths as $tmpPath) {
             $tmpPath = $tmpPath . $manager->pluginTest . DS;
             if (file_exists($tmpPath)) {
                 $pluginPath = $tmpPath;
                 break;
             }
         }
         $path = $pluginPath;
     } else {
         $path = TEST_CAKE_CORE_INCLUDE_PATH;
     }
     return $path;
 }
 /**
  * testCalculateCodeCoverage method
  *
  * @access public
  * @return void
  */
 function testCalculateCodeCoverage()
 {
     $manager =& CodeCoverageManager::getInstance();
     $data = array('25' => array(100, 25), '50' => array(100, 50), '0' => array(0, 0), '0' => array(100, 0), '100' => array(100, 100));
     foreach ($data as $coverage => $lines) {
         $this->assertEqual($coverage, $manager->__calcCoverage($lines[0], $lines[1]));
     }
     $manager->__calcCoverage(100, 1000);
     $this->assertError();
 }
Esempio n. 3
0
 /**
  * Gets us the base path to look for the test files
  *
  * @param string $isApp
  * @return void
  * @access public
  */
 function __getTestFilesPath($isApp = true)
 {
     $manager = CodeCoverageManager::getInstance();
     $path = ROOT . DS;
     if ($isApp) {
         $path .= APP_DIR . DS;
     } elseif (!!$manager->pluginTest) {
         $path .= APP_DIR . DS . 'plugins' . DS . $manager->pluginTest . DS;
     } else {
         $path = TEST_CAKE_CORE_INCLUDE_PATH;
     }
     return $path;
 }