fix 11975 cannot paste threads: Cannot call method isa()

This commit is contained in:
Doug Bell 2011-01-03 20:36:08 -06:00
parent 78a4c1295a
commit 93525126a4
3 changed files with 36 additions and 1 deletions

View file

@ -21,9 +21,11 @@ use WebGUI::Utility;
use WebGUI::Asset;
use WebGUI::VersionTag;
use Test::MockObject;
use Test::MockObject::Extends;
use WebGUI::Fork;
use Test::More; # increment this value for each test you create
plan tests => 29;
plan tests => 30;
my $session = WebGUI::Test->session;
$session->user({userId => 3});
@ -200,3 +202,34 @@ $shortcut->publish;
$page->cut;
is $shortcut->paste($page->getId), 0, 'cannot paste below shortcuts';
####################################################
#
# pasteInFork
#
####################################################
$session->user({ userId => "3" });
my $process = Test::MockObject::Extends->new( 'WebGUI::Fork' );
$process->mock( "update" => sub { } ); # do nothing on update. we don't care
$process->mock( "session" => sub { return $session } );
# Try with a Collaboration and some Threads
my $tag = WebGUI::VersionTag->getWorking( $session );
my $collab = $tempspace->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
groupIdEdit => "3",
status => "pending",
tagId => $tag->getId,
});
my $thread = $collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
groupIdEdit => "3",
status => "pending",
tagId => $tag->getId,
}, undef, undef, { skipAutoCommitWorkflows => 1 });
$tag->commit;
$thread->cut;
WebGUI::Asset::pasteInFork( $process, { assetId => $collab->getId, list => [ $thread->getId ] } );
$thread = $thread->cloneFromDb;
is( $thread->get('state'), 'published', 'thread is pasted' );