Bugzilla – Attachment 126614 Details for
Bug 29288
Add current_checkouts and old_checkouts methods to Koha::Biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29288: Unit tests
Bug-29288-Unit-tests.patch (text/plain), 2.17 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-20 21:03:38 UTC
(
hide
)
Description:
Bug 29288: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-20 21:03:38 UTC
Size:
2.17 KB
patch
obsolete
>From 2aaa799ed2da45432d5d88d9180aa342f576d60a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 20 Oct 2021 18:01:42 -0300 >Subject: [PATCH] Bug 29288: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Biblio.t | 38 +++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index f294606f30..710ab3ba15 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,9 +17,10 @@ > > use Modern::Perl; > >-use Test::More tests => 16; >+use Test::More tests => 17; > > use C4::Biblio qw( AddBiblio ModBiblio ); >+use C4::Circulation qw( AddIssue AddReturn ); > use Koha::Database; > use Koha::Caches; > use Koha::Acquisition::Orders; >@@ -736,3 +737,38 @@ subtest 'article_requests() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'current_checkouts() and old_checkouts() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build_object({ class => 'Koha::Libraries' }); >+ >+ my $patron_1 = $builder->build_object({ class => 'Koha::Patrons' })->unblessed; >+ my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' })->unblessed; >+ >+ my $item_1 = $builder->build_sample_item; >+ my $item_2 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber }); >+ >+ t::lib::Mocks::mock_userenv({ branchcode => $library->id }); >+ >+ AddIssue( $patron_1, $item_1->barcode ); >+ AddIssue( $patron_1, $item_2->barcode ); >+ >+ AddReturn( $item_1->barcode ); >+ AddIssue( $patron_2, $item_1->barcode ); >+ >+ my $biblio = $item_1->biblio; >+ my $current_checkouts = $biblio->current_checkouts; >+ my $old_checkouts = $biblio->old_checkouts; >+ >+ is( ref($current_checkouts), 'Koha::Checkouts', 'Type is correct' ); >+ is( ref($old_checkouts), 'Koha::Old::Checkouts', 'Type is correct' ); >+ >+ is( $current_checkouts->count, 2, 'Count is correct for current checkouts' ); >+ is( $old_checkouts->count, 1, 'Count is correct for old checkouts' ); >+ >+ $schema->storage->txn_rollback; >+}; >\ No newline at end of file >-- >2.32.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29288
:
126614
|
126615
|
126629
|
126630
|
126642
|
126643
|
126973
|
126974