From bc88cb31836c8938903aa6abd225582464b3a760 Mon Sep 17 00:00:00 2001 From: Yung Han Khoe Date: Mon, 19 May 2008 19:51:58 +0000 Subject: [PATCH] Adding basic UserList tests --- t/Asset/Wobject/UserList.t | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 t/Asset/Wobject/UserList.t diff --git a/t/Asset/Wobject/UserList.t b/t/Asset/Wobject/UserList.t new file mode 100644 index 000000000..f903d5a7e --- /dev/null +++ b/t/Asset/Wobject/UserList.t @@ -0,0 +1,52 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2008 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use strict; +use File::Spec; +use lib "$FindBin::Bin/../../lib"; + +##The goal of this test is to test the creation of UserList Wobjects. + +use WebGUI::Test; +use WebGUI::Session; +use Test::More tests => 5; # increment this value for each test you create +use WebGUI::Asset::Wobject::UserList; + +my $session = WebGUI::Test->session; + +# Do our work in the import node +my $node = WebGUI::Asset->getImportNode($session); + +my $versionTag = WebGUI::VersionTag->getWorking($session); +$versionTag->set({name=>"UserList Test"}); +my $userList = $node->addChild({className=>'WebGUI::Asset::Wobject::UserList'}); + +# Test for a sane object type +isa_ok($userList, 'WebGUI::Asset::Wobject::UserList'); + +# Test to see if we can set new values +my $newUserListSettings = { + usersPerPage => 124, + showGroupId => 7, + hideGroupId => 3, + alphabet => 'a,b,c', +}; +$userList->update($newUserListSettings); + +foreach my $newSetting (keys %{$newUserListSettings}) { + is ($userList->get($newSetting), $newUserListSettings->{$newSetting}, "updated $newSetting is ".$newUserListSettings->{$newSetting}); +} + +END { + # Clean up after thy self + $versionTag->rollback(); +} +