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

(-)a/Koha/Library.pm (+12 lines)
Lines 77-82 sub library_groups { Link Here
77
    return Koha::Library::Groups->_new_from_dbic( $rs );
77
    return Koha::Library::Groups->_new_from_dbic( $rs );
78
}
78
}
79
79
80
=head3 cash_registers
81
82
Return Cash::Registers associated with this Library
83
84
=cut
85
86
sub cash_registers {
87
    my ( $self ) = @_;
88
    my $rs = $self->_result->cash_registers;
89
    return Koha::Cash::Registers->_new_from_dbic( $rs );
90
}
91
80
=head2 Internal methods
92
=head2 Internal methods
81
93
82
=head3 _type
94
=head3 _type
(-)a/t/db_dependent/Koha/Libraries.t (-2 / +36 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 7;
22
use Test::More tests => 8;
23
23
24
use C4::Biblio;
24
use C4::Biblio;
25
use C4::Context;
25
use C4::Context;
Lines 451-453 subtest '->get_effective_marcorgcode' => sub { Link Here
451
451
452
    $schema->storage->txn_rollback;
452
    $schema->storage->txn_rollback;
453
};
453
};
454
- 
454
455
subtest 'cash_registers' => sub {
456
    plan tests => 3;
457
458
    $schema->storage->txn_begin;
459
460
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
461
    my $register1 = $builder->build_object(
462
        {
463
            class => 'Koha::Cash::Registers',
464
            value  => { branch => $library->branchcode },
465
        }
466
    );
467
    my $register2 = $builder->build_object(
468
        {
469
            class => 'Koha::Cash::Registers',
470
            value  => { branch => $library->branchcode },
471
        }
472
    );
473
474
    my $registers = $library->cash_registers;
475
    is( ref($registers), 'Koha::Cash::Registers',
476
'Koha::Library->cash_registers should return a set of Koha::Cash::Registers'
477
    );
478
    is( $registers->count, 2,
479
        'Koha::Library->cash_registers should return the correct cash registers'
480
    );
481
482
    $register1->delete;
483
    is( $library->cash_registers->next->id, $register2->id,
484
        'Koha::Library->cash_registers should return the correct cash registers'
485
    );
486
487
    $schema->storage->txn_rollback;
488
};

Return to bug 23321