Bugzilla – Attachment 63396 Details for
Bug 18579
Problem with :Filter::MARC::EmbedItemsAvailability
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18579: Regression tests
Bug-18579-Regression-tests.patch (text/plain), 2.14 KB, created by
Marcel de Rooy
on 2017-05-12 05:41:11 UTC
(
hide
)
Description:
Bug 18579: Regression tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-05-12 05:41:11 UTC
Size:
2.14 KB
patch
obsolete
>From 24ef3c0197c591e6a966f2e05c608b0d2ae293aa Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 11 May 2017 13:04:18 -0300 >Subject: [PATCH] Bug 18579: Regression tests >Content-Type: text/plain; charset=utf-8 > >This patch makes sure the tests have the biblio.biblionumber mapping mocked >so we test the case where the mapping is to a control field instead of just >regular data fields (in the case of UNIMARC). > >To test: >- Apply the patch >- Run: > $ prove t/db_dependent/Koha/Filter/EmbedItemsAvailability.t >=> FAIL: Tests fail due to an attemp to access a subfield on a control field. > >Sponsored-by: ByWater Solutions > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Koha/Filter/EmbedItemsAvailability.t | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > >diff --git a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t b/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t >index 7110bf9..74a8d03e 100755 >--- a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t >+++ b/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t >@@ -18,6 +18,8 @@ > use Modern::Perl; > > use Test::More tests => 1; >+use Test::MockModule; >+ > use t::lib::Mocks; > use t::lib::TestBuilder; > >@@ -36,8 +38,26 @@ subtest 'EmbedItemsAvailability tests' => sub { > > $schema->storage->txn_begin(); > >+ my $biblio = Test::MockModule->new('C4::Biblio'); >+ $biblio->mock( 'GetMarcFromKohaField', sub { >+ my ( $kohafield, $frameworkcode ) = @_; >+ if ( $kohafield eq 'biblio.biblionumber' ) { >+ if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { >+ return ( '001', '@' ); >+ } >+ else { >+ return ( '999', 'c' ); >+ } >+ } >+ else { >+ my $func_ref = $biblio->original( 'GetMarcFromKohaField' ); >+ &$func_ref( $kohafield, $frameworkcode ); >+ } >+ }); >+ > # MARC21 tests > t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); >+ > # Create a dummy record > my ( $biblionumber, $biblioitemnumber ) = AddBiblio(MARC::Record->new(), ''); > >-- >2.1.4
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 18579
:
63389
|
63390
|
63394
|
63395
| 63396 |
63397
|
63414
|
63415