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

(-)a/t/db_dependent/Koha/Patrons.t (-2 / +12 lines)
Lines 688-694 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
688
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
688
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
689
689
690
    subtest 'patron privacy is 1 (default)' => sub {
690
    subtest 'patron privacy is 1 (default)' => sub {
691
        plan tests => 6;
691
        plan tests => 8;
692
692
693
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
693
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
694
        my $patron = $builder->build(
694
        my $patron = $builder->build(
Lines 753-758 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
753
        ($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
753
        ($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
754
        is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue should have been anonymised, the returned date is before' );
754
        is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue should have been anonymised, the returned date is before' );
755
755
756
        my $sth_reset = $dbh->prepare(q|UPDATE old_issues SET borrowernumber = ? WHERE itemnumber = ?|);
757
        $sth_reset->execute( $patron->{borrowernumber}, $item_1->{itemnumber} );
758
        $sth_reset->execute( $patron->{borrowernumber}, $item_2->{itemnumber} );
759
        $rows_affected = Koha::Patrons->search_patrons_to_anonymise->anonymise_issue_history;
760
        $sth->execute($item_1->{itemnumber});
761
        ($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
762
        is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue 1 should have been anonymised, before parameter was not passed' );
763
        $sth->execute($item_2->{itemnumber});
764
        ($borrowernumber_used_to_anonymised) = $sth->fetchrow_array;
765
        is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'The issue 2 should have been anonymised, before parameter was not passed' );
766
756
        Koha::Patrons->find( $patron->{borrowernumber})->delete;
767
        Koha::Patrons->find( $patron->{borrowernumber})->delete;
757
    };
768
    };
758
769
759
- 

Return to bug 18169