Bugzilla – Attachment 126973 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.37 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-27 11:46:07 UTC
(
hide
)
Description:
Bug 29288: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-27 11:46:07 UTC
Size:
2.37 KB
patch
obsolete
>From e3064baa402d1988a40399d35ff0e6049aa742b4 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> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Biblio.t | 39 +++++++++++++++++++++++++++++++++++- > 1 file changed, 38 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 218015bec6..73dcb2ab13 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,10 +17,12 @@ > > use Modern::Perl; > >-use Test::More tests => 18; >+use Test::More tests => 19; > use Test::Warn; > > use C4::Biblio qw( AddBiblio ModBiblio ModBiblioMarc ); >+use C4::Circulation qw( AddIssue AddReturn ); >+ > use Koha::Database; > use Koha::Caches; > use Koha::Acquisition::Orders; >@@ -822,6 +824,41 @@ 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; >+}; >+ > sub component_record1 { > my $marc = MARC::Record->new; > $marc->append_fields( >-- >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