Преглед изворни кода

[FrameworkBundle] made another small optimization for functional tests

Fabien Potencier пре 14 година
родитељ
комит
dafa4d28d6
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

+ 5 - 2
src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

@@ -23,6 +23,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
  */
 abstract class WebTestCase extends \PHPUnit_Framework_TestCase
 {
+    static protected $class;
     static protected $kernel;
 
     /**
@@ -142,9 +143,11 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
      */
     static protected function createKernel(array $options = array())
     {
-        $class = static::getKernelClass();
+        if (null === static::$class) {
+            static::$class = static::getKernelClass();
+        }
 
-        return new $class(
+        return new static::$class(
             isset($options['environment']) ? $options['environment'] : 'test',
             isset($options['debug']) ? $options['debug'] : true
         );