Bugzilla – Attachment 97467 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), 2.30 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-01-16 19:01:39 UTC
(
hide
)
Description:
Bug 24440: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-01-16 19:01:39 UTC
Size:
2.30 KB
patch
obsolete
>From ef2359885588fc1a3ad54a1a35ff9d47c0b0c4d2 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> >--- > t/db_dependent/Koha/Acquisition/Order.t | 43 ++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 3b7b68a533..8d5d807910 100644 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -250,3 +250,44 @@ subtest 'duplicate_to | add_item' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'holds() and holds_count() tests' => sub { >+ >+ plan tests => 8; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $order = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { biblionumber => $biblio->biblionumber } >+ } >+ ); >+ >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >+ >+ # Associate items to the order >+ $order->add_item( $item_1->itemnumber ); >+ $order->add_item( $item_2->itemnumber ); >+ >+ my $holds = $order->holds; >+ my @holds = $order->holds; >+ is( ref($holds), 'Koha::Holds', 'Type is correct in scalar context' ); >+ is( scalar @holds, 0, 'Count is correct list context' ); >+ is( $holds->count, 0, 'No holds' ); >+ is( $order->holds_count, 0, 'holds_count is consistent' ); >+ >+ # Add a hold >+ $builder->build_object({ class => 'Koha::Holds', value => { itemnumber => $item_1->itemnumber } }); >+ >+ $holds = $order->holds; >+ @holds = $order->holds; >+ is( scalar @holds, 1, 'Count is correct list context' ); >+ is( $holds->count, 1, 'Count is correct in scalar context' ); >+ is( $order->holds_count, 1, 'holds_count is consistent' ); >+ is( ref($holds[0]), 'Koha::Hold', 'Type is correct for individual holds in list context' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.25.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