Lines 147-153
subtest 'Koha::Anonymized::Transactions tests' => sub {
Link Here
|
147 |
$schema->storage->txn_rollback; |
147 |
$schema->storage->txn_rollback; |
148 |
}; |
148 |
}; |
149 |
|
149 |
|
150 |
subtest 'PseudonymizedBorrowerAttributes tests' => sub { |
150 |
subtest 'PseudonymizedMetadataValues tests' => sub { |
151 |
|
151 |
|
152 |
plan tests => 5; |
152 |
plan tests => 5; |
153 |
|
153 |
|
Lines 226-246
subtest 'PseudonymizedBorrowerAttributes tests' => sub {
Link Here
|
226 |
|
226 |
|
227 |
my $p = Koha::PseudonymizedTransaction->create_from_statistic($statistic); |
227 |
my $p = Koha::PseudonymizedTransaction->create_from_statistic($statistic); |
228 |
my $attributes = |
228 |
my $attributes = |
229 |
Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute') |
229 |
Koha::Database->new->schema->resultset('PseudonymizedMetadataValue') |
230 |
->search( { transaction_id => $p->id }, { order_by => 'attribute' } ); |
230 |
->search( { transaction_id => $p->id }, { order_by => 'value' } ); |
231 |
is( |
231 |
is( |
232 |
$attributes->count, 2, |
232 |
$attributes->count, 2, |
233 |
'Only the 2 attributes that have a type with keep_for_pseudonymization set should be kept' |
233 |
'Only the 2 attributes that have a type with keep_for_pseudonymization set should be kept' |
234 |
); |
234 |
); |
235 |
my $attribute_1 = $attributes->next; |
235 |
my $attribute_1 = $attributes->next; |
236 |
is_deeply( |
236 |
is_deeply( |
237 |
{ attribute => $attribute_1->attribute, code => $attribute_1->code->code }, |
237 |
{ attribute => $attribute_1->value, code => $attribute_1->key }, |
238 |
$attribute_values->[0], |
238 |
$attribute_values->[0], |
239 |
'Attribute 1 should be retrieved correctly' |
239 |
'Attribute 1 should be retrieved correctly' |
240 |
); |
240 |
); |
241 |
my $attribute_2 = $attributes->next; |
241 |
my $attribute_2 = $attributes->next; |
242 |
is_deeply( |
242 |
is_deeply( |
243 |
{ attribute => $attribute_2->attribute, code => $attribute_2->code->code }, |
243 |
{ attribute => $attribute_2->value, code => $attribute_2->key }, |
244 |
$attribute_values->[2], |
244 |
$attribute_values->[2], |
245 |
'Attribute 2 should be retrieved correctly' |
245 |
'Attribute 2 should be retrieved correctly' |
246 |
); |
246 |
); |
Lines 261-267
subtest 'PseudonymizedBorrowerAttributes tests' => sub {
Link Here
|
261 |
|
261 |
|
262 |
my $next_p = Koha::PseudonymizedTransaction->create_from_statistic($second_statistic); |
262 |
my $next_p = Koha::PseudonymizedTransaction->create_from_statistic($second_statistic); |
263 |
my $next_attributes = |
263 |
my $next_attributes = |
264 |
Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute') |
264 |
Koha::Database->new->schema->resultset('PseudonymizedMetadataValue') |
265 |
->search( { transaction_id => $next_p->id }, { order_by => 'attribute' } ); |
265 |
->search( { transaction_id => $next_p->id }, { order_by => 'attribute' } ); |
266 |
|
266 |
|
267 |
is( |
267 |
is( |
268 |
- |
|
|