diff --git a/t/Asset/Snippet.t b/t/Asset/Snippet.t new file mode 100644 index 000000000..0bbcd13f9 --- /dev/null +++ b/t/Asset/Snippet.t @@ -0,0 +1,57 @@ +#------------------------------------------------------------------- +# 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 test the creation of Snippet Assets. + +use WebGUI::Test; +use WebGUI::Session; +use Test::More tests => 10; # increment this value for each test you create +use WebGUI::Asset::Snippet; + +my $session = WebGUI::Test->session; +my $node = WebGUI::Asset->getImportNode($session); +my $versionTag = WebGUI::VersionTag->getWorking($session); +$versionTag->set({name=>"Snippet Test"}); +my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet'}); + +# Test for a sane object type +isa_ok($snippet, 'WebGUI::Asset::Snippet'); + +# Test to see if we can set values +my $properties = { + cacheTimeout => 124, + processAsTemplate => 1, + mimeType => 'text/plain', + snippet => "Gooey's milkshake brings all the girls to the yard...", +}; +$snippet->update($properties); + +foreach my $property (keys %{$properties}) { + is ($snippet->get($property), $properties->{$property}, "updated $property is ".$properties->{$property}); +} + +TODO: { + local $TODO = "Tests to make later"; + ok(0, 'Test getToolbar method'); + ok(0, 'Test indexContent method'); + ok(0, 'Test view method'); + ok(0, 'Test www_edit method'); + ok(0, 'Test www_view method... maybe?'); +} + +END { + # Clean up after thy self + $versionTag->rollback($versionTag->getId); +} + diff --git a/t/Asset/Wobject/Article.t b/t/Asset/Wobject/Article.t index 4d91b8e6e..e1d80b141 100644 --- a/t/Asset/Wobject/Article.t +++ b/t/Asset/Wobject/Article.t @@ -103,6 +103,7 @@ is ($duplicateFilename, undef, 'purge method deletes collateral'); # Lets make sure the view method returns something. # This is not a very good test but I need to do it to test the purgeCache method anyways =) +$article->prepareView; my $output = $article->view; isnt ($output, "", 'view method returns something'); @@ -112,6 +113,7 @@ is ($output, $cachedOutput, 'view method caches output'); # Lets see if the purgeCache method works $article->purgeCache; +$cachedOutput = WebGUI::Cache->new($session, 'view_'.$article->getId)->get; # Check cache post purge isnt ($output, $cachedOutput, 'purgeCache method deletes cache'); @@ -127,6 +129,6 @@ TODO: { END { # Clean up after thy self - #$versionTag->rollback($versionTag->getId); + $versionTag->rollback($versionTag->getId); }