From 2798c84d3133640a641b0b747cd9130114c1bbf4 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 24 May 2006 22:47:40 +0000 Subject: [PATCH] add tests for create and getFileSize --- t/Storage.t | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/t/Storage.t b/t/Storage.t index abe9559c5..98274917f 100644 --- a/t/Storage.t +++ b/t/Storage.t @@ -19,7 +19,7 @@ use WebGUI::Storage; use Test::More; -plan tests => 22; # increment this value for each test you create +plan tests => 26; # increment this value for each test you create my $session = WebGUI::Test->session; @@ -93,11 +93,35 @@ SKIP: { ok(!(-e $dir3 and -d $dir3), 'No directories created for short guid'); } +undef $storage3; + +$storage1 = WebGUI::Storage->create($session); + +is( ref $storage1, "WebGUI::Storage", "create returns a WebGUI Storage object"); + +is( $storage1->getErrorCount, 0, "No errors during object creation"); + +ok ((-e $storage1->getPath and -d $storage1->getPath), 'directory created correctly'); + +my $content = <addFileFromScalar('content', $content); + +is ($filename, 'content', 'processed filename returned by addFileFromScalar'); + +my $filePath = $storage1->getPath($filename); + +ok ((-e $filePath and -T $filePath), 'file was created as a text file'); + +is (-s $filePath, length $content, 'file is the right size'); + +is ($storage1->getFileSize($filename), length $content, 'getFileSize returns correct size'); + TODO: { local $TODO = "Tests to make later"; - ok(0, 'Create object with 1 character GUID'); - ok(0, 'Add a file to the storage location via addFileFromScalar'); - ok(0, 'getSize works correctly'); ok(0, 'Add a file to the storage location via addFileFromFilesystem'); ok(0, 'Add a file to the storage location via addFileFromHashref'); ok(0, 'Test renaming of files inside of a storage location');