Lines 5-11
Link Here
|
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
use C4::Context; |
7 |
use C4::Context; |
8 |
use Test::More tests => 27; |
8 |
use Test::More tests => 30; |
9 |
|
9 |
|
10 |
BEGIN { |
10 |
BEGIN { |
11 |
use_ok('Koha::Misc::Files'); |
11 |
use_ok('Koha::Misc::Files'); |
Lines 16-21
$dbh->{AutoCommit} = 0;
Link Here
|
16 |
$dbh->{RaiseError} = 1; |
16 |
$dbh->{RaiseError} = 1; |
17 |
|
17 |
|
18 |
## new() parameter handling check |
18 |
## new() parameter handling check |
|
|
19 |
is(Koha::Misc::Files->new(), undef, "new() param check test/0"); |
19 |
is(Koha::Misc::Files->new(recordid => 12), undef, "new() param check test/1"); |
20 |
is(Koha::Misc::Files->new(recordid => 12), undef, "new() param check test/1"); |
20 |
is(Koha::Misc::Files->new(recordid => 'aa123', tabletag => 'ttag_a'), undef, "new() param check test/2"); |
21 |
is(Koha::Misc::Files->new(recordid => 'aa123', tabletag => 'ttag_a'), undef, "new() param check test/2"); |
21 |
|
22 |
|
Lines 76-85
$files_a_123_infos = $mf_a_123->GetFilesInfo();
Link Here
|
76 |
is(scalar @$files_a_123_infos, 3, "GetFilesInfo() result count after DelFile()"); |
77 |
is(scalar @$files_a_123_infos, 3, "GetFilesInfo() result count after DelFile()"); |
77 |
|
78 |
|
78 |
## DelAllFiles() tests |
79 |
## DelAllFiles() tests |
79 |
$mf_a_123->DelAllFiles(); |
80 |
my $number_of_deleted_files_a_123 = $mf_a_123->DelAllFiles(); |
|
|
81 |
is( $number_of_deleted_files_a_123, 3, "DelAllFiles returns the number of deleted files/1" ); |
80 |
$files_a_123_infos = $mf_a_123->GetFilesInfo(); |
82 |
$files_a_123_infos = $mf_a_123->GetFilesInfo(); |
81 |
is(scalar @$files_a_123_infos, 0, "GetFilesInfo() result count after DelAllFiles()/1"); |
83 |
is(scalar @$files_a_123_infos, 0, "GetFilesInfo() result count after DelAllFiles()/1"); |
82 |
$mf_b_221->DelAllFiles(); |
84 |
my $number_of_deleted_files_b_221 = $mf_b_221->DelAllFiles(); |
|
|
85 |
is( $number_of_deleted_files_b_221, 1, "DelAllFiles returns the number of deleted files/2" ); |
83 |
is(scalar @{$mf_b_221->GetFilesInfo()}, 0, "GetFilesInfo() result count after DelAllFiles()/2"); |
86 |
is(scalar @{$mf_b_221->GetFilesInfo()}, 0, "GetFilesInfo() result count after DelAllFiles()/2"); |
84 |
|
87 |
|
85 |
$dbh->rollback; |
88 |
$dbh->rollback; |
86 |
- |
|
|