View | Details | Raw Unified | Return to bug 27981
Collapse All | Expand All

(-)a/t/db_dependent/Biblio.t (-8 / +12 lines)
Lines 826-848 subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { Link Here
826
};
826
};
827
827
828
subtest 'autoControlNumber tests' => sub {
828
subtest 'autoControlNumber tests' => sub {
829
829
    plan tests => 3;
830
    plan tests => 3;
830
831
831
    t::lib::Mocks::mock_preference('autoControlNumber', 'OFF');
832
    t::lib::Mocks::mock_preference('autoControlNumber', 'OFF');
832
833
833
    my $record = MARC::Record->new();
834
    my $record = MARC::Record->new();
834
    my ($biblionumber) = C4::Biblio::AddBiblio($record, '');
835
    my ($biblio_id) = C4::Biblio::AddBiblio($record, '');
835
    $record = GetMarcBiblio({biblionumber => $biblionumber});
836
    my $biblio = Koha::Biblios->find($biblio_id);
837
838
    $record = $biblio->metadata->record;
836
    is($record->field('001'), undef, '001 not set when pref is off');
839
    is($record->field('001'), undef, '001 not set when pref is off');
837
840
838
    t::lib::Mocks::mock_preference('autoControlNumber', 'biblionumber');
841
    t::lib::Mocks::mock_preference('autoControlNumber', 'biblionumber');
839
    C4::Biblio::ModBiblio($record, $biblionumber, "", { skip_record_index => 1, disable_autolink => 1 });
842
    C4::Biblio::ModBiblio($record, $biblio_id, "", { skip_record_index => 1, disable_autolink => 1 });
840
    $record = GetMarcBiblio({biblionumber => $biblionumber});
843
    $biblio->discard_changes;
841
    is($record->field('001')->as_string(), $biblionumber, '001 set to biblionumber when pref set and field is blank');
844
    $record = $biblio->metadata->record;
845
    is($record->field('001')->as_string(), $biblio_id, '001 set to biblionumber when pref set and field is blank');
842
846
843
    $record->field('001')->update('Not biblionumber');
847
    $record->field('001')->update('Not biblionumber');
844
    C4::Biblio::ModBiblio($record, $biblionumber, "", { skip_record_index => 1, disable_autolink => 1 });
848
    C4::Biblio::ModBiblio($record, $biblio_id, "", { skip_record_index => 1, disable_autolink => 1 });
845
    $record = GetMarcBiblio({biblionumber => $biblionumber});
849
    $biblio->discard_changes;
850
    $record = $biblio->metadata->record;
846
    is($record->field('001')->as_string(), 'Not biblionumber', '001 not set to biblionumber when pref set and field exists');
851
    is($record->field('001')->as_string(), 'Not biblionumber', '001 not set to biblionumber when pref set and field exists');
847
852
848
};
853
};
849
- 

Return to bug 27981