|
Lines 32-38
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 32 |
|
32 |
|
| 33 |
subtest 'anonymize() tests' => sub { |
33 |
subtest 'anonymize() tests' => sub { |
| 34 |
|
34 |
|
| 35 |
plan tests => 10; |
35 |
plan tests => 13; |
| 36 |
|
36 |
|
| 37 |
$schema->storage->txn_begin; |
37 |
$schema->storage->txn_begin; |
| 38 |
|
38 |
|
|
Lines 89-96
subtest 'anonymize() tests' => sub {
Link Here
|
| 89 |
} |
89 |
} |
| 90 |
} |
90 |
} |
| 91 |
); |
91 |
); |
|
|
92 |
my $renewal_1 = $builder->build_object( |
| 93 |
{ |
| 94 |
class => 'Koha::Checkouts::Renewals', |
| 95 |
value => { |
| 96 |
checkout_id => $checkout_4->id, |
| 97 |
interface => 'opac', |
| 98 |
renewer_id => $patron->id |
| 99 |
} |
| 100 |
} |
| 101 |
); |
| 102 |
my $renewal_2 = $builder->build_object( |
| 103 |
{ |
| 104 |
class => 'Koha::Checkouts::Renewals', |
| 105 |
value => { |
| 106 |
checkout_id => $checkout_4->id, |
| 107 |
interface => 'intranet' |
| 108 |
} |
| 109 |
} |
| 110 |
); |
| 92 |
|
111 |
|
| 93 |
is( $patron->old_checkouts->count, 4, 'Patron has 4 completed checkouts' ); |
112 |
is( $patron->old_checkouts->count, 4, 'Patron has 4 completed checkouts' ); |
|
|
113 |
is( $checkout_4->renewals->count, 2, 'Checkout 4 has 2 renewals' ); |
| 94 |
|
114 |
|
| 95 |
# filter them so only the older two are part of the resultset |
115 |
# filter them so only the older two are part of the resultset |
| 96 |
my $checkouts = $patron->old_checkouts->filter_by_last_update( |
116 |
my $checkouts = $patron->old_checkouts->filter_by_last_update( |
|
Lines 112-117
subtest 'anonymize() tests' => sub {
Link Here
|
| 112 |
is( $anonymized_count, 2, 'update() tells 2 rows were updated' ); |
132 |
is( $anonymized_count, 2, 'update() tells 2 rows were updated' ); |
| 113 |
|
133 |
|
| 114 |
is( $patron->old_checkouts->count, 2, 'Patron has 2 completed checkouts' ); |
134 |
is( $patron->old_checkouts->count, 2, 'Patron has 2 completed checkouts' ); |
|
|
135 |
is( $checkout_4->renewals->count, 2, 'Checkout 4 still has 2 renewals' ); |
| 136 |
is( |
| 137 |
$checkout_4->renewals->search( |
| 138 |
{ renewer_id => $anonymous_patron->id } |
| 139 |
)->count, |
| 140 |
1, |
| 141 |
'OPAC renewal was anonymized' |
| 142 |
); |
| 115 |
|
143 |
|
| 116 |
$schema->storage->txn_rollback; |
144 |
$schema->storage->txn_rollback; |
| 117 |
}; |
145 |
}; |
| 118 |
- |
|
|