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

(-)a/t/db_dependent/Koha/Patrons/Import.t (-2 / +44 lines)
Lines 30-35 use Test::MockModule; Link Here
30
use Koha::Database;
30
use Koha::Database;
31
use Koha::Patron::Relationships;
31
use Koha::Patron::Relationships;
32
use Koha::DateUtils qw(dt_from_string);
32
use Koha::DateUtils qw(dt_from_string);
33
use Koha::ActionLogs;
33
34
34
use File::Temp qw(tempfile tempdir);
35
use File::Temp qw(tempfile tempdir);
35
my $temp_dir = tempdir( 'Koha_patrons_import_test_XXXX', CLEANUP => 1, TMPDIR => 1 );
36
my $temp_dir = tempdir( 'Koha_patrons_import_test_XXXX', CLEANUP => 1, TMPDIR => 1 );
Lines 1497-1503 subtest 'patron_attributes' => sub { Link Here
1497
    }
1498
    }
1498
1499
1499
    subtest 'update existing patron' => sub {
1500
    subtest 'update existing patron' => sub {
1500
        plan tests => 19;
1501
        plan tests => 22;
1502
1503
        t::lib::Mocks::mock_preference( 'BorrowersLog', 0 );
1501
1504
1502
        my $patron = $builder->build_object(
1505
        my $patron = $builder->build_object(
1503
            {
1506
            {
Lines 1523-1530 subtest 'patron_attributes' => sub { Link Here
1523
1526
1524
        is( $result->{overwritten}, 1 );
1527
        is( $result->{overwritten}, 1 );
1525
1528
1529
        my $action_logs = Koha::ActionLogs->search(
1530
            {
1531
                module => "MEMBERS",
1532
                action => "MODIFY",
1533
                object => $patron->borrowernumber,
1534
            }
1535
        );
1536
        is( $action_logs->count, 0, ' ' );
1537
1526
        compare_patron_attributes( $patron->extended_attributes->unblessed, {%$attributes} );
1538
        compare_patron_attributes( $patron->extended_attributes->unblessed, {%$attributes} );
1527
1539
1540
        t::lib::Mocks::mock_preference( 'BorrowersLog', 1 );
1541
1528
        # Adding a new non-repeatable attribute
1542
        # Adding a new non-repeatable attribute
1529
        my $new_attributes = {
1543
        my $new_attributes = {
1530
            $normal_attribute_type->code => ['my normal attribute 2'],
1544
            $normal_attribute_type->code => ['my normal attribute 2'],
Lines 1544-1549 subtest 'patron_attributes' => sub { Link Here
1544
        # The normal_attribute_type has been replaced with 'my normal attribute 2'
1558
        # The normal_attribute_type has been replaced with 'my normal attribute 2'
1545
        compare_patron_attributes( $patron->extended_attributes->unblessed, { %$attributes, %$new_attributes } );
1559
        compare_patron_attributes( $patron->extended_attributes->unblessed, { %$attributes, %$new_attributes } );
1546
1560
1561
        $action_logs = Koha::ActionLogs->search(
1562
            {
1563
                module => "MEMBERS",
1564
                action => "MODIFY",
1565
                object => $patron->borrowernumber,
1566
            }
1567
        );
1568
1569
        is( $action_logs->count, 1, ' ' );
1570
1571
        $result = $patrons_import->import_patrons(
1572
            {
1573
                file                         => $fh,
1574
                matchpoint                   => 'cardnumber',
1575
                overwrite_cardnumber         => 1,
1576
                preserve_extended_attributes => 1
1577
            }
1578
        );
1579
1580
        $action_logs = Koha::ActionLogs->search(
1581
            {
1582
                module => "MEMBERS",
1583
                action => "MODIFY",
1584
                object => $patron->borrowernumber,
1585
            }
1586
        );
1587
1588
        is( $action_logs->count, 1, ' ' );
1589
1547
        # UniqueIDConstraint
1590
        # UniqueIDConstraint
1548
        $patron->extended_attributes->delete;    # reset
1591
        $patron->extended_attributes->delete;    # reset
1549
        $builder->build_object(
1592
        $builder->build_object(
1550
- 

Return to bug 41145