public function JsMinifierUnitTest::testMinifyJsmin in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsmin()
Tests minification of a JS Asset with jsmin.
@dataProvider providerTestMinification
Parameters
array $js_asset: An fake asset array with the filepath to pass to the minifier.
string $contents: The asset string contents to be minified.
File
- advagg_js_minify/
tests/ src/ Kernel/ Asset/ JsMinifierUnitTest.php, line 141
Class
- JsMinifierUnitTest
- Tests the JS asset minifier.
Namespace
Drupal\Tests\advagg_js_minify\Kernel\AssetCode
public function testMinifyJsmin(array $js_asset, $contents) {
// Requires the JSMin PHP extension; if it isn't available skip the test.
if (!function_exists('jsmin')) {
return;
}
$this
->config('advagg_js_minify.settings')
->set('minifier', 3)
->save();
$expected = file_get_contents($js_asset['data'] . '.jsmin.js');
$this
->assertEquals($expected, $this->optimizer
->optimize($contents, $js_asset, []));
}