Same name in other branches
  1. 6.0.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsqueezeImportantComments()
  2. 8.x-3.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsqueezeImportantComments()
  3. 8.x-4.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsqueezeImportantComments()

Tests JSqueeze minification's important comments/integration.

Fichier

advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php, line 208

Classe

JsMinifierUnitTest
Tests the JS asset minifier.

Namespace

Drupal\Tests\advagg_js_minify\Kernel\Asset

Code

public function testMinifyJsqueezeImportantComments() {
    $file = dirname(__FILE__) . '/js_test_files/jquery.once.js';
    $asset = [
        'data' => $file,
    ];
    $original = file_get_contents($file);
    $withComments = file_get_contents($file . '.with-important.js');
    $withoutComments = file_get_contents($file . '.without-important.js');
    $config = $this->config('advagg_js_minify.settings');
    $config->set('minifier', 5)
        ->set('add_license', TRUE)
        ->save();
    $this->assertEquals($withComments, $this->optimizer
        ->optimize($original, $asset, []));
    $config->set('add_license', FALSE)
        ->save();
    $this->assertEquals($withoutComments, $this->optimizer
        ->optimize($original, $asset, []));
}