Browse Source

toggle switch for automatic deletion

pull/454/head
qadan 11 years ago
parent
commit
a9114630ac
  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 $delete_objects_on_teardown = 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->delete_objects_on_teardown to TRUE or FALSE.
*
* @see DrupalWebTestCase::tearDown()
*/
public function tearDown() {
if ($this->delete_objects_on_teardown) {
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->delete_objects_on_teardown to TRUE or FALSE.
*
* @param object $username
* The user whose objects we'd like to remove.
*

Loading…
Cancel
Save