Lines 4-10
Link Here
|
4 |
|
4 |
|
5 |
use Modern::Perl; |
5 |
use Modern::Perl; |
6 |
use Test::NoWarnings; |
6 |
use Test::NoWarnings; |
7 |
use Test::More tests => 15; |
7 |
use Test::More tests => 16; |
8 |
|
8 |
|
9 |
use Getopt::Long; |
9 |
use Getopt::Long; |
10 |
use MARC::Record; |
10 |
use MARC::Record; |
Lines 18-23
use C4::Biblio qw( AddBiblio ModBiblio );
Link Here
|
18 |
use Koha::Authorities; |
18 |
use Koha::Authorities; |
19 |
use Koha::Authority::ControlledIndicators; |
19 |
use Koha::Authority::ControlledIndicators; |
20 |
use Koha::Authority::MergeRequests; |
20 |
use Koha::Authority::MergeRequests; |
|
|
21 |
use Koha::ActionLogs; |
21 |
use Koha::Biblios; |
22 |
use Koha::Biblios; |
22 |
use Koha::Database; |
23 |
use Koha::Database; |
23 |
|
24 |
|
Lines 874-879
subtest 'ModBiblio calls from merge' => sub {
Link Here
|
874 |
|
875 |
|
875 |
}; |
876 |
}; |
876 |
|
877 |
|
|
|
878 |
subtest 'ModBiblio logging' => sub { |
879 |
plan tests => 2; |
880 |
|
881 |
t::lib::Mocks::mock_preference( "CataloguingLog", 1 ); |
882 |
my $mocked_module = Test::MockModule->new('C4::AuthoritiesMarc'); |
883 |
$mocked_module->unmock('ModBiblio'); |
884 |
|
885 |
my $auth_record = MARC::Record->new(); |
886 |
$auth_record->insert_fields_ordered( MARC::Field->new( '109', '1', ' ', a => 'Brown,', 'c' => 'Father' ) ); |
887 |
my $authid = AddAuthority( $auth_record, undef, $authtype1, { skip_record_index => 1 } ); |
888 |
|
889 |
my $biblio_record = MARC::Record->new(); |
890 |
$biblio_record->insert_fields_ordered( MARC::Field->new( '245', '1', '0', a => 'Adventures of Father Brown' ) ); |
891 |
$biblio_record->insert_fields_ordered( |
892 |
MARC::Field->new( '609', '1', '1', a => 'Brown,', 'c' => 'Father', 9 => $authid ) ); |
893 |
my ($biblionumber) = AddBiblio( $biblio_record, '', { skip_record_index => 1 } ); |
894 |
$biblio_record->field('245')->update( a => 'New adventures of Father Brown' ); |
895 |
ModBiblio( $biblio_record, $biblionumber, '' ); |
896 |
|
897 |
my $action_logs = Koha::ActionLogs->search( |
898 |
{ object => $biblionumber, module => 'CATALOGUING' }, |
899 |
{ order_by => { -desc => 'action_id' } } |
900 |
); |
901 |
my $last_action = $action_logs->next; |
902 |
is( $last_action->action, 'MODIFY', "Performed 'real' modification of bibliographic record" ); |
903 |
|
904 |
$auth_record->field('109')->update( c => 'Father ; ficticous character' ); |
905 |
ModAuthority( $authid, $auth_record, $authtype1, { skip_merge => 1 } ); |
906 |
merge( |
907 |
{ |
908 |
mergefrom => $authid, MARCfrom => $auth_record, mergeto => $authid, MARCto => $auth_record, |
909 |
biblionumbers => [$biblionumber], |
910 |
} |
911 |
); |
912 |
$action_logs = Koha::ActionLogs->search( |
913 |
{ object => $biblionumber, module => 'CATALOGUING' }, |
914 |
{ order_by => { -desc => 'action_id' } } |
915 |
); |
916 |
$last_action = $action_logs->next; |
917 |
is( $last_action->action, 'MERGE', "Bibliographic record changed by C4::AuthoritiesMarc::merge" ); |
918 |
}; |
919 |
|
877 |
sub set_mocks { |
920 |
sub set_mocks { |
878 |
|
921 |
|
879 |
# After we removed the Zebra code from merge, we only need to mock |
922 |
# After we removed the Zebra code from merge, we only need to mock |
880 |
- |
|
|