You are here

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

Test that the ctools_classs_remove works.

File

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

Class

CtoolsModuleTestCase
Test menu links depending on user permissions.

Code

public function testClassesRemove() {
  ctools_class_reset();
  ctools_class_remove('testclass');
  $classes = ctools_get_classes();
  $this
    ->assertEqual(is_array($classes), 1, 'Classes should be an array');
  $this
    ->assertEqual(count($classes), 1, 'Classes array has one element');
  $this
    ->assertEqual(count($classes['html']), 1, 'Classes array has element: html');
  $this
    ->assertTrue(isset($classes['html']['remove']), 'Classes array has element: html/remove');
  $this
    ->assertEqual($classes['html']['remove'], array(
    'testclass',
  ), 'Classes array has expected value');
  ctools_class_remove('class2 class3');
  $classes = ctools_get_classes();
  $this
    ->assertEqual(count($classes), 1, 'Classes array has one element');
  $this
    ->assertEqual(count($classes['html']), 1, 'Classes array has element: html');

  // This is an undesirable result, is array('testclass', 'class2', 'class3') better.
  $this
    ->assertEqual($classes['html']['remove'], array(
    'testclass',
    'class2 class3',
  ), 'Classes array has expected value');
}