Lines 1-6
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
|
|
4 |
use Test::NoWarnings; |
4 |
use Test::More tests => 23; |
5 |
use Test::More tests => 23; |
5 |
use utf8; |
6 |
use utf8; |
6 |
use File::Basename; |
7 |
use File::Basename; |
Lines 274-281
subtest "_batchCommitItems" => sub {
Link Here
|
274 |
'Error correctly set when import item has duplicate barcode and action always_add' |
275 |
'Error correctly set when import item has duplicate barcode and action always_add' |
275 |
); |
276 |
); |
276 |
|
277 |
|
277 |
$import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { |
278 |
$import_item = $builder->build_object( |
278 |
marcxml => q{<?xml version="1.0" encoding="UTF-8"?> |
279 |
{ |
|
|
280 |
class => 'Koha::Import::Record::Items', |
281 |
value => { |
282 |
marcxml => q{<?xml version="1.0" encoding="UTF-8"?> |
279 |
<collection |
283 |
<collection |
280 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
284 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
281 |
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" |
285 |
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" |
Lines 293-306
subtest "_batchCommitItems" => sub {
Link Here
|
293 |
</record> |
297 |
</record> |
294 |
</collection> |
298 |
</collection> |
295 |
}, |
299 |
}, |
296 |
}}); |
300 |
} |
|
|
301 |
} |
302 |
); |
297 |
|
303 |
|
298 |
( $num_items_added, $num_items_replaced, $num_items_errored ) = |
304 |
( $num_items_added, $num_items_replaced, $num_items_errored ) = |
299 |
C4::ImportBatch::_batchCommitItems( $import_item->import_record_id, 32, 'always_add',64 ); |
305 |
C4::ImportBatch::_batchCommitItems( $import_item->import_record_id, 32, 'always_add', 64 ); |
300 |
is( $num_items_errored, 1, "Item with wrong branchcode fails when action always_add" ); |
306 |
is( $num_items_errored, 1, "Item with wrong branchcode fails when action always_add" ); |
301 |
$import_item->discard_changes(); |
307 |
$import_item->discard_changes(); |
302 |
is( $import_item->status, 'error', "Import item marked as error when wrong branchcode detected and action always_add"); |
308 |
is( |
303 |
is( $import_item->import_error, 'Branch code WBRC missing', 'Error correctly set when import item has a wrong branchcode detected and action always_add' ); |
309 |
$import_item->status, 'error', |
|
|
310 |
"Import item marked as error when wrong branchcode detected and action always_add" |
311 |
); |
312 |
is( |
313 |
$import_item->import_error, 'Branch code WBRC missing', |
314 |
'Error correctly set when import item has a wrong branchcode detected and action always_add' |
315 |
); |
304 |
}; |
316 |
}; |
305 |
|
317 |
|
306 |
subtest "RecordsFromMarcPlugin" => sub { |
318 |
subtest "RecordsFromMarcPlugin" => sub { |
Lines 311-317
subtest "RecordsFromMarcPlugin" => sub {
Link Here
|
311 |
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { |
323 |
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { |
312 |
print $fh q{ |
324 |
print $fh q{ |
313 |
003 = NLAmRIJ |
325 |
003 = NLAmRIJ |
314 |
100,a = 20220520d u||y0frey50 ba |
326 |
100,a = 20220520d u||y0frey50 by |
315 |
700,a = Author |
327 |
700,a = Author |
316 |
200,ind2 = 0 |
328 |
200,ind2 = 0 |
317 |
200,a = Silence in the library |
329 |
200,a = Silence in the library |