fixed tests for newByDynamicClass and added a couple more for it

This commit is contained in:
Doug Bell 2008-01-25 17:47:03 +00:00
parent 62892460cf
commit 054534564b

View file

@ -144,7 +144,7 @@ $canViewMaker->prepare(
}, },
); );
plan tests => 86 plan tests => 88
+ scalar(@fixIdTests) + scalar(@fixIdTests)
+ scalar(@fixTitleTests) + scalar(@fixTitleTests)
+ 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle + 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle
@ -207,12 +207,23 @@ $deadAsset = WebGUI::Asset->newByDynamicClass($session, 'RoysNonExistantAssetId'
is ($deadAsset, undef,'newByDynamicClass constructor with invalid assetId returns undef'); is ($deadAsset, undef,'newByDynamicClass constructor with invalid assetId returns undef');
# -- no assetId # -- no assetId
{ is(
my $confession = ''; WebGUI::Asset->newByDynamicClass( $session ),
local $SIG{__DIE__} = sub { $confession = $_[0]; }; undef,
eval { WebGUI::Asset->newByDynamicClass($session); }; "newByDynamicClass constructor returns 'undef' with no assetId",
like($confession, qr/newByDynamicClass requires assetId/, 'newByDynamicClass constructor with no assetId confesses and dies'); );
}
# -- no session
is(
WebGUI::Asset->newByDynamicClass( ),
undef,
"newByDynamicClass constructor returns 'undef' with no valid WebGUI::Session",
);
is(
WebGUI::Asset->newByDynamicClass( "nothing" ),
undef,
"newByDynamicClass constructor returns 'undef' with no valid WebGUI::Session",
);
# Root Asset # Root Asset
isa_ok($rootAsset, 'WebGUI::Asset'); isa_ok($rootAsset, 'WebGUI::Asset');