Bug 11529: Use new biblio fields whenever possible
[koha.git] / t / Biblio2.t
index 3cb0cb0..21354eb 100644 (file)
@@ -52,4 +52,20 @@ sub _koha_marc_update_bib_ids_control {
     is($r->field('004')->data(), 20, 'Biblioitemnumber to control field');
 }
 
+subtest 'SplitSubtitle' => sub {
+    plan tests => 4;
+
+    my $res = C4::Biblio::SplitSubtitle(undef);
+    is_deeply($res, [], 'undef returned as an array');
+
+    $res = C4::Biblio::SplitSubtitle('');
+    is_deeply($res, [], 'Empty string returned as an array');
+
+    $res = C4::Biblio::SplitSubtitle('Single');
+    is_deeply($res, [{'subfield' => 'Single'}], 'Single subtitle returns an array');
+
+    $res = C4::Biblio::SplitSubtitle('First | Second');
+    is_deeply($res, [{'subfield' => 'First'}, {'subfield' => 'Second'}], 'Two subtitles returns an array');
+};
+
 done_testing();