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::testMinifyJsqueeze()
  2. 8.x-3.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsqueeze()
  3. 8.x-4.x advagg_js_minify/tests/src/Kernel/Asset/JsMinifierUnitTest.php \Drupal\Tests\advagg_js_minify\Kernel\Asset\JsMinifierUnitTest::testMinifyJsqueeze()

Tests minification of a JS Asset with JSqueeze.

@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 177

Classe

JsMinifierUnitTest
Tests the JS asset minifier.

Namespace

Drupal\Tests\advagg_js_minify\Kernel\Asset

Code

public function testMinifyJsqueeze(array $js_asset, $contents) {
    $this->config('advagg_js_minify.settings')
        ->set('minifier', 5)
        ->save();
    // Due to an odd bug we use a different test file for PHP5.x comparison.
    // See https://www.drupal.org/node/2916193.
    if (version_compare(phpversion(), '7', '<')) {
        $js_asset['data'] .= '.php5';
    }
    $expected = file_get_contents($js_asset['data'] . '.jsqueeze.js');
    $this->assertEquals($expected, $this->optimizer
        ->optimize($contents, $js_asset, []));
}