use Modern::Perl;
use File::Temp qw/ tempdir /;
-use Test::More tests => 8;
+use Test::More tests => 9;
use Test::MockModule;
use t::lib::Mocks;
use C4::Context;
use Koha::Database;
use Koha::Upload;
+use Koha::UploadedFiles;
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
1, 'Patron is still allowed to add uploaded files' );
}
+# Additional tests for Koha::UploadedFiles
+# TODO Rearrange the tests after this migration
+subtest 'Some basic CRUD testing' => sub {
+ plan tests => 2;
+
+ # Test find and attribute id, delete and search
+ my $builder = t::lib::TestBuilder->new;
+ my $upload01 = $builder->build({ source => 'UploadedFile' });
+ my $found = Koha::UploadedFiles->find( $upload01->{id} );
+ is( $found->id, $upload01->{id}, 'Koha::Object returns id' );
+ $found->delete;
+ $found = Koha::UploadedFiles->search(
+ { id => $upload01->{id} },
+ );
+ is( $found->count, 0, 'Delete seems successful' );
+};
+
sub newCGI {
my ( $class, $hook ) = @_;
my $read = 0;