class AssetsDataCollectorTest in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest
- 8 webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest
- 8.2 webprofiler/tests/src/Unit/DataCollector/AssetsDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest
@coversDefaultClass \Drupal\webprofiler\DataCollector\AssetsDataCollector
@group webprofiler
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, PhpUnitCompatibilityTrait, PhpUnitWarnings
- class \Drupal\Tests\webprofiler\Unit\DataCollector\DataCollectorBaseTest
- class \Drupal\Tests\webprofiler\Unit\DataCollector\AssetsDataCollectorTest
- class \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
->createMock('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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssetsDataCollectorTest:: |
private | property | ||
AssetsDataCollectorTest:: |
private | property | ||
AssetsDataCollectorTest:: |
constant | |||
AssetsDataCollectorTest:: |
public | function |
Overrides DataCollectorBaseTest:: |
|
AssetsDataCollectorTest:: |
public | function | Tests the Assets data collector. | |
DataCollectorBaseTest:: |
protected | property | @var | |
DataCollectorBaseTest:: |
protected | property | @var | |
DataCollectorBaseTest:: |
protected | property | @var | |
PhpUnitWarnings:: |
private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | |
PhpUnitWarnings:: |
public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
public static | function |