Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 19; |
20 |
use Test::More tests => 20; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
use List::MoreUtils qw( uniq ); |
23 |
use List::MoreUtils qw( uniq ); |
Lines 26-31
use MARC::Record;
Link Here
|
26 |
use t::lib::Mocks qw( mock_preference ); |
26 |
use t::lib::Mocks qw( mock_preference ); |
27 |
use t::lib::TestBuilder; |
27 |
use t::lib::TestBuilder; |
28 |
|
28 |
|
|
|
29 |
use Koha::ActionLogs; |
29 |
use Koha::Database; |
30 |
use Koha::Database; |
30 |
use Koha::Caches; |
31 |
use Koha::Caches; |
31 |
use Koha::MarcSubfieldStructures; |
32 |
use Koha::MarcSubfieldStructures; |
Lines 996-1001
subtest 'GetFrameworkCode' => sub {
Link Here
|
996 |
|
997 |
|
997 |
}; |
998 |
}; |
998 |
|
999 |
|
|
|
1000 |
subtest 'ModBiblio on invalid record' => sub { |
1001 |
plan tests => 3; |
1002 |
|
1003 |
t::lib::Mocks::mock_preference( "CataloguingLog", 1 ); |
1004 |
|
1005 |
# We create a record with an onvalid control character in the MARC |
1006 |
my $record = MARC::Record->new(); |
1007 |
my $field = MARC::Field->new( '650', '', '', 'a' => '00aD000015937' ); |
1008 |
$record->append_fields($field); |
1009 |
|
1010 |
my ($biblionumber) = C4::Biblio::AddBiblio( $record, '' ); |
1011 |
|
1012 |
warning_like { C4::Biblio::ModBiblio( $record, $biblionumber, '' ); } |
1013 |
qr/parser error : PCDATA invalid Char value 31/, |
1014 |
'Modding the biblio warns about the encoding issues'; |
1015 |
my $action_logs = |
1016 |
Koha::ActionLogs->search( { object => $biblionumber, module => 'Cataloguing', action => 'MODIFY' } ); |
1017 |
is( $action_logs->count, 1, "Modification of biblio was successful and recorded" ); |
1018 |
my $action_log = $action_logs->next; |
1019 |
like( |
1020 |
$action_log->info, qr/parser error : PCDATA invalid Char value 31/, |
1021 |
"Metadata issue successfully logged in action logs" |
1022 |
); |
1023 |
}; |
1024 |
|
999 |
# Cleanup |
1025 |
# Cleanup |
1000 |
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); |
1026 |
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); |
1001 |
$schema->storage->txn_rollback; |
1027 |
$schema->storage->txn_rollback; |
1002 |
- |
|
|