function JsOptimizerUnitTest::providerTestOptimize

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php \Drupal\Tests\Core\Asset\JsOptimizerUnitTest::providerTestOptimize()
  2. 10 core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php \Drupal\Tests\Core\Asset\JsOptimizerUnitTest::providerTestOptimize()
  3. 11.x core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php \Drupal\Tests\Core\Asset\JsOptimizerUnitTest::providerTestOptimize()

Provides data for the JS asset optimize test.

@returns array An array of test data.

See also

\Drupal\Core\Asset\JsOptimizer::optimize()

File

core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php, line 86

Class

JsOptimizerUnitTest
Tests the JS asset optimizer.

Namespace

Drupal\Tests\Core\Asset

Code

public function providerTestOptimize() {
    $path = dirname(__FILE__) . '/js_test_files/';
    return [
        0 => [
            [
                'type' => 'file',
                'preprocess' => TRUE,
                'data' => $path . 'utf8_bom.js',
            ],
            file_get_contents($path . 'utf8_bom.js.optimized.js'),
        ],
        1 => [
            [
                'type' => 'file',
                'preprocess' => TRUE,
                'data' => $path . 'utf16_bom.js',
            ],
            file_get_contents($path . 'utf16_bom.js.optimized.js'),
        ],
        2 => [
            [
                'type' => 'file',
                'preprocess' => TRUE,
                'data' => $path . 'latin_9.js',
                'attributes' => [
                    'charset' => 'ISO-8859-15',
                ],
            ],
            file_get_contents($path . 'latin_9.js.optimized.js'),
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.