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.
This commit is contained in:
Colin Kuskie 2008-01-05 04:05:37 +00:00
parent fc6fe216b0
commit 2eb1883345

View file

@ -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);