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 - fixed #10943: ThingyRecord JS Broken
- added Subscribable AssetAspect to Wiki - added Subscribable AssetAspect to Wiki
- fixed #10941: New user profile fields with unfortunate names - fixed #10941: New user profile fields with unfortunate names
- fixed #10955: Story Manager: unable to import packages
7.7.19 7.7.19
- fixed #10838: Forwarded forum post email to new CS adds reply to original thread - 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 $self = shift;
my ($properties) = @_; my ($properties) = @_;
##Allow subclassing ##Allow subclassing
if ($properties->{className} eq 'WebGUI::Asset::Wobject::Folder') {
return $self->SUPER::addChild(@_);
}
return undef unless $properties->{className} =~ /^WebGUI::Asset::Story/; return undef unless $properties->{className} =~ /^WebGUI::Asset::Story/;
my $todayFolder = $self->getFolder; my $todayFolder = $self->getFolder;
return undef unless $todayFolder; return undef unless $todayFolder;

View file

@ -63,7 +63,7 @@ $canPostMaker->prepare({
fail => [1, $reader ], fail => [1, $reader ],
}); });
my $tests = 48 my $tests = 50
+ $canPostMaker->plan + $canPostMaker->plan
; ;
plan tests => 1 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'}); my $child = $archive->addChild({className => 'WebGUI::Asset::Wobject::StoryTopic'});
is($child, undef, 'addChild: Will only add Stories'); 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); $child = $archive->addChild({className => 'WebGUI::Asset::Story', title => 'First Story'}, @skipAutoCommit);
my $tag1 = WebGUI::VersionTag->getWorking($session); my $tag1 = WebGUI::VersionTag->getWorking($session);
$tag1->commit; $tag1->commit;
WebGUI::Test->tagsToRollback($tag1); WebGUI::Test->tagsToRollback($tag1);
isa_ok($child, 'WebGUI::Asset::Story', 'addChild added and returned a Story'); 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(); my $folder = $archive->getFirstChild();
isa_ok($folder, 'WebGUI::Asset::Wobject::Folder', 'Folder was added to Archive'); isa_ok($folder, 'WebGUI::Asset::Wobject::Folder', '... Folder was added to Archive');
is($folder->getChildCount, 1, 'The folder has 1 child...'); is($folder->getChildCount, 1, '... The folder has 1 child...');
is($folder->getFirstChild->getTitle, 'First Story', '... and it is the correct child'); is($folder->getFirstChild->getTitle, 'First Story', '... and it is the correct child');
################################################################ ################################################################