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

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

Return to bug 37901