Procházet zdrojové kódy

refactored functional tests a bit

Johannes Schmitt před 14 roky
rodič
revize
5cda240c6f

+ 1 - 0
src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php

@@ -40,6 +40,7 @@ class WebTestCase extends BaseWebTestCase
 
         return new $class(
             $options['test_case'],
+            isset($options['root_config']) ? $options['root_config'] : 'config.yml',
             isset($options['environment']) ? $options['environment'] : 'test',
             isset($options['debug']) ? $options['debug'] : true
         );

+ 8 - 6
src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php

@@ -15,14 +15,20 @@ use Symfony\Component\HttpKernel\Kernel;
 class AppKernel extends Kernel
 {
     private $testCase;
+    private $rootConfig;
 
-    public function __construct($testCase, $environment, $debug)
+    public function __construct($testCase, $rootConfig, $environment, $debug)
     {
         if (!is_dir(__DIR__.'/'.$testCase)) {
             throw new \InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase));
         }
         $this->testCase = $testCase;
 
+        if (!file_exists($filename = __DIR__.'/'.$testCase.'/'.$rootConfig)) {
+            throw new \InvalidArgumentException(sprintf('The root config "%s" does not exist.', $filename));
+        }
+        $this->rootConfig = $filename;
+
         parent::__construct($environment, $debug);
     }
 
@@ -52,11 +58,7 @@ class AppKernel extends Kernel
 
     public function registerContainerConfiguration(LoaderInterface $loader)
     {
-        if (!file_exists($filename = $this->getRootDir().'/'.$this->testCase.'/config.yml')) {
-            throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $filename));
-        }
-
-        $loader->load($filename);
+        $loader->load($this->rootConfig);
     }
 
     protected function getKernelParameters()