Bugzilla – Attachment 65094 Details for
Bug 18951
Some t/Biblio tests are database dependent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18951: Create data for TransformKohaToMarc.t
Bug-18951-Create-data-for-TransformKohaToMarct.patch (text/plain), 2.82 KB, created by
Marcel de Rooy
on 2017-07-19 12:20:00 UTC
(
hide
)
Description:
Bug 18951: Create data for TransformKohaToMarc.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-07-19 12:20:00 UTC
Size:
2.82 KB
patch
obsolete
>From b6624787884a2f033a4b265b7bbd5a45a794e272 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 19 Jul 2017 13:48:55 +0200 >Subject: [PATCH] Bug 18951: Create data for TransformKohaToMarc.t >Content-Type: text/plain; charset=utf-8 > >Adding schema and caching statements. >Adjust it so that the Koha to MARC mappings are not assumed to be present, >but are created as needed. >Remove the mock on marcflavour. It is no longer needed. >Resolving a small typo. > >Test plan: >Run t/db_dependent/Biblio/TransformKohaToMarc.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Biblio/TransformKohaToMarc.t | 31 +++++++++++++++++++---------- > 1 file changed, 21 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/Biblio/TransformKohaToMarc.t b/t/db_dependent/Biblio/TransformKohaToMarc.t >index 15eb71a..34a2a5e 100644 >--- a/t/db_dependent/Biblio/TransformKohaToMarc.t >+++ b/t/db_dependent/Biblio/TransformKohaToMarc.t >@@ -3,16 +3,27 @@ use Test::More tests => 1; > use MARC::Record; > > use t::lib::Mocks; >+use Koha::Database; >+use Koha::Caches; >+use Koha::MarcSubfieldStructures; > use C4::Biblio; > >-t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+# Create/overwrite some Koha to MARC mappings in default framework >+my $mapping1 = Koha::MarcSubfieldStructures->find('','300','a') // Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '300', tagsubfield => 'a' }); >+$mapping1->kohafield( "mytable.nicepages" ); >+$mapping1->store; >+my $mapping2 = Koha::MarcSubfieldStructures->find('','300','b') // Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '300', tagsubfield => 'b' }); >+$mapping2->kohafield( "mytable2.goodillustrations" ); >+$mapping2->store; >+Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); > > my $record = C4::Biblio::TransformKohaToMarc({ >- "biblioitems.illus" => "Other physical details", # 300$b >- "biblioitems.pages" => "Extent", # 300$a >- "biblioitems.size" => "Dimensions", # 300$c >+ "mytable2.goodillustrations" => "Other physical details", # 300$b >+ "mytable.nicepages" => "Extent", # 300$a > }); >- > my @subfields = $record->field('300')->subfields(); > is_deeply( \@subfields, [ > [ >@@ -23,9 +34,9 @@ is_deeply( \@subfields, [ > 'b', > 'Other physical details' > ], >- [ >- 'c', >- 'Dimensions' >- ] > ], >-'TransformKohaToMarc should returns sorted subfields (regression test for bug 12343)' ); >+'TransformKohaToMarc should return sorted subfields (regression test for bug 12343)' ); >+ >+# Cleanup >+Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); >+$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 18951
:
65093
|
65094
|
65095
|
65096
|
65097
|
65098
|
65167
|
65168
|
65169