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

(-)a/t/db_dependent/Koha/Biblio.t (-2 / +38 lines)
Lines 17-26 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 18;
20
use Test::More tests => 19;
21
use Test::Warn;
21
use Test::Warn;
22
22
23
use C4::Biblio qw( AddBiblio ModBiblio ModBiblioMarc );
23
use C4::Biblio qw( AddBiblio ModBiblio ModBiblioMarc );
24
use C4::Circulation qw( AddIssue AddReturn );
25
24
use Koha::Database;
26
use Koha::Database;
25
use Koha::Caches;
27
use Koha::Caches;
26
use Koha::Acquisition::Orders;
28
use Koha::Acquisition::Orders;
Lines 822-827 subtest 'article_requests() tests' => sub { Link Here
822
    $schema->storage->txn_rollback;
824
    $schema->storage->txn_rollback;
823
};
825
};
824
826
827
subtest 'current_checkouts() and old_checkouts() tests' => sub {
828
829
    plan tests => 4;
830
831
    $schema->storage->txn_begin;
832
833
    my $library = $builder->build_object({ class => 'Koha::Libraries' });
834
835
    my $patron_1 = $builder->build_object({ class => 'Koha::Patrons' })->unblessed;
836
    my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' })->unblessed;
837
838
    my $item_1 = $builder->build_sample_item;
839
    my $item_2 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber });
840
841
    t::lib::Mocks::mock_userenv({ branchcode => $library->id });
842
843
    AddIssue( $patron_1, $item_1->barcode );
844
    AddIssue( $patron_1, $item_2->barcode );
845
846
    AddReturn( $item_1->barcode );
847
    AddIssue( $patron_2, $item_1->barcode );
848
849
    my $biblio = $item_1->biblio;
850
    my $current_checkouts = $biblio->current_checkouts;
851
    my $old_checkouts = $biblio->old_checkouts;
852
853
    is( ref($current_checkouts), 'Koha::Checkouts', 'Type is correct' );
854
    is( ref($old_checkouts), 'Koha::Old::Checkouts', 'Type is correct' );
855
856
    is( $current_checkouts->count, 2, 'Count is correct for current checkouts' );
857
    is( $old_checkouts->count, 1, 'Count is correct for old checkouts' );
858
859
    $schema->storage->txn_rollback;
860
};
861
825
sub component_record1 {
862
sub component_record1 {
826
    my $marc = MARC::Record->new;
863
    my $marc = MARC::Record->new;
827
    $marc->append_fields(
864
    $marc->append_fields(
828
- 

Return to bug 29288