Koha/t/lib/KohaTest/Heading.pm
Galen Charlton 386b4b15a1 bug 2315: no crash if subfield code is a metacharacter
When generating the display form of a heading that
happens to (invalidly) have a regular expression
metacharacter as a subfield label, do not crash.

An example of such a heading field is:

  <datafield tag="650" ind1=" " ind2="0">
    <subfield code="a">Dalziel, Andrew (Fictitious character</subfield>
    <subfield code=")">xFiction.</subfield>
  </datafield>

The error message associated with the crash is:

  Unmatched ) in regex; marked by <-- HERE in m/) <-- HERE / at
  /home/koha-pro/kohaclone/C4/Heading/MARC21.pm line 220.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-08 09:36:11 -05:00

27 lines
527 B
Perl

package KohaTest::Heading;
use base qw( KohaTest );
use strict;
use warnings;
use Test::More;
use C4::Heading;
sub testing_class { 'C4::Heading' };
sub methods : Test( 1 ) {
my $self = shift;
my @methods = qw(
new_from_bib_field
display_form
authorities
preferred_authorities
_query_limiters
_marc_format_handler
);
can_ok( $self->testing_class, @methods );
}
1;