|
|
@ -1,4 +1,5 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
// $Id$ |
|
|
|
// $Id$ |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -28,9 +29,8 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { |
|
|
|
'purge objects and datastreams', |
|
|
|
'purge objects and datastreams', |
|
|
|
'view fedora collection')); |
|
|
|
'view fedora collection')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->repository_user = $repository_user; |
|
|
|
$this->drupalLogin($repository_user); |
|
|
|
$this->drupalLogin($repository_user); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -45,7 +45,6 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { |
|
|
|
|
|
|
|
|
|
|
|
$pid_list = array(); |
|
|
|
$pid_list = array(); |
|
|
|
// Create a collection for ingesting PDF content model objects. |
|
|
|
// Create a collection for ingesting PDF content model objects. |
|
|
|
|
|
|
|
|
|
|
|
//$this->drupalGet('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection'); |
|
|
|
//$this->drupalGet('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection'); |
|
|
|
$ingest_form = array(); |
|
|
|
$ingest_form = array(); |
|
|
|
$ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; |
|
|
|
$ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; |
|
|
@ -99,6 +98,27 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { |
|
|
|
$this->cleanUpRepository($pid_list); |
|
|
|
$this->cleanUpRepository($pid_list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testPidSpaceRestriction() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// give user full permissions |
|
|
|
|
|
|
|
$admin_tester = $this->drupalCreateUser(array('administer site configuration', 'view fedora collection')); |
|
|
|
|
|
|
|
$this->drupalLogin($admin_tester); |
|
|
|
|
|
|
|
//$adminRole = $this->drupalCreateRole(array('administer site configuration','view fedora collection')); |
|
|
|
|
|
|
|
$inVal['fedora_namespace_restriction_enforced'] = TRUE; |
|
|
|
|
|
|
|
$inVal['fedora_pids_allowed'] = 'simpletest:'; |
|
|
|
|
|
|
|
$this->drupalPost('admin/settings/fedora_repository', $inVal, 'Save configuration'); |
|
|
|
|
|
|
|
$this->assertPattern('/The configuration options have been saved./', 'The configuration options have been saved.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('fedora/repository/demo:SmileyStuff/'); |
|
|
|
|
|
|
|
$this->assertPattern('/Access denied/', 'No access to SmileyStuff Collection'); |
|
|
|
|
|
|
|
$inVal['fedora_namespace_restriction_enforced'] = 0; |
|
|
|
|
|
|
|
$this->drupalPost('admin/settings/fedora_repository', $inVal, 'Save configuration'); |
|
|
|
|
|
|
|
$this->assertPattern('/The configuration options have been saved./', 'The configuration options have been saved.'); |
|
|
|
|
|
|
|
$this->drupalLogin($this->repository_user); |
|
|
|
|
|
|
|
$this->drupalGet('fedora/repository/demo:SmileyStuff/'); |
|
|
|
|
|
|
|
$this->assertPattern('/Collection of Smiley Stuff/', 'Access to SmileyStuff Collection'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function cleanUpRepository($pid_list = array()) { |
|
|
|
private function cleanUpRepository($pid_list = array()) { |
|
|
|
$this->pass("This is the PID list to purge: " . implode(", ", $pid_list)); |
|
|
|
$this->pass("This is the PID list to purge: " . implode(", ", $pid_list)); |
|
|
|
foreach ($pid_list as $pid) { |
|
|
|
foreach ($pid_list as $pid) { |
|
|
@ -150,4 +170,29 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { |
|
|
|
$account->pass_raw = $edit['pass']; |
|
|
|
$account->pass_raw = $edit['pass']; |
|
|
|
return $account; |
|
|
|
return $account; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FedoraRepositoryClosedNameSpaceTestCase extends DrupalWebTestCase { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getInfo() { |
|
|
|
|
|
|
|
return array( |
|
|
|
|
|
|
|
'name' => 'Fedora Repository with closed name space', |
|
|
|
|
|
|
|
'description' => t('Fails if allow_open_namespace has been set to TRUE in settings.php.'), |
|
|
|
|
|
|
|
'group' => t('fedora repository'), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setUp() { |
|
|
|
|
|
|
|
parent::setUp('fedora_repository'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function testRestrictedNamePage() { |
|
|
|
|
|
|
|
$admin_tester = $this->drupalCreateUser(array('administer site configuration', 'view fedora collection')); |
|
|
|
|
|
|
|
$this->drupalLogin($admin_tester); |
|
|
|
|
|
|
|
$this->drupalGet('admin/settings/fedora_repository'); |
|
|
|
|
|
|
|
$this->assertNoText('Enforce namespace restrictions:'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |