Skip to content

Commit 6cc253e

Browse files
committed
Cleanup cache and create it deeply
1 parent b795809 commit 6cc253e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.phar
66
/coverage/
77
coverage.xml
88
installed
9+
/var/

src/Jade/JadeSymfonyEngine.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct($kernel)
3636
$this->kernel = $kernel;
3737
$cache = $this->getCacheDir();
3838
if (!file_exists($cache)) {
39-
mkdir($cache);
39+
mkdir($cache, 0777, true);
4040
}
4141
$container = $kernel->getContainer();
4242
$this->container = $container;

tests/Pug/PugSymfonyEngineTest.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ class PugSymfonyEngineTest extends KernelTestCase
102102
{
103103
private static function clearCache()
104104
{
105-
if (is_dir(__DIR__ . '/../project/app/cache')) {
106-
(new Filesystem())->remove(__DIR__ . '/../project/app/cache');
105+
foreach (['app', 'var'] as $directory) {
106+
if (is_dir($path = __DIR__ . "/../project/$directory/cache")) {
107+
(new Filesystem())->remove($path);
108+
}
107109
}
108110
}
109111

@@ -188,6 +190,7 @@ public function testSecurityToken()
188190

189191
public function testLogoutHelper()
190192
{
193+
self::clearCache();
191194
$logoutUrlHelper = new LogoutUrlHelper(new LogoutUrlGenerator());
192195
self::$kernel->getContainer()->set('templating.helper.logout_url', $logoutUrlHelper);
193196
$pugSymfony = new PugSymfonyEngine(self::$kernel);
@@ -197,6 +200,7 @@ public function testLogoutHelper()
197200

198201
public function testCustomHelper()
199202
{
203+
self::clearCache();
200204
$helper = new CustomHelper();
201205
$kernel = new TestKernel(function (Container $container) {
202206
$container->setParameter('pug', [
@@ -252,8 +256,12 @@ public function testBundleView()
252256
self::assertSame('<section>World</section>', trim($pugSymfony->render('TestBundle:directory:file.pug')));
253257
}
254258

259+
/**
260+
* @group i
261+
*/
255262
public function testAssetHelperPhp()
256263
{
264+
self::clearCache();
257265
$pugSymfony = new PugSymfonyEngine(self::$kernel);
258266
$pugSymfony->setOption('expressionLanguage', 'php');
259267

@@ -276,6 +284,7 @@ public function testAssetHelperPhp()
276284

277285
public function testAssetHelperJs()
278286
{
287+
self::clearCache();
279288
$pugSymfony = new PugSymfonyEngine(self::$kernel);
280289
$pugSymfony->setOption('expressionLanguage', 'js');
281290

0 commit comments

Comments
 (0)