function 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']);
}