| 1 | <?php | ||
| 10 | class WebTestCase extends BaseWebTestCase | ||
| 11 | { | ||
| 12 | protected function deleteTmpDir($testCase) | ||
| 13 |     { | ||
| 14 |         if (!file_exists($dir = sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$testCase)) { | ||
| 15 | return; | ||
| 16 | } | ||
| 17 | |||
| 18 | $fs = new Filesystem(); | ||
| 19 | $fs->remove($dir); | ||
| 20 | } | ||
| 21 | |||
| 22 | protected static function getKernelClass() | ||
| 23 |     { | ||
| 24 | require_once __DIR__.'/app/AppKernel.php'; | ||
| 25 | |||
| 26 | return AppKernel::class; | ||
| 27 | } | ||
| 28 | |||
| 29 | protected static function createKernel(array $options = []) | ||
| 30 |     { | ||
| 31 | $class = self::getKernelClass(); | ||
| 32 | |||
| 33 |         if (!isset($options['test_case'])) { | ||
| 34 |             throw new \InvalidArgumentException('The option "test_case" must be set.'); | ||
| 35 | } | ||
| 36 | |||
| 37 | return new $class( | ||
| 38 | $options['test_case'], | ||
| 39 | isset($options['root_config']) ? $options['root_config'] : 'config.yml', | ||
| 40 | isset($options['environment']) ? $options['environment'] : 'majoraframeworkextrabundletest'.strtolower($options['test_case']), | ||
| 41 | isset($options['debug']) ? $options['debug'] : true | ||
| 42 | ); | ||
| 43 | } | ||
| 44 | } | ||
| 45 |