You are here

public function CtoolsModuleTestCase::testAttachCss in Chaos Tool Suite (ctools) 7

Test the ctools_attach_css function returns the expected paths.

File

tests/ctools.test, line 109
Test classes for code in the CTools module file.

Class

CtoolsModuleTestCase
Test menu links depending on user permissions.

Code

public function testAttachCss() {
  $taxonomy_path = drupal_get_path('module', 'taxonomy');
  $ctools_path = drupal_get_path('module', 'ctools');

  // Func should probably do a different thing but this is current behaviour.
  $path = ctools_attach_css('');
  $this
    ->assertEqual($path, $ctools_path . '/css/.css', 'Attach empty string');
  $path = ctools_attach_css('foo');
  $this
    ->assertEqual($path, $ctools_path . '/css/foo.css', 'Attach simple string');
  $path = ctools_attach_css('foo', 'ctools', '');
  $this
    ->assertEqual($path, $ctools_path . '//foo.css', 'Attach string with empty subdir');
  $path = ctools_attach_css('foo', 'ctools', 'theme');
  $this
    ->assertEqual($path, $ctools_path . '/theme/foo.css', 'Attach string with alternate subdir');
  $path = ctools_attach_css('foo', 'taxonomy', 'theme');
  $this
    ->assertEqual($path, $taxonomy_path . '/theme/foo.css', 'Attach string from different module');
}