public function setUp()
 {
     parent::setUp();
     ClockMock::register(WaitingValidator::class);
     ClockMock::register(static::class);
     ClockMock::withClockMock(true);
 }
 public function startTest(\PHPUnit_Framework_Test $test)
 {
     if ($test instanceof \PHPUnit_Framework_TestCase) {
         $groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName());
         if (in_array('time-sensitive', $groups, true)) {
             ClockMock::register(get_class($test));
             ClockMock::withClockMock(true);
         }
     }
 }
Beispiel #3
0
 protected function setUp()
 {
     if (class_exists('Symfony\\Bridge\\PhpUnit\\ClockMock')) {
         ClockMock::register('Symfony\\Component\\HttpFoundation\\Request');
     }
     $this->kernel = null;
     $this->cache = null;
     $this->esi = null;
     $this->caches = array();
     $this->cacheConfig = array();
     $this->request = null;
     $this->response = null;
     $this->responses = array();
     $this->catch = false;
     $this->clearDirectory(sys_get_temp_dir() . '/http_cache');
 }
 public function startTest(\PHPUnit_Framework_Test $test)
 {
     if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) {
         $groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false));
         if (in_array('time-sensitive', $groups, true)) {
             ClockMock::register(get_class($test));
             ClockMock::withClockMock(true);
         }
         if (in_array('dns-sensitive', $groups, true)) {
             DnsMock::register(get_class($test));
         }
         $annotations = \PHPUnit_Util_Test::parseTestMethodAnnotations(get_class($test), $test->getName(false));
         if (isset($annotations['class']['expectedDeprecation'])) {
             $test->getTestResultObject()->addError($test, new \PHPUnit_Framework_AssertionFailedError('`@expectedDeprecation` annotations are not allowed at the class level.'), 0);
         }
         if (isset($annotations['method']['expectedDeprecation'])) {
             if (!in_array('legacy', $groups, true)) {
                 $test->getTestResultObject()->addError($test, new \PHPUnit_Framework_AssertionFailedError('Only tests with the `@group legacy` annotation can have `@expectedDeprecation`.'), 0);
             }
             $this->expectedDeprecations = $annotations['method']['expectedDeprecation'];
             $this->previousErrorHandler = set_error_handler(array($this, 'handleError'));
         }
     }
 }
Beispiel #5
-1
 /**
  * @group time-sensitive
  */
 public function setUp()
 {
     $kernel = static::createKernel();
     $kernel->boot();
     $this->SlaveRequestRepository = $kernel->getContainer()->get('doctrine.orm.entity_manager')->getRepository('AppBundle:slave_request');
     ClockMock::register(__CLASS__);
 }