本文整理汇总了PHP中Assetic\Asset\FileAsset::load方法的典型用法代码示例。如果您正苦于以下问题:PHP FileAsset::load方法的具体用法?PHP FileAsset::load怎么用?PHP FileAsset::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assetic\Asset\FileAsset
的用法示例。
在下文中一共展示了FileAsset::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLazyLoading
public function testLazyLoading()
{
$asset = new FileAsset(__FILE__);
$this->assertEmpty($asset->getContent(), 'The asset content is empty before load');
$asset->load();
$this->assertNotEmpty($asset->getContent(), 'The asset content is not empty after load');
}
示例2: testCompassMixin
public function testCompassMixin()
{
$asset = new FileAsset(__DIR__ . '/fixtures/compass/compass.sass');
$asset->load();
$this->filter->filterLoad($asset);
$this->assertContains('text-decoration', $asset->getContent());
}
示例3: testCompassExtensionCanBeDisabled
public function testCompassExtensionCanBeDisabled()
{
$this->setExpectedException("Exception", "Undefined mixin box-shadow: failed at `@include box-shadow(10px " . "10px 8px red);` line: 4");
$asset = new FileAsset(__DIR__ . '/fixtures/sass/main_compass.scss');
$asset->load();
$this->getFilter(false)->filterLoad($asset);
}
示例4: testRelativeSourceUrlImportImports
public function testRelativeSourceUrlImportImports()
{
$asset = new FileAsset(__DIR__ . '/fixtures/jsmin/js.js');
$asset->load();
$filter = new JSqueezeFilter();
$filter->filterDump($asset);
$this->assertEquals(";var a='abc',bbb='u';", $asset->getContent());
}
示例5: testPacker
public function testPacker()
{
$asset = new FileAsset(__DIR__ . '/fixtures/packer/example.js');
$asset->load();
$filter = new PackerFilter();
$filter->filterDump($asset);
$this->assertEquals("var exampleFunction=function(arg1,arg2){alert('exampleFunction called!')}", $asset->getContent());
}
示例6: testRelativeSourceUrlImportImports
public function testRelativeSourceUrlImportImports()
{
$asset = new FileAsset(__DIR__ . '/fixtures/jsmin/js.js');
$asset->load();
$filter = new JSMinFilter();
$filter->filterDump($asset);
$this->assertEquals('var a="abc";;;var bbb="u";', $asset->getContent());
}
示例7: testRelativeSourceUrlImportImports
public function testRelativeSourceUrlImportImports()
{
$asset = new FileAsset(__DIR__ . '/fixtures/minifycsscompressor/main.css');
$asset->load();
$filter = new MinifyCssCompressorFilter();
$filter->filterDump($asset);
$this->assertEquals('body{color:white}body{background:black}', $asset->getContent());
}
示例8: testNonCssImport
public function testNonCssImport()
{
$asset = new FileAsset(__DIR__ . '/fixtures/cssimport/noncssimport.css', array(), __DIR__ . '/fixtures/cssimport', 'noncssimport.css');
$asset->load();
$filter = new CssImportFilter();
$filter->filterLoad($asset);
$this->assertEquals(file_get_contents(__DIR__ . '/fixtures/cssimport/noncssimport.css'), $asset->getContent(), '->filterLoad() skips non css');
}
示例9: testFileAsset
public function testFileAsset()
{
$asset = new FileAsset(__DIR__ . '/fixtures/handlebars/template.handlebars');
$asset->load();
$this->filter->filterLoad($asset);
$this->assertNotContains('{{ var }}', $asset->getContent());
$this->assertContains('Ember.TEMPLATES["template"]', $asset->getContent());
$this->assertContains('data.buffer.push("<div id=\\"test\\"><h2>");', $asset->getContent());
}
示例10: testMinimizeHandlebars
public function testMinimizeHandlebars()
{
$asset = new FileAsset(__DIR__ . '/fixtures/handlebars/template.handlebars');
$asset->load();
$this->filter->setMinimize(true);
$this->filter->filterLoad($asset);
$this->assertNotContains('{{ var }}', $asset->getContent());
$this->assertNotContains("\n", $asset->getContent());
}
示例11: testCssEmbedMhtml
public function testCssEmbedMhtml()
{
$asset = new FileAsset(__DIR__ . '/fixtures/cssembed/test.css');
$asset->load();
$this->filter->setMhtml(true);
$this->filter->setMhtmlRoot('/test');
$this->filter->filterDump($asset);
$this->assertContains('url(mhtml:/test/!', $asset->getContent());
}
示例12: testCompilation
public function testCompilation()
{
$asset = new FileAsset(__DIR__ . '/stubs/coffeescript/script.coffee');
$asset->load();
$filter = new CoffeeScriptphpFilter();
$filter->filterLoad($asset);
$expected = file_get_contents(__DIR__ . '/stubs/coffeescript/script.js');
$this->assertEquals($expected, $asset->getContent());
}
示例13: testRelativeSourceUrlImportImports
public function testRelativeSourceUrlImportImports()
{
$asset = new FileAsset(__DIR__ . '/fixtures/cssmin/main.css');
$asset->load();
$filter = new CssMinFilter(__DIR__ . '/fixtures/cssmin');
$filter->setFilter('ImportImports', true);
$filter->filterDump($asset);
$this->assertEquals('body{color:white}body{background:black}', $asset->getContent());
}
示例14: testCssEmbedDataUri
public function testCssEmbedDataUri()
{
$data = base64_encode(file_get_contents(__DIR__ . '/fixtures/home.png'));
$asset = new FileAsset(__DIR__ . '/fixtures/cssembed/test.css');
$asset->load();
$filter = new PhpCssEmbedFilter();
$filter->filterLoad($asset);
$this->assertContains('url(data:image/png;base64,' . $data, $asset->getContent());
}
示例15: testCompilingWithImportPath
public function testCompilingWithImportPath()
{
$asset = new FileAsset(__DIR__ . '/stubs/sass/style.sass');
$asset->load();
$filter = new SassphpFilter();
$filter->addImportPath(__DIR__ . '/stubs/sass/import_path');
$filter->filterLoad($asset);
$expected = file_get_contents(__DIR__ . '/stubs/sass/style.css');
$this->assertEquals($expected, $asset->getContent());
}