当前位置: 首页>>代码示例>>PHP>>正文


PHP CodeCoverageManager::init方法代码示例

本文整理汇总了PHP中CodeCoverageManager::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CodeCoverageManager::init方法的具体用法?PHP CodeCoverageManager::init怎么用?PHP CodeCoverageManager::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeCoverageManager的用法示例。


在下文中一共展示了CodeCoverageManager::init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __run

 /**
  * Executes the tests depending on our settings
  *
  * @return void
  * @access private
  */
 public function __run()
 {
     $Reporter = new CakeXmlReporter('utf-8', array('app' => $this->Manager->appTest, 'plugin' => $this->Manager->pluginTest, 'group' => $this->type === 'group', 'codeCoverage' => $this->doCoverage));
     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', true));
             $this->_stop(0);
         }
     }
     ob_start();
     try {
         if ($this->type == 'all') {
             $result = $this->Manager->runAllTests($Reporter);
         } else {
             if ($this->type == 'group') {
                 $ucFirstGroup = ucfirst($this->file);
                 if ($this->doCoverage) {
                     require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
                     CodeCoverageManager::init($ucFirstGroup, $Reporter);
                     CodeCoverageManager::start();
                 }
                 $result = $this->Manager->runGroupTest($ucFirstGroup, $Reporter);
             } else {
                 $folder = $folder = $this->__findFolderByCategory($this->category);
                 $case = $this->__getFileName($folder, $this->isPluginTest);
                 if ($this->doCoverage) {
                     require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
                     CodeCoverageManager::init($case, $Reporter);
                     CodeCoverageManager::start();
                 }
                 $result = $this->Manager->runTestCase($case, $Reporter);
             }
         }
     } catch (Exception $e) {
         ob_get_clean();
         $this->out('Tests failed to run. ' . $e->getMessage());
         $this->_stop(1);
     }
     $xml = ob_get_clean();
     $xmlD = new DOMDocument();
     $xmlD->loadXML($xml);
     $xslt = new XSLTProcessor();
     $XSL = new DOMDocument();
     $XSL->load(dirname(__FILE__) . DS . 'xsl' . DS . 'to-junit.xsl');
     $xslt->importStylesheet($XSL);
     $out = $xslt->transformToXML($xmlD);
     $time = time();
     file_put_contents(ROOT . DS . "build" . DS . "logs" . DS . "junit-{$time}.xml", $out);
     echo "Done.\n";
 }
开发者ID:eecian,项目名称:Team08-iPeer,代码行数:56,代码来源:testreport.php

示例2: _runTestCase

 /**
  * Runs a test case file.
  *
  * @return void
  */
 function _runTestCase()
 {
     $Reporter =& CakeTestSuiteDispatcher::getReporter();
     if ($this->params['codeCoverage']) {
         CodeCoverageManager::init($this->params['case'], $Reporter);
     }
     $this->Manager->runTestCase($this->params['case'], $Reporter);
 }
开发者ID:sathishkumarb,项目名称:HVMS,代码行数:13,代码来源:cake_test_suite_dispatcher.php

示例3: __run

 /**
  * Executes the tests depending on our settings
  *
  * @return void
  * @access private
  */
 function __run()
 {
     $Reporter = new CakeCliReporter('utf-8', array('app' => $this->Manager->appTest, 'plugin' => $this->Manager->pluginTest, 'group' => $this->type === 'group', 'codeCoverage' => $this->doCoverage));
     if ($this->type == 'all') {
         return $this->Manager->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', true));
             $this->_stop(0);
         }
     }
     if ($this->type == 'group') {
         $ucFirstGroup = ucfirst($this->file);
         if ($this->doCoverage) {
             require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
             CodeCoverageManager::init($ucFirstGroup, $Reporter);
             CodeCoverageManager::start();
         }
         $result = $this->Manager->runGroupTest($ucFirstGroup, $Reporter);
         return $result;
     }
     $folder = $folder = $this->__findFolderByCategory($this->category);
     $case = $this->__getFileName($folder, $this->isPluginTest);
     if ($this->doCoverage) {
         require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
         CodeCoverageManager::init($case, $Reporter);
         CodeCoverageManager::start();
     }
     $result = $this->Manager->runTestCase($case, $Reporter);
     return $result;
 }
开发者ID:asairoha,项目名称:pj01,代码行数:38,代码来源:testsuite.php

示例4: testNoTestCaseSuppliedNoErrors

 /**
  * Test that test cases don't cause errors
  *
  * @return void
  */
 function testNoTestCaseSuppliedNoErrors()
 {
     if ($this->skipIf(PHP_SAPI == 'cli', 'Is cli, cannot run this test %s')) {
         return;
     }
     $reporter =& new CakeHtmlReporter(null, array('group' => false, 'app' => false, 'plugin' => false));
     $path = LIBS;
     if (strpos(LIBS, ROOT) === false) {
         $path = ROOT . DS . LIBS;
     }
     App::import('Core', 'Folder');
     $folder = new Folder();
     $folder->cd($path);
     $contents = $folder->read();
     $contents[1] = array_filter($contents[1], array(&$this, '_basenameFilter'));
     foreach ($contents[1] as $file) {
         CodeCoverageManager::init('libs' . DS . $file, $reporter);
         CodeCoverageManager::report(false);
         $this->assertNoErrors('libs' . DS . $file);
     }
 }
开发者ID:andrelotto,项目名称:Coordino,代码行数:26,代码来源:code_coverage_manager.test.php


注:本文中的CodeCoverageManager::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。