Security update for permissions_by_term
[yaffs-website] / vendor / drush / drush / tests / roleTest.php
1 <?php
2
3 /**
4  * @file
5  *   Tests for role.drush.inc
6  */
7
8 namespace Unish;
9
10 /**
11  *  @group slow
12  *  @group commands
13  */
14 class roleCase extends CommandUnishTestCase {
15
16   /**
17    * Create, edit, block, and cancel users.
18    */
19   public function testRole() {
20     // In D8+, the testing profile has no perms.
21     $sites = $this->setUpDrupal(1, TRUE, UNISH_DRUPAL_MAJOR_VERSION, UNISH_DRUPAL_MAJOR_VERSION == 6 ? 'default' : 'standard');
22     $root = $this->webroot();
23     $name = "example";
24     $options = array(
25       'root' => $root,
26       'uri' => key($sites),
27       'yes' => NULL,
28     );
29     $anonymous = 'anonymous';
30     $authenticated = 'authenticated';
31     if (UNISH_DRUPAL_MAJOR_VERSION < 8) {
32       $anonymous .= ' user';
33       $authenticated .= ' user';
34     }
35     $this->drush('role-list', array($anonymous), $options + array('pipe' => NULL) );
36     $output = $this->getOutput();
37     $this->assertContains('access content', $output);
38     $this->drush('role-list', array($authenticated), $options + array('pipe' => NULL) );
39     $output = $this->getOutput();
40     $this->assertContains('access content', $output);
41     $this->drush('role-add-perm', array($anonymous, 'administer nodes'), $options );
42     $this->drush('role-list', array($anonymous), $options + array('pipe' => NULL) );
43     $output = $this->getOutput();
44     $this->assertContains('administer nodes', $output);
45     $this->drush('role-remove-perm', array($anonymous, 'administer nodes'), $options );
46     $this->drush('role-list', array($anonymous), $options + array('pipe' => NULL) );
47     $output = $this->getOutput();
48     $this->assertNotContains('administer nodes', $output);
49   }
50 }