Add the Storage::Image test. This really, really wants to be done with
Test::Class in the long term. Fixed a bug where Storage::Image's getFiles does not obey the showAll switch that its parent has.
This commit is contained in:
parent
dff08ef533
commit
c07b0b9c72
2 changed files with 59 additions and 1 deletions
58
t/Storage/Image.t
Normal file
58
t/Storage/Image.t
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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";
|
||||
our $todo;
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage::Image;
|
||||
|
||||
use File::Spec;
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
|
||||
plan tests => 7; # 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");
|
||||
|
||||
my $uploadUrl = $session->config->get('uploadsURL');
|
||||
ok ($uploadUrl, "uploadDir defined in config");
|
||||
|
||||
my $originalCaseInsensitiveOS = $session->config->get('caseInsensitiveOS');
|
||||
$session->config->set('caseInsensitiveOS', 0);
|
||||
|
||||
####################################################
|
||||
#
|
||||
# getFiles
|
||||
#
|
||||
####################################################
|
||||
|
||||
my $imageStore = WebGUI::Storage::Image->create($session);
|
||||
cmp_bag($imageStore->getFiles(1), ['.', '..'], 'Starting with an empty storage object, no files in here except for . and ..');
|
||||
$imageStore->addFileFromScalar('.dotfile', 'dot file');
|
||||
cmp_bag($imageStore->getFiles(), [ ], 'getFiles() by default does not return dot files');
|
||||
cmp_bag($imageStore->getFiles(1), ['.', '..', '.dotfile'], 'getFiles(1) returns all files, including dot files');
|
||||
$imageStore->addFileFromScalar('dot.file', 'dot.file');
|
||||
cmp_bag($imageStore->getFiles(), ['dot.file'], 'getFiles() returns normal files');
|
||||
cmp_bag($imageStore->getFiles(1), ['.', '..', '.dotfile', 'dot.file'], 'getFiles(1) returns all files, including dot files');
|
||||
|
||||
END {
|
||||
foreach my $stor (
|
||||
$imageStore,
|
||||
) {
|
||||
ref $stor eq "WebGUI::Storage::Image" and $stor->delete;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue