Bugzilla – Attachment 135280 Details for
Bug 30831
Add unit test for BatchCommitItems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30831: Unit test
Bug-30831-Unit-test.patch (text/plain), 2.40 KB, created by
David Nind
on 2022-05-23 16:24:00 UTC
(
hide
)
Description:
Bug 30831: Unit test
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-05-23 16:24:00 UTC
Size:
2.40 KB
patch
obsolete
>From b306e5ef592a45c3a257babe892677bc9c72d8a2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 23 May 2022 12:18:11 +0000 >Subject: [PATCH] Bug 30831: Unit test > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/ImportBatch.t | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/ImportBatch.t b/t/db_dependent/ImportBatch.t >index 7548c398ab..5471fb1b70 100755 >--- a/t/db_dependent/ImportBatch.t >+++ b/t/db_dependent/ImportBatch.t >@@ -1,7 +1,7 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 18; >+use Test::More tests => 19; > use utf8; > use File::Basename; > use File::Temp qw/tempfile/; >@@ -183,6 +183,39 @@ C4::ImportBatch::DeleteBatch( $id_import_batch3 ); > my $import_batch = C4::ImportBatch::GetImportBatch( $id_import_batch3 ); > is( $import_batch, undef, "Batch 3 has been deleted"); > >+subtest "BatchCommitItems" => sub { >+ plan tests => 3; >+ >+ my $exist_item = $builder->build_sample_item; >+ my $import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { >+ marcxml => q{<?xml version="1.0" encoding="UTF-8"?> >+<collection >+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >+ xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" >+ xmlns="http://www.loc.gov/MARC21/slim"> >+ >+<record> >+ <leader>00000 a </leader> >+ <datafield tag="952" ind1=" " ind2=" "> >+ <subfield code="a">CPL</subfield> >+ <subfield code="b">CPL</subfield> >+ <subfield code="c">GEN</subfield> >+ <subfield code="p">}.$exist_item->barcode.q{</subfield> >+ <subfield code="y">BK</subfield> >+ </datafield> >+</record> >+</collection> >+ }, >+ }}); >+ >+ my ( $num_items_added, $num_items_replaced, $num_items_errored ) = >+ C4::ImportBatch::BatchCommitItems( $import_item->import_record_id, 32, 'always_add',64 ); >+ is( $num_items_errored, 1, "Item with duplicate barcode fails when action always_add" ); >+ $import_item->discard_changes(); >+ is( $import_item->status, 'error', "Import item marked as error when duplicate barcode and action always_add"); >+ is( $import_item->import_error, 'duplicate item barcode', 'Error correctly set when import item has duplciate barcode and action always_add' ); >+}; >+ > subtest "RecordsFromMarcPlugin" => sub { > plan tests => 5; > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30831
:
135260
|
135262
|
135280
|
135297