Fix import Story Archive packages with sub-stories.

This commit is contained in:
Colin Kuskie 2009-09-10 08:34:30 -07:00
parent f5b2b6d4cd
commit 021b7f8fed
3 changed files with 16 additions and 4 deletions

View file

@ -31,6 +31,7 @@
- fixed #10943: ThingyRecord JS Broken
- added Subscribable AssetAspect to Wiki
- fixed #10941: New user profile fields with unfortunate names
- fixed #10955: Story Manager: unable to import packages
7.7.19
- fixed #10838: Forwarded forum post email to new CS adds reply to original thread

View file

@ -41,6 +41,9 @@ sub addChild {
my $self = shift;
my ($properties) = @_;
##Allow subclassing
if ($properties->{className} eq 'WebGUI::Asset::Wobject::Folder') {
return $self->SUPER::addChild(@_);
}
return undef unless $properties->{className} =~ /^WebGUI::Asset::Story/;
my $todayFolder = $self->getFolder;
return undef unless $todayFolder;

View file

@ -63,7 +63,7 @@ $canPostMaker->prepare({
fail => [1, $reader ],
});
my $tests = 48
my $tests = 50
+ $canPostMaker->plan
;
plan tests => 1
@ -161,15 +161,23 @@ is($archive->getChildCount, 0, 'leaving with an empty archive');
my $child = $archive->addChild({className => 'WebGUI::Asset::Wobject::StoryTopic'});
is($child, undef, 'addChild: Will only add Stories');
$child = $archive->addChild({className => 'WebGUI::Asset::Snippet'});
is($child, undef, '... will not add snippets');
$child = $archive->addChild({className => 'WebGUI::Asset::Wobject::Folder'});
isa_ok($child, 'WebGUI::Asset::Wobject::Folder', '... will add folders, so importing a package works');
$child->purge;
$child = $archive->addChild({className => 'WebGUI::Asset::Story', title => 'First Story'}, @skipAutoCommit);
my $tag1 = WebGUI::VersionTag->getWorking($session);
$tag1->commit;
WebGUI::Test->tagsToRollback($tag1);
isa_ok($child, 'WebGUI::Asset::Story', 'addChild added and returned a Story');
is($archive->getChildCount, 1, 'addChild: added it to the archive');
is($archive->getChildCount, 1, '... added it to the archive');
my $folder = $archive->getFirstChild();
isa_ok($folder, 'WebGUI::Asset::Wobject::Folder', 'Folder was added to Archive');
is($folder->getChildCount, 1, 'The folder has 1 child...');
isa_ok($folder, 'WebGUI::Asset::Wobject::Folder', '... Folder was added to Archive');
is($folder->getChildCount, 1, '... The folder has 1 child...');
is($folder->getFirstChild->getTitle, 'First Story', '... and it is the correct child');
################################################################