Bugzilla – Attachment 97652 Details for
Bug 24430
Remove C4::Biblio::CountBiblioInOrders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24430: Unit tests
Bug-24430-Unit-tests.patch (text/plain), 2.34 KB, created by
Martin Renvoize (ashimema)
on 2020-01-21 11:23:14 UTC
(
hide
)
Description:
Bug 24430: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-21 11:23:14 UTC
Size:
2.34 KB
patch
obsolete
>From f06578b34e9a31ff9b2ee3575b3770a88fccdece Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 15 Jan 2020 16:25:19 -0300 >Subject: [PATCH] Bug 24430: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Biblio.t | 49 +++++++++++++++++++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index e3a41399bb..03ddbef7ff 100644 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,10 +17,11 @@ > > use Modern::Perl; > >-use Test::More tests => 10; >+use Test::More tests => 11; > > use C4::Biblio; > use Koha::Database; >+use Koha::Acquisition::Orders; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -490,3 +491,49 @@ subtest 'suggestions() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'orders() and active_orders_count() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio(); >+ >+ my $orders = $biblio->orders; >+ my $active_orders_count = $biblio->active_orders_count; >+ >+ is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); >+ is( $orders->count, $active_orders_count, '->orders_count returns the count for the resultset' ); >+ >+ # Add a couple orders >+ foreach (1..2) { >+ $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ biblionumber => $biblio->biblionumber, >+ datecancellationprinted => '2019-12-31' >+ } >+ } >+ ); >+ } >+ >+ $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ biblionumber => $biblio->biblionumber, >+ datecancellationprinted => undef >+ } >+ } >+ ); >+ >+ $orders = $biblio->orders; >+ $active_orders_count = $biblio->active_orders_count; >+ >+ is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); >+ is( $orders->count, $active_orders_count + 2, '->active_orders_count returns the rigt count' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.20.1
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 24430
:
97414
|
97415
|
97416
|
97443
|
97446
|
97447
|
97448
|
97563
|
97564
|
97565
| 97652 |
97653
|
97654