From 2eb1883345978f9d9818c2fd31dacde871ab5b0b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 5 Jan 2008 04:05:37 +0000 Subject: [PATCH] Add a stub test for newByDynamicUrl, that really should have been a stub test for update. Add tests for getNotFound, testing what is returned for both a page and a Snippet. --- t/Asset/Asset.t | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index 53d7ad9e1..5f110e8f5 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -144,7 +144,7 @@ $canViewMaker->prepare( }, ); -plan tests => 81 +plan tests => 85 + scalar(@fixIdTests) + scalar(@fixTitleTests) + 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle @@ -328,6 +328,8 @@ my $properties2 = { }; my $fixTitleAsset = $defaultAsset->addChild($properties2, $properties2->{id}); +##Commit this asset right away +$fixTitleAsset->commit; $properties2 = { # '1234567890123456789012' @@ -338,10 +340,10 @@ $properties2 = { }; my $getTitleAsset = $defaultAsset->addChild($properties2, $properties2->{id}); +$getTitleAsset->commit; $versionTag->commit; - my $origUrlExtension = $session->setting->get('urlExtension'); $session->setting->set('urlExtension', undef); @@ -640,6 +642,16 @@ TODO: { ok(0, 'Validate form output'); } +################################################################ +# +# newByDynamicClass +# +################################################################ + +my $newFixTitleAsset = WebGUI::Asset->newByDynamicClass($session, $fixTitleAsset->getId); +isnt($newFixTitleAsset, undef, 'newByDynamicClass did not fail'); +isa_ok($newFixTitleAsset, 'WebGUI::Asset', 'newByDynamicClass: able to look up an existing asset by id'); + ################################################################ # # getNotFound @@ -648,7 +660,13 @@ TODO: { my $origNotFoundPage = $session->setting->get('notFoundPage'); +$session->setting->set('notFoundPage', WebGUI::Asset->getDefault($session)->getId); + isa_ok(WebGUI::Asset->getNotFound($session), 'WebGUI::Asset', 'getNotFound: Returns an asset'); +is(WebGUI::Asset->getNotFound($session)->getId, WebGUI::Asset->getDefault($session)->getId, 'getNotFound: Returns the correct asset'); + +$session->setting->set('notFoundPage', $fixTitleAsset->getId); +is(WebGUI::Asset->getNotFound($session)->getId, $fixTitleAsset->getId, 'getNotFound: Returns the correct asset on a different asset'); $session->setting->set('notFoundPage', $origNotFoundPage);