Bugzilla – Attachment 98283 Details for
Bug 24440
Add ->current_item_level_holds to Koha::Acquisition::Order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24440: Unit tests
Bug-24440-Unit-tests.patch (text/plain), 3.11 KB, created by
Jonathan Druart
on 2020-02-03 12:37:28 UTC
(
hide
)
Description:
Bug 24440: Unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-02-03 12:37:28 UTC
Size:
3.11 KB
patch
obsolete
>From d93a1ba369955fc0ad5698e0552254aab248c852 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 16 Jan 2020 15:58:15 -0300 >Subject: [PATCH] Bug 24440: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Koha/Acquisition/Order.t | 62 ++++++++++++++++++++++++++++++++- > 1 file changed, 61 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 3b7b68a533..6d2797bf35 100644 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -19,12 +19,13 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > > use t::lib::TestBuilder; > use t::lib::Mocks; > > use Koha::Database; >+use Koha::DateUtils qw(dt_from_string); > > my $schema = Koha::Database->schema; > my $builder = t::lib::TestBuilder->new; >@@ -250,3 +251,62 @@ subtest 'duplicate_to | add_item' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'current_holds() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $biblio = $builder->build_sample_biblio(); >+ my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >+ my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >+ my $item_3 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >+ >+ C4::Reserves::AddReserve( >+ $patron->branchcode, $patron->borrowernumber, >+ $biblio->biblionumber, undef, >+ undef, dt_from_string->add( days => -2 ), >+ undef, undef, >+ undef, $item_1->itemnumber >+ ); >+ C4::Reserves::AddReserve( >+ $patron->branchcode, $patron->borrowernumber, >+ $biblio->biblionumber, undef, >+ undef, dt_from_string->add( days => -2 ), >+ undef, undef, >+ undef, $item_2->itemnumber >+ ); >+ # Add a hold in the future >+ C4::Reserves::AddReserve( >+ $patron->branchcode, $patron->borrowernumber, >+ $biblio->biblionumber, undef, >+ undef, dt_from_string->add( days => 2 ), >+ undef, undef, >+ undef, $item_3->itemnumber >+ ); >+ >+ # Add an order with no biblionumber >+ my $order = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ biblionumber => undef >+ } >+ } >+ ); >+ >+ is( $order->current_holds, undef, 'Returns undef if no linked biblio'); >+ >+ $order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes; >+ >+ is( $order->current_holds, undef, 'Returns undef if no linked items'); >+ >+ $order->add_item( $item_2->itemnumber ); >+ $order->add_item( $item_3->itemnumber ); >+ >+ is( $order->current_holds->count, 1, 'Only current (not future) holds are returned'); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.11.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 24440
:
97467
|
97468
|
97491
|
97492
|
98194
|
98195
|
98196
|
98197
|
98205
|
98206
|
98207
|
98208
|
98237
| 98283 |
98284
|
98285
|
98286
|
98287
|
98288