@@ -, +, @@ ModOAISetsBiblios --- C4/OAI/Sets.pm | 4 ++-- t/db_dependent/OAI/Sets.t | 40 ++++++++++------------------------------ 2 files changed, 12 insertions(+), 32 deletions(-) --- a/C4/OAI/Sets.pm +++ a/C4/OAI/Sets.pm @@ -525,7 +525,7 @@ sub CalcOAISetsBiblio { }; ModOAISetsBiblios($oai_sets_biblios); -ModOAISetsBiblios truncate oai_sets_biblios table and call AddOAISetsBiblios. +ModOAISetsBiblios deletes all records from oai_sets_biblios table and calls AddOAISetsBiblios. This table is then used in opac/oai.pl. =cut @@ -537,7 +537,7 @@ sub ModOAISetsBiblios { my $dbh = C4::Context->dbh; my $query = qq{ - TRUNCATE TABLE oai_sets_biblios + DELETE FROM oai_sets_biblios }; my $sth = $dbh->prepare($query); $sth->execute; --- a/t/db_dependent/OAI/Sets.t +++ a/t/db_dependent/OAI/Sets.t @@ -17,40 +17,20 @@ # with Koha; if not, see . use Modern::Perl; -use C4::Context; -use Test::More tests => 148; + +use Test::More tests => 144; use Test::MockModule; use Test::Warn; +use MARC::Record; +use Koha::Database; +use C4::Biblio; +use C4::OAI::Sets; -BEGIN { - use_ok('C4::OAI::Sets'); - use_ok('MARC::Record'); - use_ok('C4::Biblio'); -} -can_ok( - 'C4::OAI::Sets', qw( - GetOAISets - GetOAISet - GetOAISetBySpec - ModOAISet - DelOAISet - AddOAISet - GetOAISetsMappings - GetOAISetMappings - ModOAISetMappings - GetOAISetsBiblio - DelOAISetsBiblio - CalcOAISetsBiblio - ModOAISetsBiblios - UpdateOAISetsBiblio - AddOAISetsBiblios ) -); - - +my $schema = Koha::Database->new->schema; +$schema->storage->txn_begin; my $dbh = C4::Context->dbh; -$dbh->{AutoCommit} = 0; -$dbh->{RaiseError} = 1; + $dbh->do('DELETE FROM oai_sets'); $dbh->do('DELETE FROM oai_sets_descriptions'); $dbh->do('DELETE FROM oai_sets_mappings'); @@ -632,4 +612,4 @@ sub create_helper_biblio { return $biblionumber; } -$dbh->rollback; +$schema->storage->txn_rollback; --