Bugzilla – Attachment 140858 Details for
Bug 15869
Change framework on overlay
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15869: Unit test
Bug-15869-Unit-test.patch (text/plain), 2.64 KB, created by
Nick Clemens
on 2022-09-22 19:16:02 UTC
(
hide
)
Description:
Bug 15869: Unit test
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2022-09-22 19:16:02 UTC
Size:
2.64 KB
patch
obsolete
>From 2d5a36b6114bd5c9da33cae84a37d44d3432396f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 21 Sep 2022 21:13:17 +0000 >Subject: [PATCH] Bug 15869: Unit test > >--- > t/db_dependent/ImportBatch.t | 39 ++++++++++++++++++++++++++++++++++-- > 1 file changed, 37 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/ImportBatch.t b/t/db_dependent/ImportBatch.t >index 0184a8f5c5..a745861bd6 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/; >@@ -18,7 +18,7 @@ BEGIN { > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >- use_ok('C4::ImportBatch', qw( AddImportBatch GetImportBatch AddBiblioToBatch AddItemsToImportBiblio SetMatchedBiblionumber GetImportBiblios GetItemNumbersFromImportBatch CleanBatch DeleteBatch RecordsFromMarcPlugin )); >+ use_ok('C4::ImportBatch', qw( AddImportBatch GetImportBatch AddBiblioToBatch AddItemsToImportBiblio SetMatchedBiblionumber GetImportBiblios GetItemNumbersFromImportBatch CleanBatch DeleteBatch RecordsFromMarcPlugin BatchCommitRecords )); > } > > # Start transaction >@@ -328,6 +328,41 @@ subtest "_get_commit_action" => sub { > > }; > >+subtest "BatchCommitRecords overlay into framework" => sub { >+ plan tests => 1; >+ t::lib::Mocks::mock_config( 'enable_plugins', 0 ); >+ my $mock_import = Test::MockModule->new("C4::ImportBatch"); >+ my $biblio = $builder->build_sample_biblio; >+ $mock_import->mock( _get_commit_action => sub { return ('replace',undef,$biblio->biblionumber); } ); >+ >+ my $import_batch = { >+ matcher_id => 2, >+ template_id => 2, >+ branchcode => 'QRZ', >+ overlay_action => 'replace', >+ nomatch_action => 'ignore', >+ item_action => 'ignore', >+ import_status => 'staged', >+ batch_type => 'z3950', >+ file_name => 'test.mrc', >+ comments => 'test', >+ record_type => 'auth', >+ }; >+ my $id_import_batch = C4::ImportBatch::AddImportBatch($import_batch); >+ my $import_record_id = AddBiblioToBatch( $id_import_batch, 0, $biblio->metadata->record, 'utf8', 0 ); >+ >+ BatchCommitRecords({ >+ batch_id => $id_import_batch, >+ framework => "", >+ overlay_framework => "QQ", >+ }); >+ $biblio->discard_changes; >+ is( $biblio->frameworkcode, "QQ", "Framework set on overlay" ); >+}; >+ >+ >+ >+ > sub get_import_record { > my $id_import_batch = shift; > return $dbh->do('SELECT * FROM import_records WHERE import_batch_id = ?', undef, $id_import_batch); >-- >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 15869
:
55543
|
70800
|
77018
|
140857
|
140858
|
142257
|
142258
|
143033
|
145271
|
145272
|
145273
|
145274
|
145406