You are here

public function CssOptimizerUnitTest::testUrlUpdate in Advanced CSS/JS Aggregation 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Kernel/Asset/CssOptimizerUnitTest.php \Drupal\Tests\advagg\Kernel\Asset\CssOptimizerUnitTest::testUrlUpdate()

Tests the urlUpdate() method.

@dataProvider providerTestUrlUpdate

Parameters

string $file: The file to test.

string $expected: The expected url string.

File

tests/src/Kernel/Asset/CssOptimizerUnitTest.php, line 75

Class

CssOptimizerUnitTest
Tests the CSS asset optimizer.

Namespace

Drupal\Tests\advagg\Kernel\Asset

Code

public function testUrlUpdate($file, $expected) {
  $path = $this->dir . 'css_test_files/' . $file;
  $absolute_path = dirname(__FILE__) . '/css_test_files/';
  $contents = file_get_contents($absolute_path . $file);
  $replaced_urls = $this->optimizer
    ->updateUrls($contents, $path);
  $this
    ->assertTrue(strstr($replaced_urls, $expected));
}