From fb54ca2a1c751dd509f01cdcda84268a8d110be0 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 1 Jan 2008 21:35:19 +0000 Subject: [PATCH] Coverage tests for assetExists. --- t/Asset/Asset.t | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index 958c5b011..4c167ab99 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -143,7 +143,7 @@ $canViewMaker->prepare( }, ); -plan tests => 71 +plan tests => 75 + scalar(@fixIdTests) + scalar(@fixTitleTests) + 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle @@ -586,6 +586,27 @@ else { $session->config->delete('assetUiLevel'); } +################################################################ +# +# assetExists +# +################################################################ + +{ + + my $id = $canViewAsset->getId; + my $class = 'WebGUI::Asset'; + my $date = $canViewAsset->get('revisionDate'); + + ok ( WebGUI::Asset->assetExists($session, $id, $class, $date), 'assetExists with proper class, id and revisionDate'); + ok (!WebGUI::Asset->assetExists($session, $id, 'WebGUI::Asset::Snippet', $date), 'assetExists with wrong class does not exist'); + my $id2 = $id; + ++$id2; + ok (!WebGUI::Asset->assetExists($session, $id2, $class, $date), 'assetExists with wrong id does not exist'); + ok (!WebGUI::Asset->assetExists($session, $id, $class, $date+1), 'assetExists with wrong revisionDate does not exist'); + +} + END: { $session->config->set('extrasURL', $origExtras); $session->config->set('uploadsURL', $origUploads);