From 054534564be99ff4b964c7acdf3b2a96de66ad58 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Fri, 25 Jan 2008 17:47:03 +0000 Subject: [PATCH] fixed tests for newByDynamicClass and added a couple more for it --- t/Asset/Asset.t | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index aaf53af32..9be7a0125 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -144,7 +144,7 @@ $canViewMaker->prepare( }, ); -plan tests => 86 +plan tests => 88 + scalar(@fixIdTests) + scalar(@fixTitleTests) + 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'); # -- no assetId -{ - my $confession = ''; - local $SIG{__DIE__} = sub { $confession = $_[0]; }; - eval { WebGUI::Asset->newByDynamicClass($session); }; - like($confession, qr/newByDynamicClass requires assetId/, 'newByDynamicClass constructor with no assetId confesses and dies'); -} +is( + WebGUI::Asset->newByDynamicClass( $session ), + undef, + "newByDynamicClass constructor returns 'undef' with no assetId", +); + +# -- 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 isa_ok($rootAsset, 'WebGUI::Asset');