diff --git a/t/Storage.t b/t/Storage.t new file mode 100644 index 000000000..5188a1072 --- /dev/null +++ b/t/Storage.t @@ -0,0 +1,47 @@ +#------------------------------------------------------------------- +# 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"; + +use WebGUI::Test; +use WebGUI::Session; +use WebGUI::Storage; + +use Test::More; + +plan tests => 6; # increment this value for each test you create + +my $session = WebGUI::Test->session; + +my $uploadDir = $session->config->get('uploadsPath'); + +ok ($uploadDir, "uploadDir defined in config"); + +ok ((-e $uploadDir and -d $uploadDir), "uploadDir exists and is a directory"); + +my $storage1 = WebGUI::Storage->get($session); + +is( $storage1, undef, "get requires id to be passed"); + +$storage1 = WebGUI::Storage->get($session, 'foobar'); + +is( ref $storage1, "WebGUI::Storage", "storage will accept non GUID arguments"); + +is( $storage1->getErrorCount, 0, "No errors during path creation"); + +my $storageDir1 = join '/', $uploadDir, 'fo', 'ob', 'foobar'; + +ok( (-e $storageDir1 and -d $storageDir1), "Storage location created and is a directory"); + +END { + ref $storage1 eq "WebGUI::Storage" and $storage1->delete; +}