Bugzilla – Attachment 136026 Details for
Bug 30848
Introduce Koha::Filter::ExpandCodedFields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30848: Expand unit tests
Bug-30848-Expand-unit-tests.patch (text/plain), 3.67 KB, created by
Martin Renvoize (ashimema)
on 2022-06-13 13:28:14 UTC
(
hide
)
Description:
Bug 30848: Expand unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-06-13 13:28:14 UTC
Size:
3.67 KB
patch
obsolete
>From 7820817997ee8ac9393547d9e41581c511c4ea82 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 13 Jun 2022 14:25:30 +0100 >Subject: [PATCH] Bug 30848: Expand unit tests > >Add to the unit tests to test Library and Itemtype expansions as well as >linking multiple subfields of the same marc field to such expansions. >--- > .../Koha/Filter/ExpandCodedFields.t | 31 ++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Filter/ExpandCodedFields.t b/t/db_dependent/Koha/Filter/ExpandCodedFields.t >index 9200f0117f..04912a4a83 100644 >--- a/t/db_dependent/Koha/Filter/ExpandCodedFields.t >+++ b/t/db_dependent/Koha/Filter/ExpandCodedFields.t >@@ -35,14 +35,26 @@ my $builder = t::lib::TestBuilder->new(); > > subtest 'ExpandCodedFields tests' => sub { > >- plan tests => 10; >+ plan tests => 16; > > $schema->storage->txn_begin(); > >+ # Add libraries >+ my $homebranch = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $holdingbranch = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ diag("Homebranch: " . $homebranch->branchcode . " : " . $homebranch->branchname); >+ # Add itemtypes >+ my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } ); >+ > # Add a biblio > my $biblio = $builder->build_sample_biblio; > my $record = $biblio->metadata->record; >+ >+ # Suppress the record to test that suppression is never expanded > $record->field('942')->update( n => 1 ); >+ >+ # Add an AV ended field to test for AV expansion > $record->append_fields( > MARC::Field->new( '590', '', '', a => 'CODE' ), > ); >@@ -66,8 +78,22 @@ subtest 'ExpandCodedFields tests' => sub { > $biblio = Koha::Biblios->find( $biblio->biblionumber); > $record = $biblio->metadata->record; > >+ # Embed an item to test for branchcode and itemtype expansions >+ $record->append_fields( >+ MARC::Field->new( >+ '952', '', '', >+ a => $homebranch->branchcode, >+ b => $holdingbranch->branchcode, >+ y => $itemtype->itemtype >+ ), >+ ); >+ >+ > is( $record->field('590')->subfield('a'), 'CODE', 'Record prior to filtering contains AV Code' ); > is( $record->field('942')->subfield('n'), 1, 'Record suppression is numeric prior to filtering' ); >+ is( $record->field('952')->subfield('a'), $homebranch->branchcode, 'Record prior to filtering contains homebranch branchcode' ); >+ is( $record->field('952')->subfield('b'), $holdingbranch->branchcode, 'Record prior to filtering contains holdingbranch branchcode' ); >+ is( $record->field('952')->subfield('y'), $itemtype->itemtype, 'Record prior to filtering contains itemtype code' ); > > my $processor = Koha::RecordProcessor->new( > { >@@ -82,6 +108,9 @@ subtest 'ExpandCodedFields tests' => sub { > is( $result->field('590')->subfield('a'), 'Description should show OPAC', 'Returned record contains AV OPAC description (interface defaults to opac)' ); > is( $record->field('590')->subfield('a'), 'Description should show OPAC', 'Original record now contains AV OPAC description (interface defaults to opac)' ); > is( $record->field('942')->subfield('n'), 1, 'Record suppression is still numeric after filtering' ); >+ is( $record->field('952')->subfield('a'), $homebranch->branchname, 'Record now contains homebranch branchname' ); >+ is( $record->field('952')->subfield('b'), $holdingbranch->branchname, 'Record now contains holdingbranch branchname' ); >+ is( $record->field('952')->subfield('y'), $itemtype->description, 'Record now contains itemtype description' ); > > # reset record for next test > $record = $biblio->metadata->record; >-- >2.20.1
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 30848
:
135338
|
135353
|
135363
|
135364
|
135386
|
135387
|
135388
|
135418
|
135421
|
135422
|
135423
|
135424
|
135425
|
135707
|
135708
|
135709
|
135710
|
135711
|
135712
|
135713
|
135714
|
135715
|
135716
|
135717
|
135770
|
136025
|
136026
|
136027
|
136259
|
136260
|
136261
|
136262
|
136774
|
136775
|
136776
|
136777