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

@ -20,6 +20,7 @@
- fixed #12001: Shelf product import mangles price
- fixed #11945: Slow SQL access for duplicate e-mail address lookups
- fixed #11960: Billing address mandatory fields not specified
- fixed #11975: Cannot paste threads: "Cannot call method isa()"
7.10.6
- fixed #11974: Toolbar icons unclickable in Webkit using HTML5

View file

@ -317,6 +317,7 @@ sub pasteInFork {
my ( $process, $args ) = @_;
my $session = $process->session;
my $self = WebGUI::Asset->new( $session, $args->{assetId} );
$session->asset( $self );
my @roots = grep { $_ && $_->canEdit }
map { WebGUI::Asset->newPending( $session, $_ ) } @{ $args->{list} };

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' );