Bugzilla – Attachment 75008 Details for
Bug 20702
Bind results of GetHostItemsInfo to the EasyAnalyticalRecords pref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20702: Add unit tests for GetHostItemsInfo
Bug-20702-Add-unit-tests-for-GetHostItemsInfo.patch (text/plain), 2.50 KB, created by
Marcel de Rooy
on 2018-05-03 12:16:49 UTC
(
hide
)
Description:
Bug 20702: Add unit tests for GetHostItemsInfo
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-05-03 12:16:49 UTC
Size:
2.50 KB
patch
obsolete
>From 8b6636b2d8d166ba50210f8bf18f35a14f9ccae2 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 3 May 2018 14:08:01 +0200 >Subject: [PATCH] Bug 20702: Add unit tests for GetHostItemsInfo >Content-Type: text/plain; charset=utf-8 > >Unfortunately, we did not have unit tests yet. >Adding some simple tests that test basic operation of the sub when the >pref is enabled/disabled and for MARC21/UNIMARC. > >Test plan: >[1] Run t/db_dependent/Items/GetHostItemsInfo.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Items/GetHostItemsInfo.t | 41 +++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > create mode 100644 t/db_dependent/Items/GetHostItemsInfo.t > >diff --git a/t/db_dependent/Items/GetHostItemsInfo.t b/t/db_dependent/Items/GetHostItemsInfo.t >new file mode 100644 >index 0000000..5f4a5c3 >--- /dev/null >+++ b/t/db_dependent/Items/GetHostItemsInfo.t >@@ -0,0 +1,41 @@ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ >+use C4::Items; >+use Koha::Database; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+subtest 'GetHostItemsInfo' => sub { >+ plan tests => 3; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $bib1 = $builder->build({ source => 'Biblio' }); >+ my $itm1 = $builder->build({ source => 'Item', value => { biblionumber => $bib1->{biblionumber} }}); >+ my $itm2 = $builder->build({ source => 'Item', value => { biblionumber => $bib1->{biblionumber} }}); >+ my $marc = MARC::Record->new; >+ $marc->append_fields( >+ MARC::Field->new( '461', '', '', 0 => $bib1->{biblionumber}, 9 => $itm1->{itemnumber} ), >+ MARC::Field->new( '773', '', '', 0 => $bib1->{biblionumber}, 9 => $itm1->{itemnumber} ), >+ MARC::Field->new( '773', '', '', 0 => $bib1->{biblionumber}, 9 => $itm2->{itemnumber} ), >+ ); >+ >+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); >+ t::lib::Mocks::mock_preference('EasyAnalyticalRecords', 0); >+ my @a = C4::Items::GetHostItemsInfo( $marc ); >+ is( @a, 0, 'GetHostItemsInfo returns empty list when pref is disabled' ); >+ >+ t::lib::Mocks::mock_preference('EasyAnalyticalRecords', 1); >+ @a = C4::Items::GetHostItemsInfo( $marc ); >+ is( @a, 2, 'GetHostItemsInfo returns two items for MARC21' ); >+ >+ t::lib::Mocks::mock_preference('marcflavour', 'UNIMARC'); >+ @a = C4::Items::GetHostItemsInfo( $marc ); >+ is( @a, 1, 'GetHostItemsInfo returns one item for UNIMARC' ); >+}; >+ >+$schema->storage->txn_rollback; >-- >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 20702
:
75007
|
75008
|
75194
|
75195
|
76197
|
76198