Bug 12343: Add regression test for TransformKohaToMarc
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 11 Jun 2014 11:31:55 +0000 (13:31 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 15 Jun 2014 14:27:20 +0000 (11:27 -0300)
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
t/Biblio/TransformKohaToMarc.t [new file with mode: 0644]

diff --git a/t/Biblio/TransformKohaToMarc.t b/t/Biblio/TransformKohaToMarc.t
new file mode 100644 (file)
index 0000000..15eb71a
--- /dev/null
@@ -0,0 +1,31 @@
+use Modern::Perl;
+use Test::More tests => 1;
+use MARC::Record;
+
+use t::lib::Mocks;
+use C4::Biblio;
+
+t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
+
+my $record = C4::Biblio::TransformKohaToMarc({
+    "biblioitems.illus"   => "Other physical details", # 300$b
+    "biblioitems.pages"   => "Extent",                 # 300$a
+    "biblioitems.size"    => "Dimensions",             # 300$c
+});
+
+my @subfields = $record->field('300')->subfields();
+is_deeply( \@subfields, [
+          [
+            'a',
+            'Extent'
+          ],
+          [
+            'b',
+            'Other physical details'
+          ],
+          [
+            'c',
+            'Dimensions'
+          ]
+        ],
+'TransformKohaToMarc should returns sorted subfields (regression test for bug 12343)' );