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

(-)a/t/db_dependent/Koha/Pseudonymization.t (-18 / +22 lines)
Lines 132-159 subtest 'PseudonymizedBorrowerAttributes tests' => sub { Link Here
132
    delete $patron_info->{borrowernumber};
132
    delete $patron_info->{borrowernumber};
133
    $patron->delete;
133
    $patron->delete;
134
134
135
    my $attribute_type1 = Koha::Patron::Attribute::Type->new(
135
    my $attribute_type1 = $builder->build_object(
136
        {
136
        {
137
            code                => 'my code1',
137
            class => 'Koha::Patron::Attribute::Types',
138
            description         => 'my description1',
138
            value => {
139
            repeatable          => 1,
139
                repeatable                => 1,
140
            keep_for_pseudonymization => 1,
140
                keep_for_pseudonymization => 1,
141
            }
141
        }
142
        }
142
    )->store;
143
    );
143
    my $attribute_type2 = Koha::Patron::Attribute::Type->new(
144
    my $attribute_type2 = $builder->build_object(
144
        {
145
        {
145
            code                => 'my code2',
146
            class => 'Koha::Patron::Attribute::Types',
146
            description         => 'my description2',
147
            value => {
147
            keep_for_pseudonymization => 0,
148
                keep_for_pseudonymization => 0,
149
            }
148
        }
150
        }
149
    )->store;
151
    );
150
    my $attribute_type3 = Koha::Patron::Attribute::Type->new(
152
    my $attribute_type3 = $builder->build_object(
151
        {
153
        {
152
            code                => 'my code3',
154
            class => 'Koha::Patron::Attribute::Types',
153
            description         => 'my description3',
155
            value => {
154
            keep_for_pseudonymization => 1,
156
                keep_for_pseudonymization => 1,
157
            }
155
        }
158
        }
156
    )->store;
159
    );
157
160
158
    $patron = Koha::Patron->new($patron_info)->store->get_from_storage;
161
    $patron = Koha::Patron->new($patron_info)->store->get_from_storage;
159
    my $attribute_values = [
162
    my $attribute_values = [
Lines 190-196 subtest 'PseudonymizedBorrowerAttributes tests' => sub { Link Here
190
    );
193
    );
191
194
192
    my $p = Koha::PseudonymizedTransactions->search({itemnumber => $item->itemnumber})->next;
195
    my $p = Koha::PseudonymizedTransactions->search({itemnumber => $item->itemnumber})->next;
193
    my $attributes = Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute')->search({transaction_id => $p->id });
196
    my $attributes =
197
      Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute')
198
      ->search( { transaction_id => $p->id }, { order_by => 'attribute' } );
194
    is( $attributes->count, 2,
199
    is( $attributes->count, 2,
195
        'Only the 2 attributes that have a type with keep_for_pseudonymization set should be kept'
200
        'Only the 2 attributes that have a type with keep_for_pseudonymization set should be kept'
196
    );
201
    );
197
- 

Return to bug 31201