function CssOptimizerUnitTest::setUp

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::setUp()
  3. 11.x core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php, line 40

Class

CssOptimizerUnitTest
Tests the CSS asset optimizer.

Namespace

Drupal\Tests\Core\Asset

Code

protected function setUp() : void {
    parent::setUp();
    $this->fileUrlGenerator = $this->createMock(FileUrlGeneratorInterface::class);
    $this->fileUrlGenerator
        ->expects($this->any())
        ->method('generateString')
        ->with($this->isType('string'))
        ->willReturnCallback(function ($uri) {
        return 'generated-relative-url:' . $uri;
    });
    $this->optimizer = new CssOptimizer($this->fileUrlGenerator);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.