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

(-)a/t/db_dependent/Circulation/AnonymiseIssueHistory.t (-313 lines)
Lines 1-313 Link Here
1
2
#!/usr/bin/perl
3
4
# This file is part of Koha.
5
#
6
# Koha is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# Koha is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
19
use Modern::Perl;
20
21
use Test::More tests => 5;
22
23
use C4::Context;
24
use C4::Circulation;
25
26
use Koha::Database;
27
use Koha::Items;
28
29
use t::lib::Mocks;
30
use t::lib::TestBuilder;
31
32
my $schema  = Koha::Database->new->schema;
33
$schema->storage->txn_begin;
34
35
my $builder = t::lib::TestBuilder->new;
36
37
# TODO create a subroutine in t::lib::Mocks
38
my $branch = $builder->build({ source => 'Branch' });
39
my $userenv_patron = $builder->build({
40
    source => 'Borrower',
41
    value  => { branchcode => $branch->{branchcode} },
42
});
43
C4::Context->_new_userenv('DUMMY SESSION');
44
C4::Context->set_userenv(
45
    $userenv_patron->{borrowernumber},
46
    $userenv_patron->{userid},
47
    'usercnum', 'First name', 'Surname',
48
    $branch->{branchcode},
49
    $branch->{branchname},
50
    0,
51
);
52
53
my $anonymous = $builder->build( { source => 'Borrower', }, );
54
55
t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
56
57
subtest 'patron privacy is 1 (default)' => sub {
58
    plan tests => 4;
59
    t::lib::Mocks::mock_preference('IndependentBranches', 0);
60
    my $patron = $builder->build(
61
        {   source => 'Borrower',
62
            value  => { privacy => 1, branchcode => $userenv_patron->{branchcode} }
63
        }
64
    );
65
    my $item = $builder->build(
66
        {   source => 'Item',
67
            value  => {
68
                itemlost  => 0,
69
                withdrawn => 0,
70
            },
71
        }
72
    );
73
    my $issue = $builder->build(
74
        {   source => 'Issue',
75
            value  => {
76
                borrowernumber => $patron->{borrowernumber},
77
                itemnumber     => $item->{itemnumber},
78
            },
79
        }
80
    );
81
82
    my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
83
    is( $returned, 1, 'The item should have been returned' );
84
    my ( $rows_affected, $err ) = C4::Circulation::AnonymiseIssueHistory('2010-10-11');
85
    ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' );
86
    is( $err, undef, 'AnonymiseIssueHistory should not return any error if success' );
87
88
    my $dbh = C4::Context->dbh;
89
    my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
90
        SELECT borrowernumber FROM old_issues where itemnumber = ?
91
    |, undef, $item->{itemnumber});
92
    is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'With privacy=1, the issue should have been anonymised' );
93
94
};
95
96
subtest 'patron privacy is 0 (forever)' => sub {
97
    plan tests => 3;
98
    t::lib::Mocks::mock_preference('IndependentBranches', 0);
99
100
    my $patron = $builder->build(
101
        {   source => 'Borrower',
102
            value  => { privacy => 0, branchcode => $userenv_patron->{branchcode} }
103
        }
104
    );
105
    my $item = $builder->build(
106
        {   source => 'Item',
107
            value  => {
108
                itemlost  => 0,
109
                withdrawn => 0,
110
            },
111
        }
112
    );
113
    my $issue = $builder->build(
114
        {   source => 'Issue',
115
            value  => {
116
                borrowernumber => $patron->{borrowernumber},
117
                itemnumber     => $item->{itemnumber},
118
            },
119
        }
120
    );
121
122
    my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
123
    is( $returned, 1, 'The item should have been returned' );
124
    my ( $rows_affected, $err ) = C4::Circulation::AnonymiseIssueHistory('2010-10-11');
125
    is( $err, undef, 'AnonymiseIssueHistory should not return any error if success' );
126
127
    my $dbh = C4::Context->dbh;
128
    my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
129
        SELECT borrowernumber FROM old_issues where itemnumber = ?
130
    |, undef, $item->{itemnumber});
131
    is( $borrowernumber_used_to_anonymised, $patron->{borrowernumber}, 'With privacy=0, the issue should not be anonymised' );
132
};
133
134
t::lib::Mocks::mock_preference( 'AnonymousPatron', '' );
135
136
subtest 'AnonymousPatron is not defined' => sub {
137
    plan tests => 4;
138
    t::lib::Mocks::mock_preference('IndependentBranches', 0);
139
    my $patron = $builder->build(
140
        {   source => 'Borrower',
141
            value  => { privacy => 1, branchcode => $userenv_patron->{branchcode} }
142
        }
143
    );
144
    my $item = $builder->build(
145
        {   source => 'Item',
146
            value  => {
147
                itemlost  => 0,
148
                withdrawn => 0,
149
            },
150
        }
151
    );
152
    my $issue = $builder->build(
153
        {   source => 'Issue',
154
            value  => {
155
                borrowernumber => $patron->{borrowernumber},
156
                itemnumber     => $item->{itemnumber},
157
            },
158
        }
159
    );
160
161
    my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
162
    is( $returned, 1, 'The item should have been returned' );
163
    my ( $rows_affected, $err ) = C4::Circulation::AnonymiseIssueHistory('2010-10-11');
164
    ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' );
165
    is( $err, undef, 'AnonymiseIssueHistory should not return any error if success' );
166
167
    my $dbh = C4::Context->dbh;
168
    my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
169
        SELECT borrowernumber FROM old_issues where itemnumber = ?
170
    |, undef, $item->{itemnumber});
171
    is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' );
172
};
173
174
subtest 'Logged in librarian is not superlibrarian & IndependentBranches' => sub {
175
    plan tests => 1;
176
    t::lib::Mocks::mock_preference('IndependentBranches', 1);
177
    my $patron = $builder->build(
178
        {   source => 'Borrower',
179
            value  => { privacy => 1 } # Another branchcode than the logged in librarian
180
        }
181
    );
182
    my $item = $builder->build(
183
        {   source => 'Item',
184
            value  => {
185
                itemlost  => 0,
186
                withdrawn => 0,
187
            },
188
        }
189
    );
190
    my $issue = $builder->build(
191
        {   source => 'Issue',
192
            value  => {
193
                borrowernumber => $patron->{borrowernumber},
194
                itemnumber     => $item->{itemnumber},
195
            },
196
        }
197
    );
198
199
    my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
200
    my $patrons_to_anonymise = C4::Members::GetBorrowersWithIssuesHistoryOlderThan( '2010-10-11' );
201
    my ( $rows_affected, $err ) = C4::Circulation::AnonymiseIssueHistory('2010-10-11');
202
    is( scalar(@$patrons_to_anonymise), $rows_affected, , 'AnonymiseIssueHistory should affect at least 1 row' );
203
};
204
205
subtest 'Test StoreLastBorrower' => sub {
206
    plan tests => 6;
207
208
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '1' );
209
210
    my $patron = $builder->build(
211
        {
212
            source => 'Borrower',
213
            value  => { privacy => 1, }
214
        }
215
    );
216
217
    my $item = $builder->build(
218
        {
219
            source => 'Item',
220
            value  => {
221
                itemlost  => 0,
222
                withdrawn => 0,
223
            },
224
        }
225
    );
226
227
    my $issue = $builder->build(
228
        {
229
            source => 'Issue',
230
            value  => {
231
                borrowernumber => $patron->{borrowernumber},
232
                itemnumber     => $item->{itemnumber},
233
            },
234
        }
235
    );
236
237
    my $item_object   = Koha::Items->find( $item->{itemnumber} );
238
    my $patron_object = $item_object->last_returned_by();
239
    is( $patron_object, undef, 'Koha::Item::last_returned_by returned undef' );
240
241
    my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
242
243
    $item_object   = Koha::Items->find( $item->{itemnumber} );
244
    $patron_object = $item_object->last_returned_by();
245
    is( ref($patron_object), 'Koha::Patron', 'Koha::Item::last_returned_by returned Koha::Patron' );
246
247
    $patron = $builder->build(
248
        {
249
            source => 'Borrower',
250
            value  => { privacy => 1, }
251
        }
252
    );
253
254
    $issue = $builder->build(
255
        {
256
            source => 'Issue',
257
            value  => {
258
                borrowernumber => $patron->{borrowernumber},
259
                itemnumber     => $item->{itemnumber},
260
            },
261
        }
262
    );
263
264
    ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
265
266
    $item_object   = Koha::Items->find( $item->{itemnumber} );
267
    $patron_object = $item_object->last_returned_by();
268
    is( $patron_object->id, $patron->{borrowernumber}, 'Second patron to return item replaces the first' );
269
270
    $patron = $builder->build(
271
        {
272
            source => 'Borrower',
273
            value  => { privacy => 1, }
274
        }
275
    );
276
    $patron_object = Koha::Patrons->find( $patron->{borrowernumber} );
277
278
    $item_object->last_returned_by($patron_object);
279
    $item_object = Koha::Items->find( $item->{itemnumber} );
280
    my $patron_object2 = $item_object->last_returned_by();
281
    is( $patron_object->id, $patron_object2->id,
282
        'Calling last_returned_by with Borrower object sets last_returned_by to that borrower' );
283
284
    $patron_object->delete;
285
    $item_object = Koha::Items->find( $item->{itemnumber} );
286
    is( $item_object->last_returned_by, undef, 'last_returned_by should return undef if the last patron to return the item has been deleted' );
287
288
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '0' );
289
    $patron = $builder->build(
290
        {
291
            source => 'Borrower',
292
            value  => { privacy => 1, }
293
        }
294
    );
295
296
    $issue = $builder->build(
297
        {
298
            source => 'Issue',
299
            value  => {
300
                borrowernumber => $patron->{borrowernumber},
301
                itemnumber     => $item->{itemnumber},
302
            },
303
        }
304
    );
305
    ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
306
307
    $item_object   = Koha::Items->find( $item->{itemnumber} );
308
    is( $item_object->last_returned_by, undef, 'Last patron to return item should not be stored if StoreLastBorrower if off' );
309
};
310
311
$schema->storage->txn_rollback;
312
313
1;
(-)a/t/db_dependent/Circulation/StoreLastBorrower.t (+144 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 1;
21
22
use C4::Context;
23
use C4::Circulation;
24
25
use Koha::Database;
26
use Koha::Items;
27
28
use t::lib::Mocks;
29
use t::lib::TestBuilder;
30
31
my $schema  = Koha::Database->new->schema;
32
$schema->storage->txn_begin;
33
34
my $builder = t::lib::TestBuilder->new;
35
36
subtest 'Test StoreLastBorrower' => sub {
37
    plan tests => 6;
38
39
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '1' );
40
41
    my $patron = $builder->build(
42
        {
43
            source => 'Borrower',
44
            value  => { privacy => 1, }
45
        }
46
    );
47
48
    my $item = $builder->build(
49
        {
50
            source => 'Item',
51
            value  => {
52
                itemlost  => 0,
53
                withdrawn => 0,
54
            },
55
        }
56
    );
57
58
    my $issue = $builder->build(
59
        {
60
            source => 'Issue',
61
            value  => {
62
                borrowernumber => $patron->{borrowernumber},
63
                itemnumber     => $item->{itemnumber},
64
            },
65
        }
66
    );
67
68
    my $item_object   = Koha::Items->find( $item->{itemnumber} );
69
    my $patron_object = $item_object->last_returned_by();
70
    is( $patron_object, undef, 'Koha::Item::last_returned_by returned undef' );
71
72
    my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, $patron->{branchcode}, undef, undef, '2010-10-10' );
73
74
    $item_object   = Koha::Items->find( $item->{itemnumber} );
75
    $patron_object = $item_object->last_returned_by();
76
    is( ref($patron_object), 'Koha::Patron', 'Koha::Item::last_returned_by returned Koha::Patron' );
77
78
    $patron = $builder->build(
79
        {
80
            source => 'Borrower',
81
            value  => { privacy => 1, }
82
        }
83
    );
84
85
    $issue = $builder->build(
86
        {
87
            source => 'Issue',
88
            value  => {
89
                borrowernumber => $patron->{borrowernumber},
90
                itemnumber     => $item->{itemnumber},
91
            },
92
        }
93
    );
94
95
    ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, $patron->{branchcode}, undef, undef, '2010-10-10' );
96
97
    $item_object   = Koha::Items->find( $item->{itemnumber} );
98
    $patron_object = $item_object->last_returned_by();
99
    is( $patron_object->id, $patron->{borrowernumber}, 'Second patron to return item replaces the first' );
100
101
    $patron = $builder->build(
102
        {
103
            source => 'Borrower',
104
            value  => { privacy => 1, }
105
        }
106
    );
107
    $patron_object = Koha::Patrons->find( $patron->{borrowernumber} );
108
109
    $item_object->last_returned_by($patron_object);
110
    $item_object = Koha::Items->find( $item->{itemnumber} );
111
    my $patron_object2 = $item_object->last_returned_by();
112
    is( $patron_object->id, $patron_object2->id,
113
        'Calling last_returned_by with Borrower object sets last_returned_by to that borrower' );
114
115
    $patron_object->delete;
116
    $item_object = Koha::Items->find( $item->{itemnumber} );
117
    is( $item_object->last_returned_by, undef, 'last_returned_by should return undef if the last patron to return the item has been deleted' );
118
119
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '0' );
120
    $patron = $builder->build(
121
        {
122
            source => 'Borrower',
123
            value  => { privacy => 1, }
124
        }
125
    );
126
127
    $issue = $builder->build(
128
        {
129
            source => 'Issue',
130
            value  => {
131
                borrowernumber => $patron->{borrowernumber},
132
                itemnumber     => $item->{itemnumber},
133
            },
134
        }
135
    );
136
    ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, $patron->{branchcode}, undef, undef, '2010-10-10' );
137
138
    $item_object   = Koha::Items->find( $item->{itemnumber} );
139
    is( $item_object->last_returned_by, undef, 'Last patron to return item should not be stored if StoreLastBorrower if off' );
140
};
141
142
$schema->storage->txn_rollback;
143
144
1;
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +177 lines)
Lines 19-28 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 13;
22
use Test::More tests => 14;
23
use Test::Warn;
23
use Test::Warn;
24
24
25
use C4::Members;
25
use C4::Members;
26
use C4::Circulation;
26
27
27
use Koha::Holds;
28
use Koha::Holds;
28
use Koha::Patron;
29
use Koha::Patron;
Lines 362-367 subtest 'add_enrolment_fee_if_needed' => sub { Link Here
362
    $patron->delete;
363
    $patron->delete;
363
};
364
};
364
365
366
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
367
    plan tests => 4;
368
369
    # TODO create a subroutine in t::lib::Mocks
370
    my $branch = $builder->build({ source => 'Branch' });
371
    my $userenv_patron = $builder->build({
372
        source => 'Borrower',
373
        value  => { branchcode => $branch->{branchcode} },
374
    });
375
    C4::Context->_new_userenv('DUMMY SESSION');
376
    C4::Context->set_userenv(
377
        $userenv_patron->{borrowernumber},
378
        $userenv_patron->{userid},
379
        'usercnum', 'First name', 'Surname',
380
        $branch->{branchcode},
381
        $branch->{branchname},
382
        0,
383
    );
384
    my $anonymous = $builder->build( { source => 'Borrower', }, );
385
386
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
387
388
    subtest 'patron privacy is 1 (default)' => sub {
389
        plan tests => 3;
390
391
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
392
        my $patron = $builder->build(
393
            {   source => 'Borrower',
394
                value  => { privacy => 1, }
395
            }
396
        );
397
        my $item = $builder->build(
398
            {   source => 'Item',
399
                value  => {
400
                    itemlost  => 0,
401
                    withdrawn => 0,
402
                },
403
            }
404
        );
405
        my $issue = $builder->build(
406
            {   source => 'Issue',
407
                value  => {
408
                    borrowernumber => $patron->{borrowernumber},
409
                    itemnumber     => $item->{itemnumber},
410
                },
411
            }
412
        );
413
414
        my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
415
        is( $returned, 1, 'The item should have been returned' );
416
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11');
417
        ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' );
418
419
        my $dbh = C4::Context->dbh;
420
        my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
421
            SELECT borrowernumber FROM old_issues where itemnumber = ?
422
        |, undef, $item->{itemnumber});
423
        is( $borrowernumber_used_to_anonymised, $anonymous->{borrowernumber}, 'With privacy=1, the issue should have been anonymised' );
424
        Koha::Patrons->find( $patron->{borrowernumber})->delete;
425
    };
426
427
    subtest 'patron privacy is 0 (forever)' => sub {
428
        plan tests => 3;
429
430
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
431
        my $patron = $builder->build(
432
            {   source => 'Borrower',
433
                value  => { privacy => 0, }
434
            }
435
        );
436
        my $item = $builder->build(
437
            {   source => 'Item',
438
                value  => {
439
                    itemlost  => 0,
440
                    withdrawn => 0,
441
                },
442
            }
443
        );
444
        my $issue = $builder->build(
445
            {   source => 'Issue',
446
                value  => {
447
                    borrowernumber => $patron->{borrowernumber},
448
                    itemnumber     => $item->{itemnumber},
449
                },
450
            }
451
        );
452
453
        my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
454
        is( $returned, 1, 'The item should have been returned' );
455
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11');
456
        ok( $rows_affected > 0, 'AnonymiseIssueHistory should not return any error if success' );
457
458
        my $dbh = C4::Context->dbh;
459
        my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
460
            SELECT borrowernumber FROM old_issues where itemnumber = ?
461
        |, undef, $item->{itemnumber});
462
        is( $borrowernumber_used_to_anonymised, $patron->{borrowernumber}, 'With privacy=0, the issue should not be anonymised' );
463
        Koha::Patrons->find( $patron->{borrowernumber})->delete;
464
    };
465
466
    t::lib::Mocks::mock_preference( 'AnonymousPatron', '' );
467
468
    subtest 'AnonymousPatron is not defined' => sub {
469
        plan tests => 3;
470
471
        t::lib::Mocks::mock_preference('IndependentBranches', 0);
472
        my $patron = $builder->build(
473
            {   source => 'Borrower',
474
                value  => { privacy => 1, }
475
            }
476
        );
477
        my $item = $builder->build(
478
            {   source => 'Item',
479
                value  => {
480
                    itemlost  => 0,
481
                    withdrawn => 0,
482
                },
483
            }
484
        );
485
        my $issue = $builder->build(
486
            {   source => 'Issue',
487
                value  => {
488
                    borrowernumber => $patron->{borrowernumber},
489
                    itemnumber     => $item->{itemnumber},
490
                },
491
            }
492
        );
493
494
        my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
495
        is( $returned, 1, 'The item should have been returned' );
496
        my $rows_affected = Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->anonymise_issue_history('2010-10-11');
497
        ok( $rows_affected > 0, 'AnonymiseIssueHistory should affect at least 1 row' );
498
499
        my $dbh = C4::Context->dbh;
500
        my ($borrowernumber_used_to_anonymised) = $dbh->selectrow_array(q|
501
            SELECT borrowernumber FROM old_issues where itemnumber = ?
502
        |, undef, $item->{itemnumber});
503
        is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' );
504
        Koha::Patrons->find( $patron->{borrowernumber})->delete;
505
    };
506
507
    subtest 'Logged in librarian is not superlibrarian & IndependentBranches' => sub {
508
        plan tests => 1;
509
        t::lib::Mocks::mock_preference( 'IndependentBranches', 1 );
510
        my $patron = $builder->build(
511
            {   source => 'Borrower',
512
                value  => { privacy => 1 }    # Another branchcode than the logged in librarian
513
            }
514
        );
515
        my $item = $builder->build(
516
            {   source => 'Item',
517
                value  => {
518
                    itemlost  => 0,
519
                    withdrawn => 0,
520
                },
521
            }
522
        );
523
        my $issue = $builder->build(
524
            {   source => 'Issue',
525
                value  => {
526
                    borrowernumber => $patron->{borrowernumber},
527
                    itemnumber     => $item->{itemnumber},
528
                },
529
            }
530
        );
531
532
        my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
533
        is( Koha::Patrons->search_patrons_to_anonymise( '2010-10-11')->count, 0 );
534
        Koha::Patrons->find( $patron->{borrowernumber})->delete;
535
    };
536
537
    Koha::Patrons->find( $anonymous->{borrowernumber})->delete;
538
    Koha::Patrons->find( $userenv_patron->{borrowernumber})->delete;
539
};
540
365
$retrieved_patron_1->delete;
541
$retrieved_patron_1->delete;
366
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
542
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
367
543
368
- 

Return to bug 16966