Add tests for Article->getStorageLocation, call addToCleanup by classname.

This commit is contained in:
Colin Kuskie 2010-04-06 19:27:38 -07:00
parent ce39ad6a14
commit 45b6f45e4b
2 changed files with 14 additions and 4 deletions

View file

@ -40,7 +40,7 @@ sub getMyParents {
my $new_parent = $parent->addChild({className => $parent_class}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
push @parents, $new_parent;
$parent = $new_parent;
addToCleanup($new_parent);
WebGUI::Test->addToCleanup($new_parent);
}
return @parents;
}
@ -200,9 +200,9 @@ sub keywords : Test(3) {
my $asset = $parents[-1]->addChild({
className => $test->class,
}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
addToCleanup($asset);
WebGUI::Test->addToCleanup($asset);
$tag->commit;
addToCleanup($tag);
WebGUI::Test->addToCleanup($tag);
can_ok $asset, 'keywords';
$asset->keywords('chess set');
is $asset->keywords, 'chess set', 'set and get of keywords via direct accessor';
@ -272,7 +272,7 @@ sub addRevision : Test(6) {
is $revAsset->tagId, $tag->getId, 'tagId is current working tagId';
my $count = $session->db->quickScalar('SELECT COUNT(*) from assetData where assetId=?',[$testId2]);
is $count, 2, 'two records in the database';
addToCleanup($tag);
WebGUI::Test->addToCleanup($tag);
$session->db->write("delete from asset where assetId like 'wg8TestAsset00000%'");
$session->db->write("delete from assetData where assetId like 'wg8TestAsset00000%'");

View file

@ -21,4 +21,14 @@ sub list_of_tables {
return [qw/assetData wobject Article/];
}
sub getStorageLocation : Test(2) {
my $test = shift;
my $session = $test->session;
my $asset = $test->class->new({session => $session});
my $storage = $asset->getStorageLocation();
isa_ok $storage, 'WebGUI::Storage';
is $asset->storageId, $storage->getId, 'asset updated with storageId';
WebGUI::Test->addToCleanup($storage);
}
1;