mirror of
https://github.com/restoreddev/phpapprentice.git
synced 2025-08-06 14:56:58 +02:00
Added ability to version assets for browser cache busting
This commit is contained in:
@@ -4,9 +4,20 @@ namespace Test;
|
||||
|
||||
class FunctionsTest extends BaseTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
mkdir('/tmp/apprentice_output');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$GLOBALS['PARTIAL_TEST'] = null;
|
||||
|
||||
$files = glob('/tmp/apprentice_output/*');
|
||||
foreach ($files as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
rmdir('/tmp/apprentice_output');
|
||||
}
|
||||
|
||||
public function test_load_config()
|
||||
@@ -56,4 +67,23 @@ class FunctionsTest extends BaseTestCase
|
||||
|
||||
$this->assertEquals('test var', $GLOBALS['PARTIAL_TEST']);
|
||||
}
|
||||
|
||||
public function test_asset_path_with_manifest()
|
||||
{
|
||||
file_put_contents(
|
||||
'/tmp/apprentice_output/manifest.json',
|
||||
json_encode(['js/app.js' => '/js/app-1234.js'])
|
||||
);
|
||||
|
||||
$path = asset('js/app.js');
|
||||
|
||||
$this->assertEquals('/js/app-1234.js', $path);
|
||||
}
|
||||
|
||||
public function test_asset_path_without_manifest()
|
||||
{
|
||||
$path = asset('js/app.js');
|
||||
|
||||
$this->assertEquals('/js/app.js', $path);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user