You are here

public function JsOptimizerUnitTest::providerTestOptimize in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php \Drupal\Tests\Core\Asset\JsOptimizerUnitTest::providerTestOptimize()
  2. 9 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'),
    ],
  ];
}