예제 #1
0
 public function handleEvent($event, observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         if ($observable->codeCoverageIsEnabled() === true) {
             $this->coverage = $observable->getScore()->getCoverage();
             if ($this->adapter->extension_loaded('xdebug') === true) {
                 $phpCode = '<?php ' . 'ob_start();' . 'require \'' . \mageekguy\atoum\directory . '/classes/autoloader.php\';';
                 $bootstrapFile = $observable->getBootstrapFile();
                 if ($bootstrapFile !== null) {
                     $phpCode .= '$includer = new mageekguy\\atoum\\includer();' . 'try { $includer->includePath(\'' . $bootstrapFile . '\'); }' . 'catch (mageekguy\\atoum\\includer\\exception $exception)' . '{ die(\'Unable to include bootstrap file \\\'' . $bootstrapFile . '\\\'\'); }';
                 }
                 $phpCode .= '$data = array(\'classes\' => get_declared_classes());' . 'ob_start();' . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . 'require_once \'%s\';' . '$data[\'coverage\'] = xdebug_get_code_coverage();' . 'xdebug_stop_code_coverage();' . 'ob_end_clean();' . '$data[\'classes\'] = array_diff(get_declared_classes(), $data[\'classes\']);' . 'echo serialize($data);';
                 foreach ($this->getSrcDirectoryIterators() as $srcDirectoryIterator) {
                     foreach ($srcDirectoryIterator as $file) {
                         if (in_array($file->getPathname(), $this->adapter->get_included_files()) === false) {
                             if ($this->php->reset()->run(sprintf($phpCode, $file->getPathname()))->getExitCode() > 0) {
                                 throw new runtime('Unable to get default code coverage for file \'' . $file->getPathname() . '\': ' . $this->php->getStderr());
                             }
                             $data = unserialize($this->php->getStdOut());
                             foreach ($data['classes'] as $class) {
                                 $this->coverage->addXdebugDataForClass($class, $data['coverage']);
                             }
                         }
                     }
                 }
             }
             return true;
         }
     }
 }
예제 #2
0
파일: result.php 프로젝트: xihewang/atoum
 public function handleEvent($event, observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $score = $observable->getScore();
         $this->testNumber = $observable->getTestNumber();
         $this->testMethodNumber = $observable->getTestMethodNumber();
         $this->assertionNumber = $score->getAssertionNumber();
         $this->failNumber = $score->getFailNumber();
         $this->errorNumber = $score->getErrorNumber();
         $this->exceptionNumber = $score->getExceptionNumber();
         $this->voidMethodNumber = $score->getVoidMethodNumber();
         $this->uncompletedMethodNumber = $score->getUncompletedMethodNumber();
         $this->skippedMethodNumber = $score->getSkippedMethodNumber();
         $this->success = $this->failNumber === 0 && $this->errorNumber === 0 && $this->exceptionNumber === 0 && $this->uncompletedMethodNumber === 0;
         if ($observable->shouldFailIfVoidMethods() && $this->voidMethodNumber > 0) {
             $this->success = false;
         }
         if ($observable->shouldFailIfSkippedMethods() && $this->skippedMethodNumber > 0) {
             $this->success = false;
         }
         return true;
     }
 }
예제 #3
0
파일: plan.php 프로젝트: xihewang/atoum
 public function handleEvent($event, \mageekguy\atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->testMethodNumber = $observable->getTestMethodNumber();
         return true;
     }
 }
예제 #4
0
파일: skipped.php 프로젝트: xihewang/atoum
 public function handleEvent($event, observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->runner = $observable;
         return true;
     }
 }
예제 #5
0
파일: duration.php 프로젝트: xihewang/atoum
 public function handleEvent($event, observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->value = $observable->getScore()->getTotalDuration();
         return true;
     }
 }
예제 #6
0
파일: path.php 프로젝트: xihewang/atoum
 public function handleEvent($event, atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->path = $observable->getScore()->getAtoumPath() . DIRECTORY_SEPARATOR . $_SERVER['argv'][0];
         return true;
     }
 }
예제 #7
0
파일: version.php 프로젝트: xihewang/atoum
 public function handleEvent($event, atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->version = $observable->getScore()->getPhpVersion();
         return true;
     }
 }
예제 #8
0
 public function handleEvent($event, \mageekguy\atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->coverage = $observable->getScore()->getCoverage();
         return true;
     }
 }
예제 #9
0
파일: run.php 프로젝트: xihewang/atoum
 public function handleEvent($event, atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->testClass = $observable->getClass();
         return true;
     }
 }
예제 #10
0
파일: memory.php 프로젝트: xihewang/atoum
 public function handleEvent($event, atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->value = $observable->getScore()->getTotalMemoryUsage();
         $this->testNumber = $observable->getTestNumber();
         return true;
     }
 }
예제 #11
0
파일: atoum.php 프로젝트: xihewang/atoum
 public function handleEvent($event, \mageekguy\atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         return false;
     } else {
         $this->author = \mageekguy\atoum\author;
         $this->path = $observable->getScore()->getAtoumPath();
         $this->version = $observable->getScore()->getAtoumVersion();
         return true;
     }
 }
예제 #12
0
파일: event.php 프로젝트: xihewang/atoum
 public function handleEvent($event, atoum\observable $observable)
 {
     if (parent::handleEvent($event, $observable) === false) {
         $this->observable = null;
         $this->event = null;
         return false;
     } else {
         $this->observable = $observable;
         $this->event = $event;
         return true;
     }
 }