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

(-)a/t/db_dependent/Koha/Object.t (-1 / +31 lines)
Lines 473-478 subtest "to_api() tests" => sub { Link Here
473
            }
473
            }
474
        );
474
        );
475
475
476
    subtest 'accessible usage tests' => sub {
477
478
        plan tests => 2;
479
480
        $schema->storage->txn_begin;
481
482
        my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } );
483
        my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } );
484
485
        my $patron = $builder->build_object(
486
            {
487
                class => 'Koha::Patrons',
488
                value => {
489
                    flags      => 2**2,            # only has catalogue permissions
490
                    branchcode => $library_1->id
491
                }
492
            }
493
        );
494
476
        my $city_mock = Test::MockModule->new('Koha::City');
495
        my $city_mock = Test::MockModule->new('Koha::City');
477
        $city_mock->mock(
496
        $city_mock->mock(
478
            'strings_map',
497
            'strings_map',
Lines 533-538 subtest "to_api() tests" => sub { Link Here
533
            'Authorised value for country expanded'
552
            'Authorised value for country expanded'
534
        );
553
        );
535
554
555
        my $patron_1 = $builder->build_object(
556
            { class => 'Koha::Patrons', value => { branchcode => $library_1->id } }
557
        );
558
        my $patron_2 = $builder->build_object(
559
            { class => 'Koha::Patrons', value => { branchcode => $library_2->id } }
560
        );
561
562
        t::lib::Mocks::mock_userenv( { patron => $patron } );
563
564
        is( ref($patron_1->to_api), 'HASH', 'Returns the object hash' );
565
        is( $patron_2->to_api, undef, 'Not accessible, returns undef' );
566
536
        $schema->storage->txn_rollback;
567
        $schema->storage->txn_rollback;
537
    };
568
    };
538
569
539
- 

Return to bug 29523