Bugzilla – Attachment 101560 Details for
Bug 24965
Koha::Object->to_api should handle undef counts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24965: Regression tests
Bug-24965-Regression-tests.patch (text/plain), 1.53 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-03-24 13:04:27 UTC
(
hide
)
Description:
Bug 24965: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-03-24 13:04:27 UTC
Size:
1.53 KB
patch
obsolete
>From 717a4377bab484debde2b8fbdce6e78d97978b5a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 24 Mar 2020 09:23:37 -0300 >Subject: [PATCH] Bug 24965: Regression tests > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Object.t >=> FAIL: Tests fail with "Can't call method "count" on an undefined >value..." > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Object.t | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index 73e4e10762..6858a1c34e 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -215,7 +215,7 @@ subtest 'TO_JSON tests' => sub { > > subtest "to_api() tests" => sub { > >- plan tests => 28; >+ plan tests => 29; > > $schema->storage->txn_begin; > >@@ -365,6 +365,19 @@ subtest "to_api() tests" => sub { > 'Koha::Exceptions::Object::MethodNotCoveredByTests', > 'Unknown method exception thrown if is_count not specified'; > >+ # Simulate a situation in which the relation returns undef instead of an empty iterator >+ my $patron_class = Test::MockModule->new('Koha::Patron'); >+ $patron_class->mock( 'holds', sub { >+ return; >+ }); >+ >+ $patron_api = $patron->to_api( >+ { >+ embed => { holds_count => { is_count => 1 } } >+ } >+ ); >+ is( $patron_api->{holds_count}, 0, 'Count embeds returns 0 if the relation is undef' ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.26.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 24965
:
101560
|
101561
|
102154
|
102155