You are here

public function CssMinifierUnitTest::providerTestMinifyYui in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 advagg_css_minify/tests/src/Kernel/Asset/CssMinifierUnitTest.php \Drupal\Tests\advagg_css_minify\Kernel\Asset\CssMinifierUnitTest::providerTestMinifyYui()

Provides data for the CSS asset optimizing test.

File

advagg_css_minify/tests/src/Kernel/Asset/CssMinifierUnitTest.php, line 51

Class

CssMinifierUnitTest
Tests the CSS asset minifier.

Namespace

Drupal\Tests\advagg_css_minify\Kernel\Asset

Code

public function providerTestMinifyYui() {
  $path = 'core/tests/Drupal/Tests/Core/Asset/css_test_files/';
  $absolute_path = dirname(__FILE__) . '/css_test_files/';
  return [
    // File. Tests:
    // - Stripped comments and white-space.
    // - Retain white-space in selectors. (https://www.drupal.org/node/472820)
    // - Retain pseudo-selectors. (https://www.drupal.org/node/460448)
    [
      [
        'data' => $path . 'css_input_without_import.css',
      ],
      file_get_contents($absolute_path . 'css_input_without_import.css'),
      file_get_contents($absolute_path . 'css_input_without_import.css.optimized.css'),
    ],
    // File. Tests:
    // - Retain comment hacks.
    [
      [
        'data' => $path . 'comment_hacks.css',
      ],
      file_get_contents($absolute_path . 'comment_hacks.css'),
      file_get_contents($absolute_path . 'comment_hacks.css.optimized.css'),
    ],
    // File. Tests:
    // - Any @charset declaration at the beginning of a file should be
    //   removed without breaking subsequent CSS.
    [
      [
        'data' => $path . 'charset_sameline.css',
      ],
      file_get_contents($absolute_path . 'charset_sameline.css'),
      file_get_contents($absolute_path . 'charset.css.optimized.css'),
    ],
    [
      [
        'data' => $path . 'charset_newline.css',
      ],
      file_get_contents($absolute_path . 'charset_newline.css'),
      file_get_contents($absolute_path . 'charset.css.optimized.css'),
    ],
    [
      [
        'data' => $path . 'css_input_with_bom.css',
      ],
      file_get_contents($absolute_path . 'css_input_with_bom.css'),
      '.byte-order-mark-test{content:"☃"}',
    ],
    [
      [
        'data' => $path . 'css_input_with_charset.css',
      ],
      file_get_contents($absolute_path . 'css_input_with_charset.css'),
      '.charset-test{content:"€"}',
    ],
    [
      [
        'data' => $path . 'css_input_with_bom_and_charset.css',
      ],
      file_get_contents($absolute_path . 'css_input_with_bom_and_charset.css'),
      '.byte-order-mark-charset-test{content:"☃"}',
    ],
    [
      [
        'data' => $path . 'css_input_with_utf16_bom.css',
      ],
      file_get_contents($absolute_path . 'css_input_with_utf16_bom.css'),
      '.utf16-byte-order-mark-test{content:"☃"}',
    ],
    [
      [
        'data' => $path . 'quotes.css',
      ],
      file_get_contents($absolute_path . 'quotes.css'),
      file_get_contents($absolute_path . 'quotes.css.optimized.css'),
    ],
  ];
}