Provide a way for tests to purge assets with all their (hidden and unreachable)
version tags. Fix Survey.t that was leaking versionTags.
This commit is contained in:
parent
c671e94056
commit
838ae00af5
2 changed files with 35 additions and 20 deletions
|
|
@ -57,6 +57,7 @@ our $logger_error;
|
|||
my %originalConfig;
|
||||
my $originalSetting;
|
||||
|
||||
my @assetsToPurge;
|
||||
my @groupsToDelete;
|
||||
my @usersToDelete;
|
||||
my @sessionsToDelete;
|
||||
|
|
@ -172,7 +173,7 @@ END {
|
|||
my $newUser = WebGUI::User->new($SESSION, $userId);
|
||||
$newUser->delete if $newUser;
|
||||
}
|
||||
foreach my $stor (@storagesToDelete) {
|
||||
STORAGE: foreach my $stor (@storagesToDelete) {
|
||||
if ($SESSION->id->valid($stor)) {
|
||||
my $storage = WebGUI::Storage->get($SESSION, $stor);
|
||||
$storage->delete if $storage;
|
||||
|
|
@ -207,6 +208,9 @@ END {
|
|||
|
||||
$workflow->delete;
|
||||
}
|
||||
ASSET: foreach my $asset (@assetsToPurge) {
|
||||
$asset->purge;
|
||||
}
|
||||
if ($ENV{WEBGUI_TEST_DEBUG}) {
|
||||
$Test->diag('Sessions : '.$SESSION->db->quickScalar('select count(*) from userSession'));
|
||||
$Test->diag('Scratch : '.$SESSION->db->quickScalar('select count(*) from userSessionScratch'));
|
||||
|
|
@ -502,6 +506,23 @@ sub originalConfig {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 assetsToPurge ( $asset, [$asset ] )
|
||||
|
||||
Push a list of Asset objects onto the stack of assets to be automatically purged
|
||||
at the end of the test. This will also clean-up all version tags associated
|
||||
with the Asset.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub assetsToPurge {
|
||||
my $class = shift;
|
||||
push @assetsToPurge, @_;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 groupsToDelete ( $group, [$group ] )
|
||||
|
||||
Push a list of group objects onto the stack of groups to be automatically deleted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue