Bugzilla – Attachment 93888 Details for
Bug 23770
Add Koha::Object(s)->to_api method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23770: (follow-up) Add tests for Koha::Objects->TO_JSON
Bug-23770-follow-up-Add-tests-for-KohaObjects-TOJS.patch (text/plain), 1.65 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-10-08 15:52:11 UTC
(
hide
)
Description:
Bug 23770: (follow-up) Add tests for Koha::Objects->TO_JSON
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-10-08 15:52:11 UTC
Size:
1.65 KB
patch
obsolete
>From e906664dc42f3fc4cc355aa1affdbe8f0a3f0397 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 8 Oct 2019 12:51:52 -0300 >Subject: [PATCH] Bug 23770: (follow-up) Add tests for Koha::Objects->TO_JSON > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Objects.t | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index 8cd7c437ac..592ab40866 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 16; >+use Test::More tests => 17; > use Test::Exception; > use Test::Warn; > >@@ -305,3 +305,28 @@ subtest "to_api() tests" => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest "TO_JSON() tests" => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $city_1 = $builder->build_object( { class => 'Koha::Cities' } ); >+ my $city_2 = $builder->build_object( { class => 'Koha::Cities' } ); >+ >+ my $cities = Koha::Cities->search( >+ { >+ cityid => [ $city_1->cityid, $city_2->cityid ] >+ }, >+ { -orderby => { -desc => 'cityid' } } >+ ); >+ >+ is( $cities->count, 2, 'Count is correct' ); >+ my $cities_json = $cities->TO_JSON; >+ is( ref($cities_json), 'ARRAY', 'to_api returns an array' ); >+ is_deeply( $cities_json->[0], $city_1->TO_JSON, 'TO_JSON returns the individual objects with ->TO_JSON' ); >+ is_deeply( $cities_json->[1], $city_2->TO_JSON,'TO_JSON returns the individual objects with ->TO_JSON' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.23.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 23770
:
93831
|
93881
|
93882
|
93883
|
93888
|
93890
|
93891
|
93892
|
93893
|
93894
|
93895
|
94396
|
94397
|
94398
|
94399
|
94400