[TwigBundle] fix test case

This commit is contained in:
Nicolas Grekas 2019-09-23 16:55:33 +02:00
parent 8eaa5a86f4
commit 4ca6eea758

View File

@ -16,6 +16,7 @@ use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\ErrorRenderer\ErrorRenderer;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
class EmptyAppTest extends TestCase
@ -28,6 +29,26 @@ class EmptyAppTest extends TestCase
$this->assertTrue($kernel->getContainer()->hasParameter('twig.default_path'));
$this->assertNotEmpty($kernel->getContainer()->getParameter('twig.default_path'));
}
protected function setUp()
{
$this->deleteTempDir();
}
protected function tearDown()
{
$this->deleteTempDir();
}
private function deleteTempDir()
{
if (!file_exists($dir = sys_get_temp_dir().'/'.Kernel::VERSION.'/EmptyAppKernel')) {
return;
}
$fs = new Filesystem();
$fs->remove($dir);
}
}
class EmptyAppKernel extends Kernel