Browse Source

Merge pull request #454 from qadan/7.x

toggle switch for automatic deletion
pull/455/merge
Nigel Banks 11 years ago
parent
commit
55700f8272
  1. 15
      tests/islandora_web_test_case.inc

15
tests/islandora_web_test_case.inc

@ -14,6 +14,11 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
*/
protected $users = array();
/**
* By default, deleteUserCreatedObjects() runs on each tearDown() step.
*/
protected $deleteObjectsOnTeardown = TRUE;
/**
* Sets up the Drupal filter to access this test Drupal instances database.
*
@ -160,12 +165,18 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
/**
* Restores the original Drupal filter, frees any allocated resources.
*
* To safeguard against leaving test objects in the repository, tearDown()
* calls deleteUserCreatedObjects() every time by default. This feature can be
* toggled by setting $this->deleteObjectsOnTeardown to TRUE or FALSE.
*
* @see DrupalWebTestCase::tearDown()
*/
public function tearDown() {
if ($this->deleteObjectsOnTeardown) {
foreach ($this->users as $user) {
$this->deleteUserCreatedObjects($user);
}
}
if ($this->configuration['use_drupal_filter']) {
$this->restoreDrupalFilter();
}
@ -397,6 +408,10 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
/**
* Deletes all objects created by the given user.
*
* To safeguard against leaving test objects in the repository, this is called
* each time DrupalTestCase::run() calls tearDown(). This feature can be
* toggled by setting $this->deleteObjectsOnTeardown to TRUE or FALSE.
*
* @param object $username
* The user whose objects we'd like to remove.
*

Loading…
Cancel
Save