|
|
@ -1,7 +1,17 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @file |
|
|
|
|
|
|
|
* Tests islandora permissions, and permission related funcitons. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets info to display to describe this test. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see IslandoraWebTestCase::getInfo() |
|
|
|
|
|
|
|
*/ |
|
|
|
public static function getInfo() { |
|
|
|
public static function getInfo() { |
|
|
|
return array( |
|
|
|
return array( |
|
|
|
'name' => 'Islandora Manage Permissions', |
|
|
|
'name' => 'Islandora Manage Permissions', |
|
|
@ -10,25 +20,29 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Prepares enviroment for testing. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see IslandoraWebTestCase::setUp() |
|
|
|
|
|
|
|
*/ |
|
|
|
public function setUp() { |
|
|
|
public function setUp() { |
|
|
|
parent::setUp(array('islandora')); |
|
|
|
parent::setUp(array('islandora')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Test manage permissions. |
|
|
|
|
|
|
|
*/ |
|
|
|
public function testManagePermissions() { |
|
|
|
public function testManagePermissions() { |
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS. |
|
|
|
|
|
|
|
// Create a user with permission. |
|
|
|
// permission FEDORA_VIEW_OBJECTS |
|
|
|
|
|
|
|
// create a user with permission |
|
|
|
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); |
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); |
|
|
|
// log the user in |
|
|
|
// Log the user in. |
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->assertNoLink('Manage', 'Manage tab is not on current page.'); |
|
|
|
$this->assertNoLink('Manage', 'Manage tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES. |
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES |
|
|
|
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES)); |
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES)); |
|
|
|
// log the user in |
|
|
|
|
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
@ -37,10 +51,8 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
$this->assertNoLink('Datastreams', 'Datastreams tab is not on current page.'); |
|
|
|
$this->assertNoLink('Datastreams', 'Datastreams tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS. |
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS |
|
|
|
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS)); |
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS)); |
|
|
|
// log the user in |
|
|
|
|
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
@ -49,10 +61,8 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT. |
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT |
|
|
|
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT)); |
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT)); |
|
|
|
// log the user in |
|
|
|
|
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
@ -61,10 +71,8 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_PURGE. |
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_PURGE |
|
|
|
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE)); |
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE)); |
|
|
|
// log the user in |
|
|
|
|
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->drupalLogin($user); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
@ -72,7 +80,5 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
$this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); |
|
|
|
$this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); |
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |