Skip to content

Commit 918d954

Browse files
committed
adding regression test and fix for recursion bug [#5]
1 parent b5558bb commit 918d954

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

src/Codesleeve/Sprockets/Cache/AssetCache.php

+3
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ public function isCached()
248248
public function isFileCached($file)
249249
{
250250
$asset = new AssetCache(new FileAsset($file), $this->cache);
251+
252+
$this->cache->setAssetCache($asset);
253+
251254
return $asset->isCached();
252255
}
253256

tests/SprocketsGeneratorTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,27 @@ public function testConcatenationOnJavascript()
5757
$this->assertEquals(substr_count($output, ';'), 2);
5858
}
5959

60+
61+
public function testThatAManifestThatIncludesAFileThatDependsOnAnotherFileWorks()
62+
{
63+
$cache = $this->getMock('\Assetic\Cache\CacheInterface');
64+
65+
$cache->expects($this->any())
66+
->method('has')
67+
->will($this->returnValue(true));
68+
69+
$cache->expects($this->any())
70+
->method('get')
71+
->will($this->returnValue('no recursion man'));
72+
73+
$this->generator->config['concat'] = array($this->generator->config['environment']);
74+
$this->generator->config['cache_server'] = $cache;
75+
76+
$output = $this->generator->stylesheet($this->basePath . '/app/assets/stylesheets/manifest10.css');
77+
78+
$this->assertEquals('no recursion man', $output);
79+
}
80+
6081
/**
6182
* Mock server cache object for testing with
6283
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
colors.less
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//= depend_on colors.less
2+
theme.less
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/**
2+
*= require depend_on_test/theme
3+
*/

0 commit comments

Comments
 (0)