Bugzilla – Attachment 28833 Details for
Bug 8064
Merge several biblio records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8064: Fix unit tests for createMergeHash
Bug-8064-Fix-unit-tests-for-createMergeHash.patch (text/plain), 5.09 KB, created by
Julian Maurice
on 2014-06-13 09:34:44 UTC
(
hide
)
Description:
Bug 8064: Fix unit tests for createMergeHash
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2014-06-13 09:34:44 UTC
Size:
5.09 KB
patch
obsolete
>From 9d5202f8c7aab9535b8423bc8aa4cd3201714d47 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 9 Jun 2014 09:55:28 +0200 >Subject: [PATCH] Bug 8064: Fix unit tests for createMergeHash > >--- > t/Koha_MetadataRecord.t | 58 +++++++++++++++++++---------------------------- > t/Koha_Util_MARC.t | 58 +++++++++++++++++++---------------------------- > 2 files changed, 46 insertions(+), 70 deletions(-) > >diff --git a/t/Koha_MetadataRecord.t b/t/Koha_MetadataRecord.t >index 53f25a1..473e7a6 100755 >--- a/t/Koha_MetadataRecord.t >+++ b/t/Koha_MetadataRecord.t >@@ -39,55 +39,43 @@ is(ref($record), 'Koha::MetadataRecord', 'Created valid Koha::MetadataRecord obj > > my $samplehash = [ > { >- 'field' => [ >- { >- 'value' => '1234', >- 'tag' => '001', >- } >- ] >+ 'value' => '1234', >+ 'tag' => '001', > }, > { >- 'field' => [ >+ 'subfield' => [ > { >- 'subfield' => [ >- { >- 'value' => 'Cooking', >- 'subtag' => 'a' >- } >- ], >- 'indicator2' => ' ', >- 'tag' => 150, >- 'indicator1' => ' ', >+ 'value' => 'Cooking', >+ 'subtag' => 'a' > } >- ] >+ ], >+ 'indicator2' => ' ', >+ 'tag' => 150, >+ 'indicator1' => ' ', > }, > { >- 'field' => [ >+ 'subfield' => [ >+ { >+ 'value' => 'Cookery', >+ 'subtag' => 'a' >+ }, > { >- 'subfield' => [ >- { >- 'value' => 'Cookery', >- 'subtag' => 'a' >- }, >- { >- 'value' => 'Instructional manuals', >- 'subtag' => 'z' >- } >- ], >- 'indicator2' => ' ', >- 'tag' => 450, >- 'indicator1' => ' ', >+ 'value' => 'Instructional manuals', >+ 'subtag' => 'z' > } >- ] >+ ], >+ 'indicator2' => ' ', >+ 'tag' => 450, >+ 'indicator1' => ' ', > } > ]; > > my $hash = $record->createMergeHash(); > my %fieldkeys; > foreach my $field (@$hash) { >- $fieldkeys{delete $field->{'field'}->[0]->{'key'}}++; >- if (defined $field->{'field'}->[0]->{'subfield'}) { >- foreach my $subfield (@{$field->{'field'}->[0]->{'subfield'}}) { >+ $fieldkeys{delete $field->{'key'}}++; >+ if (defined $field->{'subfield'}) { >+ foreach my $subfield (@{$field->{'subfield'}}) { > $fieldkeys{delete $subfield->{'subkey'}}++; > } > } >diff --git a/t/Koha_Util_MARC.t b/t/Koha_Util_MARC.t >index daf91f0..2859647 100755 >--- a/t/Koha_Util_MARC.t >+++ b/t/Koha_Util_MARC.t >@@ -38,55 +38,43 @@ $marcrecord->add_fields( > ); > my $samplehash = [ > { >- 'field' => [ >- { >- 'value' => '1234', >- 'tag' => '001', >- } >- ] >+ 'value' => '1234', >+ 'tag' => '001', > }, > { >- 'field' => [ >+ 'subfield' => [ > { >- 'subfield' => [ >- { >- 'value' => 'Cooking', >- 'subtag' => 'a' >- } >- ], >- 'indicator2' => ' ', >- 'tag' => 150, >- 'indicator1' => ' ', >+ 'value' => 'Cooking', >+ 'subtag' => 'a' > } >- ] >+ ], >+ 'indicator2' => ' ', >+ 'tag' => 150, >+ 'indicator1' => ' ', > }, > { >- 'field' => [ >+ 'subfield' => [ >+ { >+ 'value' => 'Cookery', >+ 'subtag' => 'a' >+ }, > { >- 'subfield' => [ >- { >- 'value' => 'Cookery', >- 'subtag' => 'a' >- }, >- { >- 'value' => 'Instructional manuals', >- 'subtag' => 'z' >- } >- ], >- 'indicator2' => ' ', >- 'tag' => 450, >- 'indicator1' => ' ', >+ 'value' => 'Instructional manuals', >+ 'subtag' => 'z' > } >- ] >+ ], >+ 'indicator2' => ' ', >+ 'tag' => 450, >+ 'indicator1' => ' ', > } > ]; > > my $hash = Koha::Util::MARC::createMergeHash($marcrecord); > my %fieldkeys; > foreach my $field (@$hash) { >- $fieldkeys{delete $field->{'field'}->[0]->{'key'}}++; >- if (defined $field->{'field'}->[0]->{'subfield'}) { >- foreach my $subfield (@{$field->{'field'}->[0]->{'subfield'}}) { >+ $fieldkeys{delete $field->{'key'}}++; >+ if (defined $field->{'subfield'}) { >+ foreach my $subfield (@{$field->{'subfield'}}) { > $fieldkeys{delete $subfield->{'subkey'}}++; > } > } >-- >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 8064
:
9498
|
18433
|
18840
|
18923
|
19411
|
19413
|
21351
|
22749
|
23708
|
23709
|
23710
|
24078
|
24079
|
24080
|
26055
|
26056
|
26057
|
26058
|
28726
|
28829
|
28830
|
28831
|
28832
|
28833
|
29324
|
29325
|
29326
|
29327
|
29328
|
29921
|
29922
|
29923
|
29924
|
29925
|
35738
|
35739
|
35740
|
35741
|
35742
|
35900
|
35901
|
35902
|
35903
|
35904
|
35905
|
44633
|
44634
|
44635
|
44636
|
44637
|
44638