Commit 6ba523ca authored by Derek Wright's avatar Derek Wright
Browse files

[#1178318] Added tests for issue editing permissions.

parent b3165b61
Loading
Loading
Loading
Loading
+20 −1
Changes for project_issue.test: 20 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ class ProjectIssueWebTestCase extends ProjectWebTestCase {

class ProjectIssueCreationTestCase extends ProjectIssueWebTestCase {
  protected $maintain_user;
  protected $power_user;
  protected $auth_user;

  public static function getInfo() {
    return array(
@@ -93,7 +95,10 @@ class ProjectIssueCreationTestCase extends ProjectIssueWebTestCase {
  function setUp() {
    parent::setUp();

    $this->maintain_user = $this->drupalCreateUser(array('create full projects', 'create project issues', 'access project issues', 'access projects'));
    $perms = array('create full projects', 'create project issues', 'access project issues', 'access projects');
    $this->maintain_user = $this->drupalCreateUser(array_merge($perms, array('edit own project issues')));
    $this->power_user = $this->drupalCreateUser(array_merge($perms, array('edit any project issues')));
    $this->auth_user = $this->drupalCreateUser($perms);
    $this->drupalLogin($this->maintain_user);
  }

@@ -128,6 +133,20 @@ class ProjectIssueCreationTestCase extends ProjectIssueWebTestCase {
      'priority' => 'critical',
      'assigned' => $this->maintain_user->name,
    ));

    // Now, test editing rights for various kinds of users.
    $this->drupalLogin($this->maintain_user);
    $this->drupalGet("node/$issue->nid/edit");
    $this->assertResponse(200, t('A user with "edit own project issues" can access the edit tab for an issue she owns.'));

    $this->drupalLogin($this->power_user);
    $this->drupalGet("node/$issue->nid/edit");
    $this->assertResponse(200, t('A user with "edit any project issues" can access the edit tab for an issue she does not own.'));

    $this->drupalLogin($this->auth_user);
    $this->drupalGet("node/$issue->nid/edit");
    $this->assertResponse(403, t('A user with no issue editing permissions is denied access to the edit tab for an issue.'));

  }
}