From e71a119faa6974fff90196139396a5176bc44086 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Mar 2009 05:38:09 +0000 Subject: [PATCH] Add stub tests for Account::Inbox with custom canView tests. --- t/Account.t | 1 + t/lib/Test/WebGUI/Account/Inbox.pm | 43 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 t/lib/Test/WebGUI/Account/Inbox.pm diff --git a/t/Account.t b/t/Account.t index 944ad6011..96399fe36 100644 --- a/t/Account.t +++ b/t/Account.t @@ -2,6 +2,7 @@ use FindBin; use lib "$FindBin::Bin/lib"; use Test::WebGUI::Account; use Test::WebGUI::Account::Friends; +use Test::WebGUI::Account::Inbox; use Test::WebGUI::Account::Contributions; use Test::WebGUI::Account::User; diff --git a/t/lib/Test/WebGUI/Account/Inbox.pm b/t/lib/Test/WebGUI/Account/Inbox.pm new file mode 100644 index 000000000..0e4cdea8b --- /dev/null +++ b/t/lib/Test/WebGUI/Account/Inbox.pm @@ -0,0 +1,43 @@ +# vim:syntax=perl +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2009 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 +#------------------------------------------------------------------ + +# This tests the operation of WebGUI::Account modules. You can use +# as a base to test your own modules. + +package Test::WebGUI::Account::Inbox; + +use FindBin; +use strict; +use lib "$FindBin::Bin/lib"; +use base 'Test::WebGUI::Account'; +use Test::More; +use Test::Exception; +use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::Session; + +sub class { + return 'WebGUI::Account::Inbox'; +} + +sub canView : Test(2) { + my $test = shift; + my $session = $test->{_session}; + my $class = $test->class; + my $account = $class->new($session); + $account->uid(3); + ok(! $account->canView, 'canView is 0 if uid is set, for any userId'); + $account->uid(''); + ok( $account->canView, 'canView is 0 if uid is empty string'); +} + +1; + +#vim:ft=perl