本文整理汇总了PHP中Assetic\Asset\StringAsset类的典型用法代码示例。如果您正苦于以下问题:PHP StringAsset类的具体用法?PHP StringAsset怎么用?PHP StringAsset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringAsset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testFilterLoad
public function testFilterLoad()
{
$asset = new StringAsset('.foo{.bar{width:1+1;}}');
$asset->load();
$this->filter->filterLoad($asset);
$this->assertEquals(".foo .bar {\n width: 2;\n}\n", $asset->getContent(), '->filterLoad() parses the content');
}
开发者ID:laubosslink,项目名称:lab,代码行数:7,代码来源:LessFilterTest.php
示例2: testCompile
public function testCompile()
{
if (!isset($_SERVER['CLOSURE_JAR'])) {
$this->markTestSkipped('There is no CLOSURE_JAR environment variable.');
}
$input = <<<EOF
(function() {
function unused(){}
function foo(bar) {
var foo = 'foo';
return foo + bar;
}
alert(foo("bar"));
})();
EOF;
$expected = <<<EOF
(function(){alert("foobar")})();
EOF;
$asset = new StringAsset($input);
$asset->load();
$filter = new CompilerJarFilter($_SERVER['CLOSURE_JAR']);
$filter->filterLoad($asset);
$filter->filterDump($asset);
$this->assertEquals($expected, $asset->getContent());
}
开发者ID:laubosslink,项目名称:lab,代码行数:26,代码来源:CompilerJarFilterTest.php
示例3: testFilterDump
/**
* @group integration
*/
public function testFilterDump()
{
if (!isset($_SERVER['YUI_COMPRESSOR_JAR'])) {
$this->markTestSkipped('There is no YUI_COMPRESSOR_JAR environment variable.');
}
$source = <<<JAVASCRIPT
(function() {
var asdf = 'asdf';
var qwer = 'qwer';
if (asdf.indexOf(qwer)) {
alert("That's not possible!");
} else {
alert("Boom.");
}
})();
JAVASCRIPT;
$expected = <<<JAVASCRIPT
(function(){var a="asdf";var b="qwer";if(a.indexOf(b)){alert("That's not possible!")}else{alert("Boom.")}})();
JAVASCRIPT;
$asset = new StringAsset($source);
$asset->load();
$filter = new JsCompressorFilter($_SERVER['YUI_COMPRESSOR_JAR']);
$filter->filterDump($asset);
$this->assertEquals($expected, $asset->getContent(), '->filterDump()');
}
开发者ID:selimcr,项目名称:servigases,代码行数:32,代码来源:JsCompressorFilterTest.php
示例4: testRoundTrip
public function testRoundTrip()
{
$input = <<<EOF
(function() {
function unused(){}
function foo(bar) {
var foo = 'foo';
return foo + bar;
}
alert(foo("bar"));
})();
EOF;
$expected = <<<EOF
(function() {
alert("foobar")
})();
EOF;
$asset = new StringAsset($input);
$asset->load();
$filter = new CompilerApiFilter();
$filter->setCompilationLevel(CompilerApiFilter::COMPILE_SIMPLE_OPTIMIZATIONS);
$filter->setJsExterns('');
$filter->setExternsUrl('');
$filter->setExcludeDefaultExterns(true);
$filter->setFormatting(CompilerApiFilter::FORMAT_PRETTY_PRINT);
$filter->setUseClosureLibrary(false);
$filter->setWarningLevel(CompilerApiFilter::LEVEL_VERBOSE);
$filter->filterLoad($asset);
$filter->filterDump($asset);
$this->assertEquals($expected, $asset->getContent());
}
开发者ID:laubosslink,项目名称:lab,代码行数:32,代码来源:CompilerApiFilterTest.php
示例5: testPreserveCommentsFalse
public function testPreserveCommentsFalse()
{
$asset = new StringAsset("/* Line 1 */\n.foo { color: green }");
$asset->load();
$this->filter->setPreserveComments(false);
$this->filter->filterLoad($asset);
$this->assertNotContains('/* Line 1 */', $asset->getContent(), '->setPreserveComments(false)');
}
开发者ID:alexanderTsig,项目名称:arabic,代码行数:8,代码来源:LessphpFilterTest.php
示例6: testFilterLoadWithUseNib
public function testFilterLoadWithUseNib()
{
$asset = new StringAsset("@import 'nib'\nbody\n whitespace nowrap\n font 12px Helvetica, Arial, sans-serif\n color black");
$asset->load();
$this->filter->setUseNib(true);
$this->filter->filterLoad($asset);
$this->assertEquals("body {\n white-space: nowrap;\n font: 12px Helvetica, Arial, sans-serif;\n color: #000;\n}\n", $asset->getContent(), '->filterLoad() parses the content using the nib extension');
}
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:8,代码来源:StylusFilterTest.php
示例7: testGetContentNullUnlessLoaded
public function testGetContentNullUnlessLoaded()
{
// see https://github.com/kriswallsmith/assetic/pull/432
$asset = new StringAsset("test");
$this->assertNull($asset->getContent(), '->getContent() returns null unless load() has been called.');
$asset->load();
$this->assertEquals("test", $asset->getContent(), '->getContent() returns the content after load()');
}
开发者ID:selimcr,项目名称:servigases,代码行数:8,代码来源:StringAssetTest.php
示例8: testAppend
public function testAppend()
{
$asset = new StringAsset('foobar');
$asset->load();
$filter = new SeparatorFilter('+');
$filter->filterDump($asset);
$this->assertEquals('foobar+', $asset->getContent());
}
开发者ID:selimcr,项目名称:servigases,代码行数:8,代码来源:SeparatorFilterTest.php
示例9: testFilterLoadWithCompression
public function testFilterLoadWithCompression()
{
$asset = new StringAsset("body\n font 12px Helvetica, Arial, sans-serif\n color black;");
$asset->load();
$this->filter->setCompress(true);
$this->filter->filterLoad($asset);
$this->assertEquals("body{font:12px Helvetica,Arial,sans-serif;color:#000}\n", $asset->getContent(), '->filterLoad() parses the content and compress it');
}
开发者ID:laubosslink,项目名称:lab,代码行数:8,代码来源:StylusFilterTest.php
示例10: testIgnoreNonPuliAssets
public function testIgnoreNonPuliAssets()
{
$asset = new StringAsset('content');
$asset->load();
$this->filter->filterLoad($asset);
$this->filter->filterDump($asset);
// no error
}
开发者ID:puli,项目名称:assetic-extension,代码行数:8,代码来源:PuliCssRewriteFilterTest.php
示例11: testNoHeader
public function testNoHeader()
{
$asset = new StringAsset('square = (x) -> x * x');
$asset->load();
$this->filter->setNoHeader(true);
$this->filter->filterLoad($asset);
$this->assertNotRegExp('/^\\/\\/ Generated by CoffeeScript/i', $asset->getContent());
}
开发者ID:selimcr,项目名称:servigases,代码行数:8,代码来源:CoffeeScriptFilterTest.php
示例12: testPresets
public function testPresets()
{
$asset = new StringAsset('.foo { color: @bar }');
$asset->load();
$this->filter->setPresets(array('bar' => 'green'));
$this->filter->filterLoad($asset);
$this->assertEquals(".foo { color:green; }\n", $asset->getContent(), '->setPresets() to pass variables into lessphp filter');
}
开发者ID:laubosslink,项目名称:lab,代码行数:8,代码来源:LessphpFilterTest.php
示例13: testEmptyUrl
public function testEmptyUrl()
{
$asset = new StringAsset('body { background: url(); }', array(), 'http://www.example.com', 'css/main.css');
$asset->setTargetPath('css/packed/main.css');
$asset->load();
$filter = new CssRewriteFilter();
$filter->filterDump($asset);
// no error is thrown
}
开发者ID:alexanderTsig,项目名称:arabic,代码行数:9,代码来源:CssRewriteFilterTest.php
示例14: testUriRewriteWithSymlinks
public function testUriRewriteWithSymlinks()
{
$filter = new UriRewriteFilter('path/to/public', array('//assets' => strtr('path/to/outside/public/assets', '/', DIRECTORY_SEPARATOR)));
$input = "body { background-image: url('../foo/bar.png'); }";
$asset = new StringAsset($input, array(), 'path/to/outside/public/assets/baz', 'qux.css');
$asset->load();
$filter->filterDump($asset);
$this->assertEquals("body { background-image: url('/assets/foo/bar.png'); }", $asset->getContent());
}
开发者ID:daveearley,项目名称:basset,代码行数:9,代码来源:UriRewriteFilterTest.php
示例15: testNoTargetPath
public function testNoTargetPath()
{
$content = 'body{url(foo.gif)}';
$asset = new StringAsset($content);
$asset->load();
$filter = new CssRewriteFilter();
$filter->filterDump($asset);
$this->assertEquals($content, $asset->getContent(), '->filterDump() urls are not changed without urls');
}
开发者ID:laiello,项目名称:mediathequescrum,代码行数:9,代码来源:CssRewriteFilterTest.php
示例16: testFilterLoadBared
public function testFilterLoadBared()
{
$this->filter = new CoffeephpFilter(array('bare' => false));
$asset = new StringAsset($this->stringAsset);
$this->filter->options['bare'] = true;
$asset->load();
$this->filter->filterLoad($asset);
$this->assertEquals($this->compiledStringAsset, $asset->getContent(), '->filterLoad() sets an include path based on source url');
}
开发者ID:cynode,项目名称:asset-manager,代码行数:9,代码来源:CoffeephpFilterTest.php
示例17: testUrls
/**
* @dataProvider provideUrls
*/
public function testUrls($before, $after)
{
$asset = new StringAsset($before, array(), null, '.');
$asset->setTargetPath('.');
$asset->load();
$filter = new CachebusterFilter('v=bar');
$filter->filterDump($asset);
$this->assertEquals($after, $asset->getContent());
}
开发者ID:bluedogtraining,项目名称:assetic-extensions,代码行数:12,代码来源:CachebusterFilterTest.php
示例18: testSetImportPath
public function testSetImportPath()
{
$filter = $this->getFilter();
$filter->addImportPath(__DIR__ . '/fixtures/sass/import_path');
$asset = new StringAsset("@import 'import';\n#test { color: \$red }");
$asset->load();
$filter->filterLoad($asset);
$this->assertEquals("#test {\n color: red; }\n", $asset->getContent(), 'Import paths are correctly used');
}
开发者ID:jvillasante,项目名称:cubanartjb,代码行数:9,代码来源:ScssphpFilterTest.php
示例19: testFilterLoad
public function testFilterLoad()
{
$prolog = "/** @jsx React.DOM */\n";
$expected = $prolog . 'React.renderComponent(React.createElement(HelloMessage, {name: "John"}), mountNode);';
$asset = new StringAsset($prolog . 'React.renderComponent(<HelloMessage name="John" />, mountNode);');
$asset->load();
$this->filter->filterLoad($asset);
$this->assertEquals($expected, $this->clean($asset->getContent()));
}
开发者ID:selimcr,项目名称:servigases,代码行数:9,代码来源:ReactJsxFilterTest.php
示例20: testExternalSource
public function testExternalSource()
{
$asset = new StringAsset('body { background: url(../images/bg.gif); }', array(), 'http://www.example.com', 'css/main.css');
$asset->setTargetPath('css/packed/main.css');
$asset->load();
$filter = new CssRewriteFilter();
$filter->filterDump($asset);
$this->assertContains('http://www.example.com/css/../images/bg.gif', $asset->getContent(), '->filterDump() rewrites references in external stylesheets');
}
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:9,代码来源:CssRewriteFilterTest.php
注:本文中的Assetic\Asset\StringAsset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论