You are here

public function AssetsDataCollectorTest::testCSS in Devel 4.x

Same name and namespace in other branches
  1. 8.3 webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest::testCSS()
  2. 8 webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest::testCSS()
  3. 8.2 webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest::testCSS()

Tests the Assets data collector.

File

webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php, line 40

Class

AssetsDataCollectorTest
@coversDefaultClass \Drupal\webprofiler\DataCollector\AssetsDataCollector

Namespace

Drupal\Tests\webprofiler\Unit\DataCollector

Code

public function testCSS() {
  $css = [
    'core/assets/vendor/normalize-css/normalize.css' => [
      'weight' => -219.944,
      'group' => 0,
      'type' => 'file',
      'data' => 'core\\/assets\\/vendor\\/normalize-css\\/normalize.css',
      'version' => '3.0.3',
      'media' => 'all',
      'preprocess' => TRUE,
      'browsers' => [
        'IE' => TRUE,
        '!IE' => TRUE,
      ],
    ],
  ];
  $cssCollectionRendererWrapper = new CssCollectionRendererWrapper($this->assetCollectionRendererInterface, $this->assetDataCollector);
  $cssCollectionRendererWrapper
    ->render($css);
  $this
    ->assertEquals(1, $this->assetDataCollector
    ->getCssCount());
  $this->assetDataCollector
    ->collect($this->request, $this->response, $this->exception);
  $data = $this->assetDataCollector
    ->getData();
  $this
    ->assertEquals(AssetsDataCollectorTest::ROOT . '/', $data['assets']['installation_path']);
}