本文整理汇总了PHP中Assetic\Asset\StringAsset::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP StringAsset::getContent方法的具体用法?PHP StringAsset::getContent怎么用?PHP StringAsset::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assetic\Asset\StringAsset
的用法示例。
在下文中一共展示了StringAsset::getContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()');
}
示例2: testMixedIteration
public function testMixedIteration()
{
$asset = new StringAsset('asset');
$nestedAsset = new StringAsset('nested');
$innerColl = new AssetCollection(array($nestedAsset));
$contents = array();
$filter = new CallablesFilter(function ($asset) use(&$contents) {
$contents[] = $asset->getContent();
});
$coll = new AssetCollection(array($asset, $innerColl), array($filter));
$coll->load();
$this->assertEquals(array('asset', 'nested'), $contents, '->load() iterates over multiple levels');
}
示例3: testSetFormatter
public function testSetFormatter()
{
$actual = new StringAsset(".foo {\n color: #fff;\n}");
$actual->load();
$filter = $this->getFilter();
$filter->setFormatter("scss_formatter_compressed");
$filter->filterLoad($actual);
$expected = new StringAsset('.foo{color:#fff}');
$expected->load();
$this->assertEquals($expected->getContent(), $actual->getContent(), 'scss_formatter can be changed');
}