class ChecklistapiUnitTestCase

Unit tests for Checklist API.

Hierarchy

Expanded class hierarchy of ChecklistapiUnitTestCase

Members

Contains filters are case sensitive

File

modules/contrib/checklistapi/tests/checklistapi.test, line 11
Tests for Checklist API module.

View source
class ChecklistapiUnitTestCase extends DrupalUnitTestCase {

  public static function getInfo() {
    return array(
      'name' => 'Unit tests',
      'description' => 'Test Checklist API classes and functions.',
      'group' => 'Checklist API',
    );
  }

  public function setUp() {
    drupal_load('module', 'checklistapi');
    drupal_load('module', 'checklistapi_test');
    parent::setUp();
  }

  /**
   * Test checklistapi_sort_array().
   */
  public function testChecklistapiSortArray() {
    $input = array_pop(checklistapi_test_checklistapi_checklist_info());
    $output = checklistapi_sort_array($input);
    $this->assertEqual($output['group_two']['#weight'], 0, 'Supplied a default for omitted element weight.');
    $this->assertEqual($output['group_three']['#weight'], 0, 'Supplied a default in place of invalid element weight.');
    $this->assertEqual($output['group_one']['#weight'], -1, 'Retained a valid element weight.');
    $this->assertEqual(element_children($output), array('group_one', 'group_two', 'group_three', 'group_four'), 'Sorted elements by weight.');
    $this->assertEqual(element_children($output['group_one']['item_one']), array('link_one', 'link_two', 'link_three'), 'Recursed through element descendants.');
  }

  /**
   * Test checklistapi_strtolowercamel().
   */
  public function testChecklistapiStrtolowercamel() {
    $this->assertEqual(checklistapi_strtolowercamel('Abc def_ghi'), 'abcDefGhi', 'Converted string to lowerCamel case.');
  }

}