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

(-)a/t/db_dependent/AuthoritiesMarc.t (-1 / +4 lines)
Lines 336-342 subtest 'ModAuthority() tests' => sub { Link Here
336
336
337
subtest 'DelAuthority() tests' => sub {
337
subtest 'DelAuthority() tests' => sub {
338
338
339
    plan tests => 2;
339
    plan tests => 3;
340
340
341
    $schema->storage->txn_begin;
341
    $schema->storage->txn_begin;
342
342
Lines 364-368 subtest 'DelAuthority() tests' => sub { Link Here
364
        undef,
364
        undef,
365
        'skip_merge passed, merge not called';
365
        'skip_merge passed, merge not called';
366
366
367
    # Check if last delete got moved to deletedauth_header
368
    isnt( Koha::Database->new->schema->resultset('DeletedauthHeader')->find($auth_id), undef, 'Moved to deleted' );
369
367
    $schema->storage->txn_rollback;
370
    $schema->storage->txn_rollback;
368
};
371
};
(-)a/t/db_dependent/Koha/Authority.t (-1 / +59 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2024 Rijksmuseum, Koha Development team
4
#
5
# This file is part of Koha
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Test::More tests => 1;
23
24
use C4::AuthoritiesMarc;
25
use Koha::Authorities;
26
use Koha::Database;
27
28
use t::lib::Mocks;
29
use t::lib::TestBuilder;
30
31
my $builder = t::lib::TestBuilder->new;
32
my $schema  = Koha::Database->new->schema;
33
34
subtest 'move_to_deleted' => sub {
35
    plan tests => 3;
36
    $schema->storage->txn_begin;
37
38
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );    # TODO UNIMARC?
39
40
    my $record = MARC::Record->new;
41
    $record->append_fields( MARC::Field->new( '100', '1', '2', a => 'Name' ) );
42
    my $type   = $builder->build( { source => 'AuthType', value => { auth_tag_to_report => '100' } } );
43
    my $authid = C4::AuthoritiesMarc::AddAuthority(
44
        $record, undef,
45
        $type->{authtypecode}
46
    );
47
    my $authority = Koha::Authorities->find($authid);
48
49
    # Trivial test to see if 'move' really copies..
50
    my $count = $schema->resultset('DeletedauthHeader')->count;
51
    my $rec   = $authority->move_to_deleted;
52
    is( $schema->resultset('DeletedauthHeader')->count, $count + 1, 'count one higher' );
53
54
    # Check leader position 05 in marc and marcxml
55
    is( substr( $rec->marc, 5, 1 ), 'd', 'Leader in marc blob correct' );
56
    like( $rec->marcxml, qr/<leader>\d{5}d/, 'Leader in marcxml checked also' );
57
58
    $schema->storage->txn_rollback;
59
};

Return to bug 30888