function ThemeInfoStylesTest::testStylesheets

Tests stylesheets-override and stylesheets-remove.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeInfoStylesTest.php, line 35
Contains Drupal\system\Tests\Theme\ThemeInfoStylesTest.

Class

ThemeInfoStylesTest
Tests processing of theme .info.yml stylesheets.

Namespace

Drupal\system\Tests\Theme

Code

function testStylesheets() {
  theme_enable(array(
    'test_basetheme',
    'test_subtheme',
  ));
  config('system.theme')
    ->set('default', 'test_subtheme')
    ->save();
  $base = drupal_get_path('theme', 'test_basetheme');

  // Unlike test_basetheme (and the original module CSS), the subtheme decides
  // to put all of its CSS into a ./css subdirectory. All overrides and
  // removals are expected to be based on a file's basename and should work
  // nevertheless.
  $sub = drupal_get_path('theme', 'test_subtheme') . '/css';
  $this
    ->drupalGet('theme-test/info/stylesheets');
  $this
    ->assertRaw("{$base}/base-add.css");
  $this
    ->assertRaw("{$base}/base-override.css");
  $this
    ->assertNoRaw("base-remove.css");
  $this
    ->assertRaw("{$sub}/sub-add.css");
  $this
    ->assertRaw("{$sub}/sub-override.css");
  $this
    ->assertRaw("{$sub}/base-add.sub-override.css");
  $this
    ->assertRaw("{$sub}/base-remove.sub-override.css");
  $this
    ->assertNoRaw("sub-remove.css");
  $this
    ->assertNoRaw("base-add.sub-remove.css");
  $this
    ->assertNoRaw("base-override.sub-remove.css");
}