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

(-)a/t/db_dependent/Koha/Patrons.t (-3 / +5 lines)
Lines 827-833 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
827
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
827
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
828
828
829
    subtest 'patron privacy is 1 (default)' => sub {
829
    subtest 'patron privacy is 1 (default)' => sub {
830
        plan tests => 8;
830
        plan tests => 9;
831
831
832
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
832
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
833
        my $patron = $builder->build(
833
        my $patron = $builder->build(
Lines 878-883 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
878
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2011-11-12' } )->anonymise_issue_history( { before => '2010-10-11' } );
878
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2011-11-12' } )->anonymise_issue_history( { before => '2010-10-11' } );
879
        ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' );
879
        ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' );
880
880
881
        $patrons_to_anonymise = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } );
882
        is( $patrons_to_anonymise->count, 0, 'search_patrons_to_anonymise should return 0 after anonymisation is done' );
883
881
        my $dbh = C4::Context->dbh;
884
        my $dbh = C4::Context->dbh;
882
        my $sth = $dbh->prepare(q|SELECT borrowernumber FROM old_issues where itemnumber = ?|);
885
        my $sth = $dbh->prepare(q|SELECT borrowernumber FROM old_issues where itemnumber = ?|);
883
        $sth->execute($item_1->{itemnumber});
886
        $sth->execute($item_1->{itemnumber});
Lines 935-941 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
935
        my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, dt_from_string('2010-10-10') );
938
        my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, dt_from_string('2010-10-10') );
936
        is( $returned, 1, 'The item should have been returned' );
939
        is( $returned, 1, 'The item should have been returned' );
937
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->anonymise_issue_history( { before => '2010-10-11' } );
940
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( { before => '2010-10-11' } )->anonymise_issue_history( { before => '2010-10-11' } );
938
        ok( $rows_affected > 0, 'AnonymiseIssueHistory should not return any error if success' );
941
        is( $rows_affected, 0, 'AnonymiseIssueHistory should not return any error if success' );
939
942
940
        my $dbh = C4::Context->dbh;
943
        my $dbh = C4::Context->dbh;
941
        my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
944
        my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
942
- 

Return to bug 22944