Skip to content

Commit

Permalink
Yet more END block cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jun 15, 2010
1 parent 9bc7208 commit fecc2be
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 69 deletions.
8 changes: 2 additions & 6 deletions t/Asset/Wobject/Gallery/00base.t
Expand Up @@ -25,6 +25,7 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Gallery Test"});
WebGUI::Test->addToCleanup($versionTag);

#----------------------------------------------------------------------------
# Tests
Expand Down Expand Up @@ -66,9 +67,4 @@ is(
"Gallery no longer able to be instanciated",
);


#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
7 changes: 2 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/00base.t
Expand Up @@ -25,6 +25,7 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Album Test"});
WebGUI::Test->addToCleanup($versionTag);
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
Expand Down Expand Up @@ -72,8 +73,4 @@ is(
);


#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
7 changes: 2 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/ajax.t
Expand Up @@ -24,6 +24,7 @@ use Test::More;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);

my %user;
$user{'1'} = WebGUI::User->new( $session, "new" );
Expand Down Expand Up @@ -257,8 +258,4 @@ sub callAjaxService {
return decode_json( $album->www_ajax() );
}

#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
7 changes: 2 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/delete.t
Expand Up @@ -28,6 +28,7 @@ $session->user({ userId => 3 });
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Album Test"});
WebGUI::Test->addToCleanup($versionTag);
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
Expand Down Expand Up @@ -102,8 +103,4 @@ is(
);


#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
7 changes: 2 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/navigation.t
Expand Up @@ -23,6 +23,7 @@ use Test::More;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);

$versionTag->set({name=>"Album Test"});

Expand Down Expand Up @@ -99,8 +100,4 @@ is( $album->getNextFileId(''), undef, 'Return undef if empty string specified');
is( $album->getNextFileId('123456'), undef, 'Return undef if non-existing id specified');
is( $album->getNextFileId($album->getId), undef, 'Return undef if non-child id specified');

#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
7 changes: 2 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/slideshow.t
Expand Up @@ -61,6 +61,7 @@ for my $i ( 0 .. 5 ) {
}

$versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);

#----------------------------------------------------------------------------
# Tests
Expand All @@ -78,8 +79,4 @@ TODO: {
# Test www_slideshow


#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
7 changes: 2 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/thumbnails.t
Expand Up @@ -26,6 +26,7 @@ my $maker = WebGUI::Test::Maker::HTML->new;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);
$versionTag->set({name=>"Album Test"});
my $gallery
= $node->addChild({
Expand Down Expand Up @@ -77,8 +78,4 @@ TODO: {
#----------------------------------------------------------------------------
# Test www_thumbnails

#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#vim:ft=perl
8 changes: 3 additions & 5 deletions t/Asset/Wobject/GalleryAlbum/view.t
Expand Up @@ -27,6 +27,7 @@ my $maker = WebGUI::Test::Maker::HTML->new;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);
$versionTag->set({name=>"Album Test"});
my $gallery
= $node->addChild({
Expand Down Expand Up @@ -150,8 +151,5 @@ SKIP: {
});
$maker->run;
}
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}

#vim:ft=perl
24 changes: 6 additions & 18 deletions t/Asset/Wobject/Survey/Reports.t
Expand Up @@ -26,22 +26,19 @@ plan tests => $tests + 1;
# put your tests here

my $usedOk = use_ok('WebGUI::Asset::Wobject::Survey');
my ($survey);

# Returns the contents of the Survey_tempReport table
sub getAll { $session->db->buildArrayRefOfHashRefs('select * from Survey_tempReport where assetId = ?', [$survey->getId]) }

SKIP: {

skip $tests, "Unable to load Survey" unless $usedOk;
my $user = WebGUI::User->new( $session, 'new' );
WebGUI::Test->addToCleanup($user);
my $import_node = WebGUI::Asset->getImportNode($session);

# Create a Survey
$survey = $import_node->addChild( { className => 'WebGUI::Asset::Wobject::Survey', } );
my $survey = $import_node->addChild( { className => 'WebGUI::Asset::Wobject::Survey', } );
WebGUI::Test->addToCleanup($survey);
isa_ok($survey, 'WebGUI::Asset::Wobject::Survey');

# Returns the contents of the Survey_tempReport table
sub getAll { $session->db->buildArrayRefOfHashRefs('select * from Survey_tempReport where assetId = ?', [$survey->getId]) }

my $sJSON = $survey->surveyJSON;

# Load bare-bones survey, containing a single section (S0)
Expand Down Expand Up @@ -128,14 +125,5 @@ superhashof({
value => 20, # e.g. score
})]);

}


#----------------------------------------------------------------------------
# Cleanup
END {
$survey->purge() if $survey;

my $versionTag = WebGUI::VersionTag->getWorking( $session, 1 );
$versionTag->rollback() if $versionTag;
}
#vim:ft=perl
7 changes: 3 additions & 4 deletions t/PassiveProfiling.t
Expand Up @@ -31,6 +31,8 @@ plan tests => 1 + $numTests;
my $loaded = use_ok('WebGUI::PassiveProfiling');

my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup(SQL => ['delete from passiveProfileLog where dateOfEntry >= ?', $startingTime-1]);
WebGUI::Test->addToCleanup($versionTag);
my $home = WebGUI::Asset->getDefault($session);

my $pageProperties = {
Expand Down Expand Up @@ -120,7 +122,4 @@ cmp_bag(

}

END {
$session->db->write('delete from passiveProfileLog where dateOfEntry >= ?',[$startingTime-1]);
$versionTag->rollback;
}
#vim:ft=perl
12 changes: 6 additions & 6 deletions t/Workflow/Activity/BucketPassiveAnalytics.t
Expand Up @@ -17,6 +17,9 @@ plan tests => 1; # increment this value for each test you create
my $session = WebGUI::Test->session;
$session->user({userId => 3});

WebGUI::Test->addToCleanup(SQL => 'delete from passiveLog');
WebGUI::Test->addToCleanup(SQL => 'delete from analyticRule');

my $workflow = WebGUI::Workflow->new($session, 'PassiveAnalytics000001');
my $activities = $workflow->getActivities();
##Note, they're in order, and the order is known.
Expand All @@ -30,6 +33,7 @@ my $instance = WebGUI::Workflow::Instance->create($session,
priority => 1,
}
);
WebGUI::Test->addToCleanup($instance);
##Rule label, url, and regexp
my @ruleSets = (
['home', '/home', '^\/home' ],
Expand Down Expand Up @@ -76,12 +80,6 @@ PAUSE: while (my $retval = $instance->run()) {

ok(1, 'One test');

END {
$session->db->write('delete from passiveLog');
$session->db->write('delete from analyticRule');
$instance->delete;
}

sub loadLogData {
my ($session, @urls) = @_;
$session->db->write('delete from passiveLog');
Expand All @@ -99,3 +97,5 @@ sub loadLogData {
$startTime += int(rand(10))+1;
}
}

#vim:ft=perl

0 comments on commit fecc2be

Please sign in to comment.