Bugzilla – Attachment 98212 Details for
Bug 24528
Add a syntax for specifying counts on x-koha-embed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24528: Unit tests for Koha::Object->to_api
Bug-24528-Unit-tests-for-KohaObject-toapi.patch (text/plain), 2.24 KB, created by
Marcel de Rooy
on 2020-01-31 07:58:42 UTC
(
hide
)
Description:
Bug 24528: Unit tests for Koha::Object->to_api
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-01-31 07:58:42 UTC
Size:
2.24 KB
patch
obsolete
>From 9946992a59db35db5e30c71cf9f02d1df972e88e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 28 Jan 2020 16:14:01 -0300 >Subject: [PATCH] Bug 24528: Unit tests for Koha::Object->to_api >Content-Type: text/plain; charset=utf-8 > >This patch introduces unit tests for the new to_api bejaviour for >*_count methods. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Object.t >=> FAIL: Tests fail because the feature is not implemented > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Koha/Object.t | 37 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index bcee55ca75..5d94b57799 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 => 26; >+ plan tests => 28; > > $schema->storage->txn_begin; > >@@ -330,6 +330,41 @@ subtest "to_api() tests" => sub { > "Exception message correct" > ); > >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ $builder->build_object( >+ { >+ class => 'Koha::Holds', >+ value => { >+ biblionumber => $biblio->biblionumber, >+ borrowernumber => $patron->borrowernumber >+ } >+ } >+ ); >+ $builder->build_object( >+ { >+ class => 'Koha::Holds', >+ value => { >+ biblionumber => $biblio->biblionumber, >+ borrowernumber => $patron->borrowernumber >+ } >+ } >+ ); >+ >+ my $patron_api = $patron->to_api( >+ { >+ embed => { holds_count => { is_count => 1 } } >+ } >+ ); >+ is( $patron_api->{holds_count}, $patron->holds->count, 'Count embeds are supported and work as expected' ); >+ >+ throws_ok >+ { >+ $patron->to_api({ embed => { holds_count => {} } }); >+ } >+ 'Koha::Exceptions::Object::MethodNotCoveredByTests', >+ 'Unknown method exception thrown if is_count not specified'; >+ > $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 24528
:
98046
|
98047
|
98065
|
98199
|
98200
|
98201
| 98212 |
98213
|
98214