Revision 63410aa6
Von Sven Schöling vor mehr als 7 Jahren hinzugefügt
t/file/filesystem.t | ||
---|---|---|
7 | 7 |
use Support::TestSetup; |
8 | 8 |
use Test::Exception; |
9 | 9 |
use SL::File; |
10 |
use SL::Dev::File; |
|
10 |
use SL::Dev::File qw(create_uploaded create_scanned create_created); |
|
11 |
|
|
11 | 12 |
|
12 | 13 |
Support::TestSetup::login(); |
13 | 14 |
|
... | ... | |
25 | 26 |
clear_up(); |
26 | 27 |
reset_state(); |
27 | 28 |
|
28 |
my $file1 = SL::Dev::File::create_uploaded( file_name => 'file1', file_contents => 'inhalt1 uploaded' );
|
|
29 |
my $file2 = SL::Dev::File::create_scanned( file_name => 'file2', file_contents => 'inhalt2 scanned', file_path => $scannerfile );
|
|
30 |
my $file3 = SL::Dev::File::create_created( file_name => 'file3', file_contents => 'inhalt3 created' );
|
|
31 |
my $file4 = SL::Dev::File::create_created( file_name => 'file3', file_contents => 'inhalt3 new version');
|
|
29 |
my $file1 = create_uploaded( file_name => 'file1', file_contents => 'inhalt1 uploaded' ); |
|
30 |
my $file2 = create_scanned( file_name => 'file2', file_contents => 'inhalt2 scanned', file_path => $scannerfile ); |
|
31 |
my $file3 = create_created( file_name => 'file3', file_contents => 'inhalt3 created' ); |
|
32 |
my $file4 = create_created( file_name => 'file3', file_contents => 'inhalt3 new version'); |
|
32 | 33 |
|
33 |
is( SL::Dev::File->get_all_count(), 3,"total number of files created is 3");
|
|
34 |
is( SL::Dev::File::get_all_count(), 3,"total number of files created is 3");
|
|
34 | 35 |
ok( $file1->file_name eq 'file1' ,"file has right name"); |
35 | 36 |
my $content1 = $file1->get_content; |
36 | 37 |
ok( $$content1 eq 'inhalt1 uploaded' ,"file has right content"); |
... | ... | |
42 | 43 |
my $content2 = File::Slurp::read_file($scannerfile); |
43 | 44 |
ok( $content2 eq 'inhalt2 scanned' ,"scanned file has right content"); |
44 | 45 |
|
45 |
my @file5 = SL::Dev::File->get_all(file_name => 'file3');
|
|
46 |
my @file5 = SL::Dev::File::get_all(file_name => 'file3');
|
|
46 | 47 |
is( scalar( @file5), 1, "one actual file found"); |
47 | 48 |
my $content5 = $file5[0]->get_content(); |
48 | 49 |
ok( $$content5 eq 'inhalt3 new version' ,"file has right actual content"); |
49 | 50 |
|
50 |
my @file6 = SL::Dev::File->get_all_versions(file_name => 'file3');
|
|
51 |
my @file6 = SL::Dev::File::get_all_versions(file_name => 'file3');
|
|
51 | 52 |
is( scalar( @file6), 2,"two file versions found"); |
52 | 53 |
$content5 = $file6[0]->get_content; |
53 | 54 |
ok( $$content5 eq 'inhalt3 new version' ,"file has right actual content"); |
... | ... | |
108 | 109 |
sub clear_up { |
109 | 110 |
# Cleaning up may fail. |
110 | 111 |
eval { |
111 |
SL::Dev::File->delete_all();
|
|
112 |
SL::Dev::File::delete_all();
|
|
112 | 113 |
unlink($scannerfile); |
113 | 114 |
}; |
114 | 115 |
} |
Auch abrufbar als: Unified diff
Tests: SL::Dev Änderungen übernommen