/** * testRewrite * * @since 3.0.0 * * @param array $collectionArray * @param array $rewriteArray * @param string $expect * * @dataProvider providerRewrite */ public function testRewrite($collectionArray = [], $rewriteArray = [], $expect = null) { /* setup */ $optionArray = ['directory' => Stream::url('root/cache/styles'), 'extension' => 'css', 'attribute' => 'href', 'lifetime' => 86400]; $loader = new Assetic\Loader(Registry::getInstance()); $loader->init($collectionArray, 'css')->concat($optionArray, $rewriteArray)->concat($optionArray, $rewriteArray); /* actual */ $file = $loader->getCollectionArray()['bundle']['href']; $actual = file_get_contents($file); /* compare */ $this->assertEquals($expect, $actual); }
/** * concat the script * * @since 3.0.0 * * @param array $optionArray * * @return Script */ public function concat($optionArray = []) { $optionArray = array_merge(self::$_optionArray, $optionArray); $loader = new Assetic\Loader(Registry::getInstance()); $loader->init(self::$_collectionArray[self::$_namespace])->concat($optionArray); /* update collection */ self::$_collectionArray[self::$_namespace] = $loader->getCollectionArray(); return $this; }