ModuleFileTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Tests\tripal_jbrowse_mgmt;
  3. use StatonLab\TripalTestSuite\DBTransaction;
  4. use StatonLab\TripalTestSuite\TripalTestCase;
  5. class ModuleFileTest extends TripalTestCase {
  6. // Uncomment to auto start and rollback db transactions per test method.
  7. // use DBTransaction;
  8. /**
  9. * Tests hook_menu(). Specifically, are all the required keys set.
  10. */
  11. public function testHookMenu() {
  12. $menu_items = tripal_jbrowse_mgmt_menu();
  13. $this->assertIsArray($menu_items);
  14. foreach($menu_items as $path => $item) {
  15. $this->assertArrayHasKey('title', $item,
  16. "$path menu item is missing a title.");
  17. $this->assertArrayHasKey('page callback', $item,
  18. "$path menu item is missing a page callback.");
  19. $this->assertArrayHasKey('access arguments', $item,
  20. "$path menu item is missing access arguments.");
  21. $this->assertIsArray($item['access arguments'],
  22. "$path menu item access arguments must be an array.");
  23. }
  24. }
  25. /**
  26. * Tests hook_permission(). Specifically, checks format.
  27. */
  28. public function testHookPerm() {
  29. $permissions = tripal_jbrowse_mgmt_permission();
  30. $this->assertIsArray($permissions);
  31. foreach ($permissions as $key => $perm) {
  32. $this->assertArrayHasKey('title', $perm,
  33. "$key permission is missing a title.");
  34. }
  35. }
  36. }