Lines 2-8
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
use File::Temp qw/ tempdir /; |
4 |
use File::Temp qw/ tempdir /; |
5 |
use Test::More tests => 8; |
5 |
use Test::More tests => 9; |
6 |
|
6 |
|
7 |
use Test::MockModule; |
7 |
use Test::MockModule; |
8 |
use t::lib::Mocks; |
8 |
use t::lib::Mocks; |
Lines 11-16
use t::lib::TestBuilder;
Link Here
|
11 |
use C4::Context; |
11 |
use C4::Context; |
12 |
use Koha::Database; |
12 |
use Koha::Database; |
13 |
use Koha::Upload; |
13 |
use Koha::Upload; |
|
|
14 |
use Koha::UploadedFiles; |
14 |
|
15 |
|
15 |
my $schema = Koha::Database->new->schema; |
16 |
my $schema = Koha::Database->new->schema; |
16 |
$schema->storage->txn_begin; |
17 |
$schema->storage->txn_begin; |
Lines 204-209
sub test08 { # allows_add_by
Link Here
|
204 |
1, 'Patron is still allowed to add uploaded files' ); |
205 |
1, 'Patron is still allowed to add uploaded files' ); |
205 |
} |
206 |
} |
206 |
|
207 |
|
|
|
208 |
# Additional tests for Koha::UploadedFiles |
209 |
# TODO Rearrange the tests after this migration |
210 |
subtest 'Some basic CRUD testing' => sub { |
211 |
plan tests => 2; |
212 |
|
213 |
# Test find and attribute id, delete and search |
214 |
my $builder = t::lib::TestBuilder->new; |
215 |
my $upload01 = $builder->build({ source => 'UploadedFile' }); |
216 |
my $found = Koha::UploadedFiles->find( $upload01->{id} ); |
217 |
is( $found->id, $upload01->{id}, 'Koha::Object returns id' ); |
218 |
$found->delete; |
219 |
$found = Koha::UploadedFiles->search( |
220 |
{ id => $upload01->{id} }, |
221 |
); |
222 |
is( $found->count, 0, 'Delete seems successful' ); |
223 |
}; |
224 |
|
207 |
sub newCGI { |
225 |
sub newCGI { |
208 |
my ( $class, $hook ) = @_; |
226 |
my ( $class, $hook ) = @_; |
209 |
my $read = 0; |
227 |
my $read = 0; |
210 |
- |
|
|