class AssetsDataCollectorTest
@coversDefaultClass \Drupal\webprofiler\DataCollector\AssetsDataCollector
@group webprofiler
Hierarchy
- class \Drupal\Tests\webprofiler\Unit\DataCollector\DataCollectorBaseTest extends \Drupal\Tests\UnitTestCase
- class \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest extends \Drupal\Tests\webprofiler\Unit\DataCollector\DataCollectorBaseTest
Expanded class hierarchy of AssetsDataCollectorTest
File
-
webprofiler/
tests/ src/ Unit/ DataCollector/ AssetsDataCollectorTest.php, line 13
Namespace
Drupal\Tests\webprofiler\Unit\DataCollectorView source
class AssetsDataCollectorTest extends DataCollectorBaseTest {
/**
* @var \Drupal\webprofiler\DataCollector\AssetsDataCollector
*/
private $assetDataCollector;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $assetCollectionRendererInterface;
const ROOT = 'test_root';
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->assetDataCollector = new AssetsDataCollector(AssetsDataCollectorTest::ROOT);
$this->assetCollectionRendererInterface = $this->getMock('Drupal\\Core\\Asset\\AssetCollectionRendererInterface');
}
/**
* Tests the Assets data collector.
*/
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']);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AssetsDataCollectorTest::$assetCollectionRendererInterface | private | property | ||
AssetsDataCollectorTest::$assetDataCollector | private | property | ||
AssetsDataCollectorTest::ROOT | constant | |||
AssetsDataCollectorTest::setUp | public | function | Overrides DataCollectorBaseTest::setUp | |
AssetsDataCollectorTest::testCSS | public | function | Tests the Assets data collector. | |
DataCollectorBaseTest::$exception | protected | property | @var | |
DataCollectorBaseTest::$request | protected | property | @var | |
DataCollectorBaseTest::$response | protected | property | @var |