function CascadingStylesheetsTest::testAlter

Tests Locale module's CSS Alter to include RTL overrides.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php, line 231
Definition of Drupal\system\Tests\Common\CascadingStylesheetsTest.

Class

CascadingStylesheetsTest
Tests the Drupal CSS system.

Namespace

Drupal\system\Tests\Common

Code

function testAlter() {

  // Switch the language to a right to left language and add system.base.css.
  $language_interface = language(LANGUAGE_TYPE_INTERFACE);
  $language_interface->direction = LANGUAGE_RTL;
  $path = drupal_get_path('module', 'system');
  drupal_add_css($path . '/system.base.css');

  // Check to see if system.base-rtl.css was also added.
  $styles = drupal_get_css();
  $this
    ->assert(strpos($styles, $path . '/system.base-rtl.css') !== FALSE, 'CSS is alterable as right to left overrides are added.');

  // Change the language back to left to right.
  $language_interface->direction = LANGUAGE_LTR;
}