From dc8cbd5fb265f81914e0b8bd26eb051fbe6d39af Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 26 Jan 2007 04:04:35 +0000 Subject: [PATCH] adding clipboard test, this will fail --- t/Asset/AssetClipboard.t | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 t/Asset/AssetClipboard.t diff --git a/t/Asset/AssetClipboard.t b/t/Asset/AssetClipboard.t new file mode 100644 index 000000000..4f98a2fb8 --- /dev/null +++ b/t/Asset/AssetClipboard.t @@ -0,0 +1,63 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2006 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use strict; +use lib "$FindBin::Bin/../lib"; + +##The goal of this test is to check the creation and purging of +##versions. + +use WebGUI::Test; +use WebGUI::Session; +use WebGUI::Utility; +use WebGUI::Asset; +use WebGUI::VersionTag; + +use Test::More; # increment this value for each test you create +plan tests => 5; + +my $session = WebGUI::Test->session; +$session->user({userId => 3}); +my $root = WebGUI::Asset->getRoot($session); +my $versionTag = WebGUI::VersionTag->getWorking($session); +$versionTag->set({name=>"Asset Clipboard test"}); + +my $snippet = $root->addChild({ + url => 'testSnippet', + title => 'snippet', + menuTitle => 'snippetMenuTitle', + className => 'WebGUI::Asset::Snippet', + snippet => 'A snippet of text', +}); + +my $snippetAssetId = $snippet->getId; + +$versionTag->commit; + +my $duplicatedSnippet = $snippet->duplicate; + +is($duplicatedSnippet->get('title'), 'snippet', 'duplicated snippet has correct title'); +is($duplicatedSnippet->getId, $snippetAssetId, 'duplicated snippet has correct id'); +is($snippet->getId, $snippetAssetId, 'original snippet has correct id'); + +is($snippet->getParent->getId, $root->getId, 'original snippet is a child of root'); +is($duplicatedSnippet->getParent->getId, $root->getId, 'duplicated snippet is also a child of root'); + +my $newVersionTag = WebGUI::VersionTag->getWorking($session); +$newVersionTag->commit; + +END { + foreach my $tag($versionTag, $newVersionTag) { + if (defined $tag and ref $tag eq 'WebGUI::VersionTag') { + $tag->rollback; + } + } +}