function CtoolsModuleTestCase::testClassesAdd

Test that the ctools_classs_add works.

File

tests/ctools.test, line 154

Class

CtoolsModuleTestCase
Test menu links depending on user permissions.

Code

public function testClassesAdd() {
    ctools_class_reset();
    ctools_class_add('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']['add']), 'Classes array has element: html/add');
    $this->assertEqual($classes['html']['add'], array(
        'testclass',
    ), 'Classes array has expected value');
    ctools_class_add('class2 class3');
    $classes = ctools_get_classes();
    $this->assertEqual(is_array($classes), 1, 'Classes should be an array');
    $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html');
    // TODO: An undesirable result: array('testclass', 'class2', 'class3') is better.
    $this->assertEqual($classes['html']['add'], array(
        'testclass',
        'class2 class3',
    ), 'Classes array has expected value');
}