Exemplo n.º 1
0
 /**
  * Starts gathering the information for code coverage.
  * @param  string
  * @return void
  */
 public static function start($file)
 {
     if (self::$file) {
         throw new \LogicException('Code coverage collector has been already started.');
     }
     self::$file = fopen($file, 'a+');
     if (defined('PHPDBG_VERSION') && PHP_VERSION_ID >= 70000) {
         phpdbg_start_oplog();
         $collector = 'collectPhpDbg';
     } elseif (extension_loaded('xdebug')) {
         xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
         $collector = 'collectXdebug';
     } else {
         $alternative = PHP_VERSION_ID >= 70000 ? ' or phpdbg SAPI' : '';
         throw new \Exception("Code coverage functionality requires Xdebug extension{$alternative}.");
     }
     register_shutdown_function(function () use($collector) {
         register_shutdown_function(function () use($collector) {
             list($positive, $negative) = call_user_func(array(__CLASS__, $collector));
             self::save($positive, $negative);
         });
     });
 }
 /**
  * Start collection of code coverage information.
  */
 public function start()
 {
     phpdbg_start_oplog();
 }
Exemplo n.º 3
0
 public function startCodeCoverage()
 {
     phpdbg_start_oplog();
 }
Exemplo n.º 4
0
 /**
  * Collects information about code coverage.
  * @return array
  */
 private static function collectPhpDbg()
 {
     $positive = phpdbg_end_oplog();
     $negative = phpdbg_get_executable();
     foreach ($positive as $file => &$lines) {
         $lines = array_fill_keys(array_keys($lines), 1);
     }
     foreach ($negative as $file => &$lines) {
         $lines = array_fill_keys(array_keys($lines), -1);
     }
     phpdbg_start_oplog();
     return [$positive, $negative];
 }
Exemplo n.º 5
0
 /**
  * Start collection of code coverage information.
  *
  * @param bool $determineUnusedAndDead
  */
 public function start($determineUnusedAndDead = true)
 {
     phpdbg_start_oplog();
 }