From 9db04300321e7e4822ec8ffdca4ebda7299afe73 Mon Sep 17 00:00:00 2001 From: Chris Nehren Date: Wed, 7 Nov 2007 22:29:21 +0000 Subject: [PATCH] Fix the groupToEditPost field defaulting to the groupIdEdit field. Make sure that the added collab system in the test has a parent asset as well, to ensure that the inheritance works properly. --- lib/WebGUI/Asset/Wobject/Collaboration.pm | 2 +- t/Asset/Wobject/Collaboration.t | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 9ba7b385b..396f67877 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -742,7 +742,7 @@ sub definition { uiLevel=>6, fieldType=>'group', filter=>'fixId', - defaultValue=>'4' + defaultValue=>$session->asset->get('groupIdEdit') || '4', }, ); diff --git a/t/Asset/Wobject/Collaboration.t b/t/Asset/Wobject/Collaboration.t index 4db02a3ac..830c151a4 100755 --- a/t/Asset/Wobject/Collaboration.t +++ b/t/Asset/Wobject/Collaboration.t @@ -30,15 +30,27 @@ use WebGUI::User; use WebGUI::Group; use WebGUI::Asset::Wobject::Collaboration; use WebGUI::Asset::Post; +use WebGUI::Asset::Wobject::Layout; use Data::Dumper; -use Test::More tests => 3; # increment this value for each test you create +use Test::More tests => 4; # increment this value for each test you create my $session = WebGUI::Test->session; # Do our work in the import node my $node = WebGUI::Asset->getImportNode($session); -my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', editTimeout => '1'}); +# grab a named version tag +my $versionTag = WebGUI::VersionTag->getWorking($session); +$versionTag->set({name => 'Collaboration => groupToEditPost test'}); + +# place the collab system under a layout to ensure we're using the inherited groupIdEdit value +my $layout = $node->addChild({className => 'WebGUI::Asset::Wobject::Layout'}); + +# set the layout as the current asset for the same reason +$session->asset($layout); + +# finally, add the collab +my $collab = $layout->addChild({className => 'WebGUI::Asset::Wobject::Collaboration'}); # Test for a sane object type isa_ok($collab, 'WebGUI::Asset::Wobject::Collaboration'); @@ -56,6 +68,5 @@ TODO: { END { # Clean up after thyself - $collab->purge(); + $versionTag->rollback(); } -# vim: syntax=perl filetype=perl