Lines 49-72
subtest "Check MARC field length calculation" => sub {
Link Here
|
49 |
subtest "StripWhitespaceChars tests" => sub { |
49 |
subtest "StripWhitespaceChars tests" => sub { |
50 |
plan tests => 3; |
50 |
plan tests => 3; |
51 |
|
51 |
|
52 |
t::lib::Mocks->mock_preference('marcflavour', 'MARC21'); |
52 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
53 |
t::lib::Mocks->mock_preference('StripWhitespaceChars', 0); |
53 |
t::lib::Mocks::mock_preference('StripWhitespaceChars', 0); |
54 |
|
54 |
|
55 |
my $biblio = t::lib::TestBuilder->new->build_sample_biblio; |
55 |
my $biblio = t::lib::TestBuilder->new->build_sample_biblio; |
56 |
my $record = MARC::Record->new; |
56 |
my $record = MARC::Record->new; |
57 |
$record->append_fields( |
57 |
$record->append_fields( |
58 |
MARC::Field->new( '245', '', '', a => " My title\n" ), |
58 |
MARC::Field->new( '245', '', '', a => " My\ntitle\n" ), |
59 |
); |
59 |
); |
60 |
|
60 |
|
61 |
my $title = $record->title; |
61 |
my $title = $record->title; |
62 |
is( $title, " My title\n", 'Title has whitespace characters' ); |
62 |
is( $title, " My\ntitle\n", 'Title has whitespace characters' ); |
63 |
|
63 |
|
64 |
C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber ); |
64 |
C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber ); |
65 |
my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); |
65 |
my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); |
66 |
my $savedtitle = $savedrec->title; |
66 |
my $savedtitle = $savedrec->title; |
67 |
is( $savedtitle, " My title\n", "Title still has whitespace characters because StripWhitespaceChars is disabled" ); |
67 |
is( $savedtitle, " My\ntitle\n", "Title still has whitespace characters because StripWhitespaceChars is disabled" ); |
68 |
|
68 |
|
69 |
t::lib::Mocks->mock_preference('StripWhitespaceChars', 1); |
69 |
t::lib::Mocks::mock_preference('StripWhitespaceChars', 1); |
70 |
|
70 |
|
71 |
C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber ); |
71 |
C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber ); |
72 |
my $amendedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); |
72 |
my $amendedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); |
73 |
- |
|
|