convertErrorsToExceptions() публичный Метод

Enables or disables the error-to-exception conversion.
public convertErrorsToExceptions ( boolean $flag )
$flag boolean
Пример #1
0
 public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = array())
 {
     unset($GLOBALS['app']);
     // hook for not to serialize globals
     $arguments = array_merge($this->defaultArguments, $arguments);
     $this->handleConfiguration($arguments);
     $result->convertErrorsToExceptions(false);
     if ($arguments['report']) {
         $this->printer = new Report();
     }
     if (empty(self::$persistentListeners)) {
         $this->applyReporters($result, $arguments);
     }
     $arguments['listeners'][] = $this->printer;
     // clean up listeners between suites
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     foreach ($arguments['listeners'] as $listener) {
         $result->removeListener($listener);
     }
     return $result;
 }
Пример #2
0
 public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = [])
 {
     unset($GLOBALS['app']);
     // hook for not to serialize globals
     $this->handleConfiguration($arguments);
     $result->convertErrorsToExceptions(false);
     if (empty(self::$persistentListeners)) {
         $this->applyReporters($result, $arguments);
     }
     $arguments['listeners'][] = $this->printer;
     // clean up listeners between suites
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     $filterFactory = new \PHPUnit_Runner_Filter_Factory();
     if ($arguments['groups']) {
         $filterFactory->addFilter(new \ReflectionClass('PHPUnit_Runner_Filter_Group_Include'), $arguments['groups']);
     }
     if ($arguments['excludeGroups']) {
         $filterFactory->addFilter(new \ReflectionClass('PHPUnit_Runner_Filter_Group_Exclude'), $arguments['excludeGroups']);
     }
     if ($arguments['filter']) {
         $filterFactory->addFilter(new \ReflectionClass('PHPUnit_Runner_Filter_Test'), $arguments['filter']);
     }
     $suite->injectFilter($filterFactory);
     $suite->run($result);
     unset($suite);
     foreach ($arguments['listeners'] as $listener) {
         $result->removeListener($listener);
     }
     return $result;
 }
Пример #3
0
 public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = array())
 {
     $this->handleConfiguration($arguments);
     if (is_integer($arguments['repeat'])) {
         $suite = new \PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     }
     if (!$arguments['convertErrorsToExceptions']) {
         $result->convertErrorsToExceptions(FALSE);
     }
     if (!$arguments['convertNoticesToExceptions']) {
         \PHPUnit_Framework_Error_Notice::$enabled = FALSE;
     }
     if (!$arguments['convertWarningsToExceptions']) {
         \PHPUnit_Framework_Error_Warning::$enabled = FALSE;
     }
     if ($arguments['stopOnError']) {
         $result->stopOnError(TRUE);
     }
     if ($arguments['stopOnFailure']) {
         $result->stopOnFailure(TRUE);
     }
     if ($arguments['stopOnIncomplete']) {
         $result->stopOnIncomplete(TRUE);
     }
     if ($arguments['stopOnSkipped']) {
         $result->stopOnSkipped(TRUE);
     }
     if ($this->printer === NULL) {
         if (isset($arguments['printer']) && $arguments['printer'] instanceof \PHPUnit_Util_Printer) {
             $this->printer = $arguments['printer'];
         } else {
             $this->printer = new \Codeception\PHPUnit\ResultPrinter\UI(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
         }
     }
     if (isset($arguments['report'])) {
         if ($arguments['report']) {
             $this->printer = new \Codeception\PHPUnit\ResultPrinter\Report();
         }
     }
     if (isset($arguments['html'])) {
         if ($arguments['html']) {
             $arguments['listeners'][] = new \Codeception\PHPUnit\ResultPrinter\HTML($arguments['html']);
         }
     }
     $arguments['listeners'][] = $this->printer;
     // clean up listeners between suites
     foreach ($arguments['listeners'] as $listener) {
         $result->removeListener($listener);
         $result->addListener($listener);
     }
     if ($arguments['strict']) {
         $result->strictMode(TRUE);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     $result->flushListeners();
     return $result;
 }
Пример #4
0
 public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = [])
 {
     unset($GLOBALS['app']);
     // hook for not to serialize globals
     $result->convertErrorsToExceptions(false);
     if (empty(self::$persistentListeners)) {
         $this->applyReporters($result, $arguments);
     }
     if (class_exists('\\Symfony\\Bridge\\PhpUnit\\SymfonyTestsListener')) {
         $arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
         $arguments['listeners'][] = new \Symfony\Bridge\PhpUnit\SymfonyTestsListener();
     }
     $arguments['listeners'][] = $this->printer;
     // clean up listeners between suites
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     $suite->run($result);
     unset($suite);
     foreach ($arguments['listeners'] as $listener) {
         $result->removeListener($listener);
     }
     return $result;
 }
Пример #5
0
 public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = array())
 {
     $this->handleConfiguration($arguments);
     if (is_integer($arguments['repeat'])) {
         $suite = new \PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     }
     $result->convertErrorsToExceptions(FALSE);
     if (!$arguments['convertNoticesToExceptions']) {
         \PHPUnit_Framework_Error_Notice::$enabled = FALSE;
     }
     if (!$arguments['convertWarningsToExceptions']) {
         \PHPUnit_Framework_Error_Warning::$enabled = FALSE;
     }
     if ($arguments['stopOnError']) {
         $result->stopOnError(TRUE);
     }
     if ($arguments['stopOnFailure']) {
         $result->stopOnFailure(TRUE);
     }
     if ($arguments['stopOnIncomplete']) {
         $result->stopOnIncomplete(TRUE);
     }
     if ($arguments['stopOnSkipped']) {
         $result->stopOnSkipped(TRUE);
     }
     if ($this->printer === NULL) {
         if (isset($arguments['printer']) && $arguments['printer'] instanceof \PHPUnit_Util_Printer) {
             $this->printer = $arguments['printer'];
         } else {
             $this->printer = new \Codeception\PHPUnit\ResultPrinter\UI(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
         }
     }
     if (isset($arguments['report'])) {
         if ($arguments['report']) {
             $this->printer = new \Codeception\PHPUnit\ResultPrinter\Report();
         }
     }
     if (empty(self::$persistentListeners)) {
         foreach ($this->defaultListeners as $listener => $value) {
             if (!isset($arguments[$listener])) {
                 $arguments[$listener] = $value;
             }
         }
         if ($arguments['html']) {
             self::$persistentListeners[] = new \Codeception\PHPUnit\ResultPrinter\HTML(\Codeception\Configuration::logDir() . 'report.html');
         }
         if ($arguments['xml']) {
             self::$persistentListeners[] = new \Codeception\PHPUnit\Log\JUnit(\Codeception\Configuration::logDir() . 'report.xml', false);
         }
         if ($arguments['tap']) {
             self::$persistentListeners[] = new \PHPUnit_Util_Log_TAP(\Codeception\Configuration::logDir() . 'report.tap.log');
         }
         if ($arguments['json']) {
             self::$persistentListeners[] = new \PHPUnit_Util_Log_JSON(\Codeception\Configuration::logDir() . 'report.json');
         }
         foreach (self::$persistentListeners as $listener) {
             $result->addListener($listener);
         }
     }
     $arguments['listeners'][] = $this->printer;
     // clean up listeners between suites
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     if ($arguments['strict']) {
         $result->strictMode(TRUE);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     foreach ($arguments['listeners'] as $listener) {
         $result->removeListener($listener);
     }
     return $result;
 }