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

(-)a/t/db_dependent/Koha/Object.t (-2 / +35 lines)
Lines 223-229 subtest 'TO_JSON tests' => sub { Link Here
223
223
224
subtest "to_api() tests" => sub {
224
subtest "to_api() tests" => sub {
225
225
226
    plan tests => 29;
226
    plan tests => 30;
227
227
228
    $schema->storage->txn_begin;
228
    $schema->storage->txn_begin;
229
229
Lines 420-425 subtest "to_api() tests" => sub { Link Here
420
        }
420
        }
421
    };
421
    };
422
422
423
    subtest 'accessible usage tests' => sub {
424
425
        plan tests => 2;
426
427
        $schema->storage->txn_begin;
428
429
        my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } );
430
        my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } );
431
432
        my $patron = $builder->build_object(
433
            {
434
                class => 'Koha::Patrons',
435
                value => {
436
                    flags      => 2**2,            # only has catalogue permissions
437
                    branchcode => $library_1->id
438
                }
439
            }
440
        );
441
442
        my $patron_1 = $builder->build_object(
443
            { class => 'Koha::Patrons', value => { branchcode => $library_1->id } }
444
        );
445
        my $patron_2 = $builder->build_object(
446
            { class => 'Koha::Patrons', value => { branchcode => $library_2->id } }
447
        );
448
449
        t::lib::Mocks::mock_userenv( { patron => $patron } );
450
451
        is( ref($patron_1->to_api), 'HASH', 'Returns the object hash' );
452
        is( $patron_2->to_api, undef, 'Not accessible, returns undef' );
453
454
        $schema->storage->txn_rollback;
455
    };
456
423
    $schema->storage->txn_rollback;
457
    $schema->storage->txn_rollback;
424
};
458
};
425
459
426
- 

Return to bug 29523