roleTest.php

  1. 8.0.x tests/roleTest.php
  2. 6.x tests/roleTest.php
  3. 7.x tests/roleTest.php
  4. master tests/roleTest.php

Tests for role.drush.inc

Classes

Namesort descending Description
roleCase @group slow @group commands

File

tests/roleTest.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Tests for role.drush.inc
  5. */
  6. /**
  7. * @group slow
  8. * @group commands
  9. */
  10. class roleCase extends Drush_CommandTestCase {
  11. /**
  12. * Create, edit, block, and cancel users.
  13. */
  14. public function testRole() {
  15. $sites = $this->setUpDrupal(1, TRUE);
  16. $root = $this->webroot();
  17. $name = "example";
  18. $options = array(
  19. 'root' => $root,
  20. 'uri' => key($sites),
  21. 'yes' => NULL,
  22. );
  23. $anonymous = 'anonymous';
  24. $authenticated = 'authenticated';
  25. if (UNISH_DRUPAL_MAJOR_VERSION < 8) {
  26. $anonymous .= ' user';
  27. $authenticated .= ' user';
  28. }
  29. $this->drush('role-list', array($anonymous), $options + array('pipe' => NULL) );
  30. $output = $this->getOutput();
  31. $this->assertEquals('access content', $output);
  32. $this->drush('role-list', array($authenticated), $options + array('pipe' => NULL) );
  33. $output = $this->getOutput();
  34. $this->assertEquals('access content', $output);
  35. $this->drush('role-add-perm', array($anonymous, 'administer nodes'), $options );
  36. $this->drush('role-list', array($anonymous), $options + array('pipe' => NULL) );
  37. $output = $this->getOutput();
  38. $this->assertContains('administer nodes', $output);
  39. $this->drush('role-remove-perm', array($anonymous, 'administer nodes'), $options );
  40. $this->drush('role-list', array($anonymous), $options + array('pipe' => NULL) );
  41. $output = $this->getOutput();
  42. $this->assertEquals('access content', $output);
  43. }
  44. }