Lines 17-37
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 6; |
20 |
use Test::More tests => 7; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
|
22 |
|
23 |
use List::MoreUtils qw( uniq ); |
23 |
use List::MoreUtils qw( uniq ); |
24 |
use MARC::Record; |
24 |
use MARC::Record; |
25 |
use t::lib::Mocks qw( mock_preference ); |
25 |
use t::lib::Mocks qw( mock_preference ); |
26 |
|
26 |
|
|
|
27 |
use Koha::Database; |
28 |
|
27 |
BEGIN { |
29 |
BEGIN { |
28 |
use_ok('C4::Biblio'); |
30 |
use_ok('C4::Biblio'); |
29 |
} |
31 |
} |
30 |
|
32 |
|
|
|
33 |
my $schema = Koha::Database->new->schema; |
34 |
$schema->storage->txn_begin; |
31 |
my $dbh = C4::Context->dbh; |
35 |
my $dbh = C4::Context->dbh; |
32 |
# Start transaction |
|
|
33 |
$dbh->{AutoCommit} = 0; |
34 |
$dbh->{RaiseError} = 1; |
35 |
|
36 |
|
36 |
subtest 'GetMarcSubfieldStructureFromKohaField' => sub { |
37 |
subtest 'GetMarcSubfieldStructureFromKohaField' => sub { |
37 |
plan tests => 23; |
38 |
plan tests => 23; |
Lines 328-346
sub create_issn_field {
Link Here
|
328 |
subtest 'MARC21' => sub { |
329 |
subtest 'MARC21' => sub { |
329 |
plan tests => 31; |
330 |
plan tests => 31; |
330 |
run_tests('MARC21'); |
331 |
run_tests('MARC21'); |
331 |
$dbh->rollback; |
332 |
$schema->storage->txn_rollback; |
|
|
333 |
$schema->storage->txn_begin; |
332 |
}; |
334 |
}; |
333 |
|
335 |
|
334 |
subtest 'UNIMARC' => sub { |
336 |
subtest 'UNIMARC' => sub { |
335 |
plan tests => 31; |
337 |
plan tests => 31; |
336 |
run_tests('UNIMARC'); |
338 |
run_tests('UNIMARC'); |
337 |
$dbh->rollback; |
339 |
$schema->storage->txn_rollback; |
|
|
340 |
$schema->storage->txn_begin; |
338 |
}; |
341 |
}; |
339 |
|
342 |
|
340 |
subtest 'NORMARC' => sub { |
343 |
subtest 'NORMARC' => sub { |
341 |
plan tests => 31; |
344 |
plan tests => 31; |
342 |
run_tests('NORMARC'); |
345 |
run_tests('NORMARC'); |
343 |
$dbh->rollback; |
346 |
$schema->storage->txn_rollback; |
|
|
347 |
$schema->storage->txn_begin; |
344 |
}; |
348 |
}; |
345 |
|
349 |
|
346 |
subtest 'IsMarcStructureInternal' => sub { |
350 |
subtest 'IsMarcStructureInternal' => sub { |
Lines 362-365
subtest 'IsMarcStructureInternal' => sub {
Link Here
|
362 |
is( grep( /^a$/, @internals ), 0, 'no subfield a' ); |
366 |
is( grep( /^a$/, @internals ), 0, 'no subfield a' ); |
363 |
}; |
367 |
}; |
364 |
|
368 |
|
|
|
369 |
subtest 'deletedbiblio_metadata' => sub { |
370 |
plan tests => 2; |
371 |
|
372 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
373 |
my $biblio_metadata = C4::Biblio::GetXmlBiblio( $biblionumber ); |
374 |
C4::Biblio::DelBiblio( $biblionumber ); |
375 |
my ( $moved ) = $dbh->selectrow_array(q|SELECT biblionumber FROM deletedbiblio WHERE biblionumber=?|, undef, $biblionumber); |
376 |
is( $moved, $biblionumber ); |
377 |
( $moved ) = $dbh->selectrow_array(q|SELECT biblionumber FROM deletedbiblio_metadata WHERE biblionumber=?|, undef, $biblionumber); |
378 |
is( $moved, $biblionumber ); |
379 |
}; |
380 |
|
365 |
1; |
381 |
1; |
366 |
- |
|
|