Bugzilla – Attachment 26475 Details for
Bug 11912
GetMarcISBN wrongly prepends a space to ISBNs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11912: Use the common way to mock syspref
Bug-11912-Use-the-common-way-to-mock-syspref.patch (text/plain), 2.40 KB, created by
Jonathan Druart
on 2014-03-20 10:19:45 UTC
(
hide
)
Description:
Bug 11912: Use the common way to mock syspref
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-03-20 10:19:45 UTC
Size:
2.40 KB
patch
obsolete
>From b4acf9115521755e1a03a47888137efdca140f27 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 20 Mar 2014 11:14:58 +0100 >Subject: [PATCH] Bug 11912: Use the common way to mock syspref > >t::lib::Mocks::mock_preference provides a simple way to mock syspref. > >Test plan: >Verify that t/db_dependent/Biblio.t returns green. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > t/db_dependent/Biblio.t | 23 ++++------------------- > 1 file changed, 4 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index b861023..3c0a159 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -21,6 +21,7 @@ use Test::More tests => 3; > use Test::MockModule; > > use MARC::Record; >+use t::lib::Mocks qw( mock_preference ); > > BEGIN { > use_ok('C4::Biblio'); >@@ -31,12 +32,9 @@ my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; > >-my $global_marcflavour; > # Mocking variables >-my $original_preference = C4::Context->can( 'preference' ); > my $context = new Test::MockModule('C4::Context'); > >-mock_preference(); > mock_marcfromkohafield(); > > sub run_tests { >@@ -46,7 +44,7 @@ sub run_tests { > undef $C4::Biblio::inverted_field_map; > > my $marcflavour = shift; >- $global_marcflavour = $marcflavour; >+ t::lib::Mocks::mock_preference('marcflavour', $marcflavour); > > my $isbn = '0590353403'; > my $title = 'Foundation'; >@@ -183,26 +181,13 @@ sub run_tests { > > } > >-sub mock_preference { >- >- $context->mock( 'preference', sub { >- my ( $self, $pref ) = @_; >- if ( $pref eq 'marcflavour' ) { >- return $global_marcflavour; >- } else { >- &$original_preference(@_); >- } >- }); >- >-} >- > sub mock_marcfromkohafield { > > $context->mock('marcfromkohafield', > sub { > my ( $self ) = shift; > >- if ( $global_marcflavour eq 'MARC21' ) { >+ if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { > > return { > '' => { >@@ -213,7 +198,7 @@ sub mock_marcfromkohafield { > 'biblioitems.biblioitemnumber' => [ '999', 'd' ] > } > }; >- } elsif ( $global_marcflavour eq 'UNIMARC' ) { >+ } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { > > return { > '' => { >-- >1.7.10.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 11912
:
25968
|
25969
|
26018
|
26019
|
26277
|
26286
|
26287
|
26288
|
26471
|
26472
|
26473
|
26474
| 26475