adding clipboard test, this will fail

This commit is contained in:
Colin Kuskie 2007-01-26 04:04:35 +00:00
parent 528d9af4f6
commit dc8cbd5fb2

63
t/Asset/AssetClipboard.t Normal file
View file

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