From: Dan Scott <dan@coffeecode.net>
Date: Wed, 22 Jun 2011 03:31:01 +0000 (-0400)
Subject: Add unit tests for LP 800269 - holdings for captions only
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c1ad78f19abd2acfe09da7049d5c1be5948629dd;p=evergreen%2Fmasslnc.git

Add unit tests for LP 800269 - holdings for captions only

Running "prove -l lib" in Open-ILS/src/perlmods shows that the two new
unit tests pass, whereas they fail using the previously installed
version of MFHD.pm. Good evidence that the fix from dbwells does indeed
solve the reported bug.

Signed-off-by: Dan Scott <dan@coffeecode.net>
---

diff --git a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
index 70f988d852..f24e980419 100644
--- a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
+++ b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
@@ -1,6 +1,6 @@
 #!perl -T
 
-use Test::More tests => 17;
+use Test::More tests => 19;
 
 use_ok( 'OpenILS::Utils::Cronscript' );
 use_ok( 'OpenILS::Utils::CStoreEditor' );
@@ -19,3 +19,20 @@ use_ok( 'OpenILS::Utils::RemoteAccount' );
 use_ok( 'OpenILS::Utils::ScriptRunner' );
 use_ok( 'OpenILS::Utils::SpiderMonkey' );
 use_ok( 'OpenILS::Utils::ZClient' );
+
+# LP 800269 - Test MFHD holdings for records that only contain a caption field
+my $co_marc = MARC::Record->new();
+$co_marc->append_fields(
+    MARC::Field->new('853','','',
+        '8' => '1',
+        'a' => 'v.',
+        'b' => '[no.]',
+    )
+);
+my $co_mfhd = MFHD->new($co_marc);
+
+my @comp_holdings = $co_mfhd->get_compressed_holdings($co_mfhd->field('853'));
+is(@comp_holdings, 0, "Compressed holdings for an MFHD record that only has a caption");
+
+my @decomp_holdings = $co_mfhd->get_decompressed_holdings($co_mfhd->field('853'));
+is(@decomp_holdings, 0, "Decompressed holdings for an MFHD record that only has a caption");