Lines 17-25
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 16; |
20 |
use Test::More tests => 17; |
21 |
|
21 |
|
22 |
use C4::Biblio qw( AddBiblio ModBiblio ); |
22 |
use C4::Biblio qw( AddBiblio ModBiblio ); |
|
|
23 |
use C4::Circulation qw( AddIssue AddReturn ); |
23 |
use Koha::Database; |
24 |
use Koha::Database; |
24 |
use Koha::Caches; |
25 |
use Koha::Caches; |
25 |
use Koha::Acquisition::Orders; |
26 |
use Koha::Acquisition::Orders; |
Lines 736-738
subtest 'article_requests() tests' => sub {
Link Here
|
736 |
|
737 |
|
737 |
$schema->storage->txn_rollback; |
738 |
$schema->storage->txn_rollback; |
738 |
}; |
739 |
}; |
739 |
- |
740 |
|
|
|
741 |
subtest 'current_checkouts() and old_checkouts() tests' => sub { |
742 |
|
743 |
plan tests => 4; |
744 |
|
745 |
$schema->storage->txn_begin; |
746 |
|
747 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
748 |
|
749 |
my $patron_1 = $builder->build_object({ class => 'Koha::Patrons' })->unblessed; |
750 |
my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' })->unblessed; |
751 |
|
752 |
my $item_1 = $builder->build_sample_item; |
753 |
my $item_2 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber }); |
754 |
|
755 |
t::lib::Mocks::mock_userenv({ branchcode => $library->id }); |
756 |
|
757 |
AddIssue( $patron_1, $item_1->barcode ); |
758 |
AddIssue( $patron_1, $item_2->barcode ); |
759 |
|
760 |
AddReturn( $item_1->barcode ); |
761 |
AddIssue( $patron_2, $item_1->barcode ); |
762 |
|
763 |
my $biblio = $item_1->biblio; |
764 |
my $current_checkouts = $biblio->current_checkouts; |
765 |
my $old_checkouts = $biblio->old_checkouts; |
766 |
|
767 |
is( ref($current_checkouts), 'Koha::Checkouts', 'Type is correct' ); |
768 |
is( ref($old_checkouts), 'Koha::Old::Checkouts', 'Type is correct' ); |
769 |
|
770 |
is( $current_checkouts->count, 2, 'Count is correct for current checkouts' ); |
771 |
is( $old_checkouts->count, 1, 'Count is correct for old checkouts' ); |
772 |
|
773 |
$schema->storage->txn_rollback; |
774 |
}; |