You are here

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

Test that the (deprecated) getuserroles returns expected array.

File

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

Class

CtoolsModuleTestCase
Test menu links depending on user permissions.

Code

public function testGetUserRoles() {
  $result = ctools_get_roles();
  $this
    ->assertTrue(is_array($result), 'get_roles returns an array');

  // A key-value array of integers.
  foreach ($result as $k => $v) {
    $this
      ->assertTrue(is_numeric($k), 'Role key is numeric; ' . $k);
    $this
      ->assertTrue(is_string($v), 'Role id is string; ' . $v);
  }
}