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