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

(-)a/t/db_dependent/Koha/Patron/Modifications.t (-2 / +25 lines)
Lines 132-138 subtest 'store( extended_attributes ) tests' => sub { Link Here
132
132
133
subtest 'approve tests' => sub {
133
subtest 'approve tests' => sub {
134
134
135
    plan tests => 14;
135
    plan tests => 18;
136
136
137
    $schema->storage->txn_begin;
137
    $schema->storage->txn_begin;
138
138
Lines 224-229 subtest 'approve tests' => sub { Link Here
224
    is( $patron_attributes[2]->{attribute},
224
    is( $patron_attributes[2]->{attribute},
225
        'None', 'Attribute updated correctly (attribute)' );
225
        'None', 'Attribute updated correctly (attribute)' );
226
226
227
    my $empty_code_json = '[{"code":"CODE_2","value":""}]';
228
    $verification_token = md5_hex( time() . {} . rand() . {} . $$ );
229
230
    $patron_modification = Koha::Patron::Modification->new(
231
        {   borrowernumber      => $patron->borrowernumber,
232
            extended_attributes => $empty_code_json,
233
            verification_token  => $verification_token
234
        }
235
    )->store();
236
    ok( $patron_modification->approve,
237
        'Patron modification correctly approved' );
238
    @patron_attributes
239
        = map { $_->unblessed }
240
        Koha::Patron::Attributes->search(
241
        { borrowernumber => $patron->borrowernumber } );
242
243
    is( $patron_attributes[0]->{code},
244
        'CODE_1', 'Untouched attribute type is preserved (code)' );
245
    is( $patron_attributes[0]->{attribute},
246
        'VALUE_1', 'Untouched attribute type is preserved (attribute)' );
247
248
    my $count = Koha::Patron::Attributes->search({ borrowernumber => $patron->borrowernumber, code => 'CODE_2' })->count;
249
    is( $count, 0, 'Attributes deleted when modification contained an empty one');
250
227
    $schema->storage->txn_rollback;
251
    $schema->storage->txn_rollback;
228
};
252
};
229
253
230
- 

Return to bug 13737