testing for all upgrade script subs

This commit is contained in:
Graham Knop 2010-03-20 13:01:50 -05:00
parent 15ed4f97e4
commit 94baba20fc
28 changed files with 226 additions and 81 deletions

View file

@ -0,0 +1,7 @@
my $c = collateral;
::isa_ok $c, 'Path::Class::Dir';
::ok -e $c->file('collateral.txt'), 'correct collateral path used';

View file

@ -0,0 +1 @@
collateral file

View file

@ -0,0 +1,2 @@
::is config->getFilename, $::configFile, 'config function works correctly';

View file

@ -0,0 +1,3 @@
my $totalAssets = dbh->selectrow_array('SELECT COUNT(*) FROM asset');
::is $totalAssets, $::totalAssets, 'dbh function working correctly';

View file

@ -0,0 +1,11 @@
::addToCleanup(version_tag);
import_package('test-template.wgpkg');
my $assets = version_tag->getAssets;
::is scalar @$assets, 1, 'imported one asset with package';
::isa_ok $assets->[0], 'WebGUI::Asset::Template';

View file

@ -0,0 +1,2 @@
rm_lib 'WebGUI::Upgrade::Test::Module';

View file

@ -0,0 +1,7 @@
my $s = session;
::isa_ok $s, 'WebGUI::Session';
::is $s, session, 'session properly cached';
::is $s->user->getId, 3, 'admin user set for session';
$s->getId;

Binary file not shown.

View file

@ -0,0 +1,12 @@
use WebGUI::Asset;
use WebGUI::Asset::Snippet;
WebGUI::Asset->getRoot(session)->addChild({
className => 'WebGUI::Asset::Snippet',
title => 'Test snippet',
});
my $vt = WebGUI::VersionTag->getWorking(session, 'nocreate');
if ($vt) {
::addToCleanup($vt);
}
$vt;

View file

@ -0,0 +1,15 @@
my $vt = version_tag;
::addToCleanup($vt);
::isa_ok $vt, 'WebGUI::VersionTag';
::is $vt->get('name'), 'Upgrade to 8.3.0 - versiontag', 'auto-naming with short name works';
::is $vt, version_tag, 'second call gives same version tag';
::ok ! $vt->get('isCommitted'), '... and doesn\'t commit version tag';
my $vt2 = version_tag 'Adding This Stuff';
::addToCleanup($vt);
::ok $vt->get('isCommitted'), 'Request for new version tag commits previous tag';
::is $vt2->get('name'), 'Upgrade to 8.3.0 - Adding This Stuff', 'explicit name used correctly';

View file

@ -1,2 +0,0 @@
print config->getFilename;

View file

@ -1,3 +0,0 @@
my ($totalAssets) = dbh->selectrow_array('SELECT COUNT(*) FROM asset');
print $totalAssets;

View file

@ -1,2 +0,0 @@
print session->getId;