getCurrentMethod() public method

public getCurrentMethod ( )
コード例 #1
0
ファイル: inline.php プロジェクト: ronan-gloo/atoum
 public function run(atoum\test $test)
 {
     $currentTestMethod = $test->getCurrentMethod();
     if ($currentTestMethod !== null) {
         $testScore = $test->getScore();
         $test->setScore($this->score->reset())->runTestMethod($test->getCurrentMethod())->setScore($testScore);
     }
     return $this;
 }
コード例 #2
0
ファイル: concurrent.php プロジェクト: xihewang/atoum
 public function run(atoum\test $test)
 {
     $currentTestMethod = $test->getCurrentMethod();
     if ($currentTestMethod !== null) {
         $this->test = $test;
         $this->method = $currentTestMethod;
         $phpPath = $this->test->getPhpPath();
         $phpCode = '<?php ' . 'ob_start();' . 'require \'' . atoum\directory . '/classes/autoloader.php\';';
         $bootstrapFile = $this->test->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 .= 'require \'' . $this->test->getPath() . '\';' . '$test = new ' . $this->test->getClass() . '();' . '$test->setLocale(new ' . get_class($this->test->getLocale()) . '(' . $this->test->getLocale()->get() . '));' . '$test->setPhpPath(\'' . $phpPath . '\');';
         if ($this->test->debugModeIsEnabled() === true) {
             $phpCode .= '$test->enableDebugMode();';
         }
         if ($this->test->codeCoverageIsEnabled() === false) {
             $phpCode .= '$test->disableCodeCoverage();';
         } else {
             if ($this->test->branchesAndPathsCoverageIsEnabled() === true) {
                 $phpCode .= '$test->enableBranchesAndPathsCoverage();';
             }
             $phpCode .= '$coverage = $test->getCoverage();';
             foreach ($this->test->getCoverage()->getExcludedMethods() as $excludedMethod) {
                 $phpCode .= '$coverage->excludeMethod(\'' . $excludedMethod . '\');';
             }
             foreach ($this->test->getCoverage()->getExcludedClasses() as $excludedClass) {
                 $phpCode .= '$coverage->excludeClass(\'' . $excludedClass . '\');';
             }
             foreach ($this->test->getCoverage()->getExcludedNamespaces() as $excludedNamespace) {
                 $phpCode .= '$coverage->excludeNamespace(\'' . $excludedNamespace . '\');';
             }
             foreach ($this->test->getCoverage()->getExcludedDirectories() as $excludedDirectory) {
                 $phpCode .= '$coverage->excludeDirectory(\'' . $excludedDirectory . '\');';
             }
         }
         if ($this->test->getMockGenerator()->undefinedMethodUsageIsAllowed() === false) {
             $phpCode .= '$test->getMockGenerator()->disallowUndefinedMethodUsage();';
         }
         foreach ($test->getExtensions() as $extension) {
             $phpCode .= '$test->addExtension(new ' . get_class($extension) . ');';
         }
         $phpCode .= 'ob_end_clean();' . 'mageekguy\\atoum\\scripts\\runner::disableAutorun();' . 'echo serialize($test->runTestMethod(\'' . $this->method . '\')->getScore());';
         $xdebugConfig = $test->getXdebugConfig();
         if ($xdebugConfig !== null) {
             if (getenv('XDEBUG_CONFIG') !== false || ini_get('xdebug.remote_autostart') != 0) {
                 throw new exceptions\runtime('XDEBUG_CONFIG variable must not be set or value of xdebug.remote_autostart must be 0 to use xdebug with concurrent engine');
             }
             $this->php->XDEBUG_CONFIG = $xdebugConfig;
         }
         $this->php->reset()->setBinaryPath($phpPath)->run($phpCode);
     }
     return $this;
 }
コード例 #3
0
ファイル: concurrent.php プロジェクト: ronan-gloo/atoum
 public function run(atoum\test $test)
 {
     $currentTestMethod = $test->getCurrentMethod();
     if ($currentTestMethod !== null) {
         $this->test = $test;
         $this->method = $currentTestMethod;
         $this->stdOut = '';
         $this->stdErr = '';
         $phpPath = $this->test->getPhpPath();
         $this->php = @call_user_func_array(array($this->adapter, 'proc_open'), array(escapeshellarg($phpPath), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), &$this->pipes));
         if ($this->php === false) {
             throw new exceptions\runtime('Unable to use \'' . $phpPath . '\'');
         }
         $phpCode = '<?php ' . 'ob_start();' . 'require \'' . atoum\directory . '/classes/autoloader.php\';';
         $bootstrapFile = $this->test->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 .= 'require \'' . $this->test->getPath() . '\';' . '$test = new ' . $this->test->getClass() . '();' . '$test->setLocale(new ' . get_class($this->test->getLocale()) . '(' . $this->test->getLocale()->get() . '));' . '$test->setPhpPath(\'' . $phpPath . '\');';
         if ($this->test->debugModeIsEnabled() === true) {
             $phpCode .= '$test->enableDebugMode();';
         }
         if ($this->test->codeCoverageIsEnabled() === false) {
             $phpCode .= '$test->disableCodeCoverage();';
         } else {
             $phpCode .= '$coverage = $test->getCoverage();';
             foreach ($this->test->getCoverage()->getExcludedClasses() as $excludedClass) {
                 $phpCode .= '$coverage->excludeClass(\'' . $excludedClass . '\');';
             }
             foreach ($this->test->getCoverage()->getExcludedNamespaces() as $excludedNamespace) {
                 $phpCode .= '$coverage->excludeNamespace(\'' . $excludedNamespace . '\');';
             }
             foreach ($this->test->getCoverage()->getExcludedDirectories() as $excludedDirectory) {
                 $phpCode .= '$coverage->excludeDirectory(\'' . $excludedDirectory . '\');';
             }
         }
         $phpCode .= 'ob_end_clean();' . 'mageekguy\\atoum\\scripts\\runner::disableAutorun();' . 'echo serialize($test->runTestMethod(\'' . $this->method . '\')->getScore());';
         $this->adapter->fwrite($this->pipes[0], $phpCode);
         $this->adapter->fclose($this->pipes[0]);
         unset($this->pipes[0]);
         $this->adapter->stream_set_blocking($this->pipes[1], 0);
         $this->adapter->stream_set_blocking($this->pipes[2], 0);
     }
     return $this;
 }