mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
/*
|
||
|
* This file is part of the Symfony package.
|
||
|
*
|
||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||
|
*
|
||
|
* For the full copyright and license information, please view the LICENSE
|
||
|
* file that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
|
namespace Nelmio\ApiDocBundle\Tests;
|
||
|
|
||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
|
||
|
use Symfony\Component\Filesystem\Filesystem;
|
||
|
use Symfony\Component\HttpKernel\Kernel;
|
||
|
|
||
|
abstract class WebTestCase extends BaseWebTestCase
|
||
|
{
|
||
|
protected function deleteTmpDir($testCase)
|
||
|
{
|
||
|
if (!file_exists($dir = sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$testCase)) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
$fs = new Filesystem();
|
||
|
$fs->remove($dir);
|
||
|
}
|
||
|
|
||
|
protected function getContainer(array $options = array())
|
||
|
{
|
||
|
if (!static::$kernel) {
|
||
|
static::$kernel = static::createKernel($options);
|
||
|
}
|
||
|
static::$kernel->boot();
|
||
|
|
||
|
return static::$kernel->getContainer();
|
||
|
}
|
||
|
|
||
|
static protected function getKernelClass()
|
||
|
{
|
||
|
require_once __DIR__.'/Fixtures/app/AppKernel.php';
|
||
|
|
||
|
return 'Nelmio\ApiDocBundle\Tests\Functional\AppKernel';
|
||
|
}
|
||
|
|
||
|
static protected function createKernel(array $options = array())
|
||
|
{
|
||
|
$class = self::getKernelClass();
|
||
|
|
||
|
return new $class(
|
||
|
'default',
|
||
|
isset($options['debug']) ? $options['debug'] : true
|
||
|
);
|
||
|
}
|
||
|
}
|