Bugzilla – Attachment 135260 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.35 KB, created by
Nick Clemens (kidclamp)
on 2022-05-23 12:24:27 UTC
(
hide
)
Description:
Bug 30831: Unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-05-23 12:24:27 UTC
Size:
2.35 KB
patch
obsolete
>From d37372cc526408c4e092311c44adf60e6787f731 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 > >--- > 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