JavaScriptTestCase::testLibraryRender

7 common.test JavaScriptTestCase::testLibraryRender()

Adds a library to the page and tests for both its JavaScript and its CSS.

File

modules/simpletest/tests/common.test, line 1461
Tests for common.inc functionality.

Code

function testLibraryRender() {
  $result = drupal_add_library('system', 'farbtastic');
  $this->assertTrue($result !== FALSE, t('Library was added without errors.'));
  $scripts = drupal_get_js();
  $styles = drupal_get_css();
  $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('JavaScript of library was added to the page.'));
  $this->assertTrue(strpos($styles, 'misc/farbtastic/farbtastic.css'), t('Stylesheet of library was added to the page.'));
}
Login or register to post comments