Same name and namespace in other branches
- 5.0.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsmin()
- 6.0.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsmin()
- 8.x-3.x 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
Paramètres
array $js_asset: An fake asset array with the filepath to pass to the minifier.
string $contents: The asset string contents to be minified.
Fichier
-
advagg_js_minify/
tests/ src/ Kernel/ Asset/ JsMinifierUnitTest.php, line 141
Classe
- 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')) {
$this->markTestSkipped('The function jsmin doesn\'t exist, requires the JSMin PHP extension.');
}
$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, []));
}