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

(-)a/t/db_dependent/Koha/Pseudonymization.t (-3 / +41 lines)
Lines 79-85 subtest 'Config does not exist' => sub { Link Here
79
79
80
subtest 'Koha::Anonymized::Transactions tests' => sub {
80
subtest 'Koha::Anonymized::Transactions tests' => sub {
81
81
82
    plan tests => 15;
82
    plan tests => 16;
83
83
84
    $schema->storage->txn_begin;
84
    $schema->storage->txn_begin;
85
85
Lines 135-146 subtest 'Koha::Anonymized::Transactions tests' => sub { Link Here
135
    is( $pseudonymized->itemcallnumber,         $item->itemcallnumber,     'itemcallnumber copied correctly' );
135
    is( $pseudonymized->itemcallnumber,         $item->itemcallnumber,     'itemcallnumber copied correctly' );
136
    is( $pseudonymized->ccode,                  $item->ccode,              'ccode copied correctly' );
136
    is( $pseudonymized->ccode,                  $item->ccode,              'ccode copied correctly' );
137
137
138
    my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($statistic)->store;
139
140
    isnt(
141
        $pseudonymized->id,
142
        $next_p->id,
143
        'The id of the 2nd pseudonymized transaction should be different'
144
    );
145
138
    $schema->storage->txn_rollback;
146
    $schema->storage->txn_rollback;
139
};
147
};
140
148
141
subtest 'PseudonymizedBorrowerAttributes tests' => sub {
149
subtest 'PseudonymizedBorrowerAttributes tests' => sub {
142
150
143
    plan tests => 3;
151
    plan tests => 5;
144
152
145
    $schema->storage->txn_begin;
153
    $schema->storage->txn_begin;
146
154
Lines 236-240 subtest 'PseudonymizedBorrowerAttributes tests' => sub { Link Here
236
        'Attribute 2 should be retrieved correctly'
244
        'Attribute 2 should be retrieved correctly'
237
    );
245
    );
238
246
247
    my $number_of_attributes_before_2nd_p = $attributes->count;
248
249
    my $second_statistic = Koha::Statistic->new(
250
        {
251
            type           => 'issue',
252
            branch         => $library->branchcode,
253
            itemnumber     => $item->itemnumber,
254
            borrowernumber => $patron->borrowernumber,
255
            itemtype       => $item->effective_itemtype,
256
            location       => $item->location,
257
            ccode          => $item->ccode,
258
        }
259
    );
260
261
    my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($second_statistic)->store;
262
    my $next_attributes =
263
        Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute')
264
        ->search( { transaction_id => $next_p->id }, { order_by => 'attribute' } );
265
266
    is(
267
        $attributes->count,
268
        $number_of_attributes_before_2nd_p,
269
        'The number of attributes for the original transaction should remain the same'
270
    );
271
272
    isnt(
273
        $p->id,
274
        $next_p->id,
275
        'The id of the 2nd pseudonymized transaction should be different'
276
    );
277
239
    $schema->storage->txn_rollback;
278
    $schema->storage->txn_rollback;
240
};
279
};
241
- 

Return to bug 39652