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

(-)a/t/db_dependent/AuthoritiesMarc.t (-1 / +4 lines)
Lines 366-372 subtest 'ModAuthority() tests' => sub { Link Here
366
366
367
subtest 'DelAuthority() tests' => sub {
367
subtest 'DelAuthority() tests' => sub {
368
368
369
    plan tests => 2;
369
    plan tests => 3;
370
370
371
    $schema->storage->txn_begin;
371
    $schema->storage->txn_begin;
372
372
Lines 392-396 subtest 'DelAuthority() tests' => sub { Link Here
392
    undef,
392
    undef,
393
        'skip_merge passed, merge not called';
393
        'skip_merge passed, merge not called';
394
394
395
    # Check if last delete got moved to deletedauth_header
396
    isnt( Koha::Database->new->schema->resultset('DeletedauthHeader')->find($auth_id), undef, 'Moved to deleted' );
397
395
    $schema->storage->txn_rollback;
398
    $schema->storage->txn_rollback;
396
};
399
};
(-)a/t/db_dependent/Koha/Authority.t (-1 / +58 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 => 2;
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 marcxml
55
    like( $rec->marcxml, qr/<leader>.{5}d/, 'Leader in marcxml checked' );
56
57
    $schema->storage->txn_rollback;
58
};

Return to bug 30888