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

(-)a/t/db_dependent/Koha/Object.t (-2 / +14 lines)
Lines 215-221 subtest 'TO_JSON tests' => sub { Link Here
215
215
216
subtest "to_api() tests" => sub {
216
subtest "to_api() tests" => sub {
217
217
218
    plan tests => 28;
218
    plan tests => 29;
219
219
220
    $schema->storage->txn_begin;
220
    $schema->storage->txn_begin;
221
221
Lines 365-370 subtest "to_api() tests" => sub { Link Here
365
        'Koha::Exceptions::Object::MethodNotCoveredByTests',
365
        'Koha::Exceptions::Object::MethodNotCoveredByTests',
366
        'Unknown method exception thrown if is_count not specified';
366
        'Unknown method exception thrown if is_count not specified';
367
367
368
    # Simulate a situation in which the relation returns undef instead of an empty iterator
369
    my $patron_class = Test::MockModule->new('Koha::Patron');
370
    $patron_class->mock( 'holds', sub {
371
        return;
372
    });
373
374
    $patron_api = $patron->to_api(
375
        {
376
            embed => { holds_count => { is_count => 1 } }
377
        }
378
    );
379
    is( $patron_api->{holds_count}, 0, 'Count embeds returns 0 if the relation is undef' );
380
368
    $schema->storage->txn_rollback;
381
    $schema->storage->txn_rollback;
369
};
382
};
370
383
371
- 

Return to bug 24965