Lines 32-47
subtest "Check MARC field length calculation" => sub {
Link Here
|
32 |
plan tests => 3; |
32 |
plan tests => 3; |
33 |
|
33 |
|
34 |
t::lib::Mocks->mock_preference( 'marcflavour', 'MARC21' ); |
34 |
t::lib::Mocks->mock_preference( 'marcflavour', 'MARC21' ); |
35 |
|
35 |
my $biblioitem = t::lib::TestBuilder->new->build( |
36 |
my $biblio = t::lib::TestBuilder->new->build({ source => 'Biblio' }); |
36 |
{ source => 'Biblioitem', |
|
|
37 |
value => { |
38 |
'deleted_on' => undef, |
39 |
} |
40 |
}); |
37 |
my $record = MARC::Record->new; |
41 |
my $record = MARC::Record->new; |
38 |
$record->append_fields( |
42 |
$record->append_fields( |
39 |
MARC::Field->new( '100', '', '', a => 'My title' ), |
43 |
MARC::Field->new( '100', '', '', a => 'My title' ), |
40 |
); |
44 |
); |
41 |
|
45 |
|
42 |
is( $record->leader, ' 'x24, 'No leader lengths' ); |
46 |
is( $record->leader, ' 'x24, 'No leader lengths' ); |
43 |
C4::Biblio::ModBiblioMarc( $record, $biblio->{biblionumber}, '' ); |
47 |
C4::Biblio::ModBiblioMarc( $record, $biblioitem->{biblionumber}, '' ); |
44 |
my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->{biblionumber} }); |
48 |
my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblioitem->{biblionumber} }); |
45 |
like( substr($savedrec->leader,0,5), qr/^\d{5}$/, 'Record length found' ); |
49 |
like( substr($savedrec->leader,0,5), qr/^\d{5}$/, 'Record length found' ); |
46 |
like( substr($savedrec->leader,12,5), qr/^\d{5}$/, 'Base address found' ); |
50 |
like( substr($savedrec->leader,12,5), qr/^\d{5}$/, 'Base address found' ); |
47 |
}; |
51 |
}; |
48 |
- |
|
|