Bugzilla – Attachment 68500 Details for
Bug 18201
Export data -Fix "Remove non-local items" option and add "Removes non-local records" option for existing functionality
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18201 - Unit tests
Bug-18201---Unit-tests.patch (text/plain), 3.24 KB, created by
Nick Clemens (kidclamp)
on 2017-10-24 18:46:33 UTC
(
hide
)
Description:
Bug 18201 - Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-10-24 18:46:33 UTC
Size:
3.24 KB
patch
obsolete
>From 0f3928de42c0900f4829d37665b82cdfab318270 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 4 Oct 2017 12:10:13 +0000 >Subject: [PATCH] Bug 18201 - Unit tests > >To test: >1. prove -v t/db_dependent/Exporter/Record.t >2. Tests should pass/be green/make the day a little brighter > >Signed-off-by: Scott Kehoe <scott@masslibsystem.org> >--- > t/db_dependent/Exporter/Record.t | 69 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 68 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Exporter/Record.t b/t/db_dependent/Exporter/Record.t >index ac10cbf..6b166ee 100644 >--- a/t/db_dependent/Exporter/Record.t >+++ b/t/db_dependent/Exporter/Record.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > use Test::Warn; > use t::lib::TestBuilder; > >@@ -211,5 +211,72 @@ subtest 'export without record_type' => sub { > #Depending on your logger config, you might have a warn in your logs > }; > >+subtest '_get_biblio_for_export' => sub { >+ plan tests => 4; >+ >+ my $biblio = MARC::Record->new(); >+ $biblio->leader('00266nam a22001097a 4500'); >+ $biblio->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Thurber, James'), >+ MARC::Field->new('245', ' ', ' ', a => "The 13 Clocks"), >+ ); >+ my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); >+ my $branch_a = $builder->build({ >+ source => 'Branch', >+ value => { >+ } >+ }); >+ my $branch_b = $builder->build({ >+ source => 'Branch', >+ value => { >+ } >+ }); >+ my $item_branch_a = $builder->build({ >+ source => 'Item', >+ value => { >+ biblionumber => $biblionumber, >+ homebranch => $branch_a->{branchcode}, >+ more_subfields_xml => '', >+ } >+ }); >+ my $item_branch_b = $builder->build({ >+ source => 'Item', >+ value => { >+ biblionumber => $biblionumber, >+ homebranch => $branch_b->{branchcode}, >+ more_subfields_xml => '', >+ } >+ }); >+ >+ my $record = Koha::Exporter::Record::_get_biblio_for_export( { >+ biblionumber => $biblionumber, >+ export_items => 1, >+ only_export_items_for_branches => undef >+ }); >+ my @items = $record->field('952'); >+ is(scalar @items,2,"We should retrieve all items if we don't pass specific branches and request items"); >+ >+ $record = Koha::Exporter::Record::_get_biblio_for_export( { >+ biblionumber => $biblionumber, >+ export_items => 1, >+ only_export_items_for_branches => [$branch_b->{branchcode}] >+ }); >+ @items = $record->field('952'); >+ is(scalar @items,1,"We should retrieve only item for branch_b item if we request items and pass branch"); >+ is($items[0]->subfield('a'),$branch_b->{branchcode},"And the homebranch for that item should be branch_b branchcode"); >+ >+ $record = Koha::Exporter::Record::_get_biblio_for_export( { >+ biblionumber => $biblionumber, >+ export_items => 0, >+ only_export_items_for_branches => [$branch_b->{branchcode}] >+ }); >+ @items = $record->field('952'); >+ is(@items,0,"We should not have any items if we don't request items and pass a branch"); >+ >+}; >+ >+ >+ >+ > $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 18201
:
62149
|
62152
|
66412
|
67596
|
67597
|
68499
|
68500
|
70002
|
70003
|
70058