Bugzilla – Attachment 101089 Details for
Bug 24830
dbic_merge_prefetch is not handling recursive cases correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24830: Add tests
Bug-24830-Add-tests.patch (text/plain), 2.89 KB, created by
Kyle M Hall (khall)
on 2020-03-20 12:18:26 UTC
(
hide
)
Description:
Bug 24830: Add tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-03-20 12:18:26 UTC
Size:
2.89 KB
patch
obsolete
>From 1ab473f52c78be900dc5febcfd301a6cc1bd051c Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Thu, 12 Mar 2020 18:47:40 -0300 >Subject: [PATCH] Bug 24830: Add tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/Koha/REST/Plugin/Query.t | 63 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 60 insertions(+), 3 deletions(-) > >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 0ddd6fcb0a..8a275774da 100644 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -24,6 +24,7 @@ use Try::Tiny; > use Koha::Cities; > use Koha::Holds; > use Koha::Biblios; >+use Koha::Patron::Relationship; > > app->log->level('error'); > >@@ -135,6 +136,50 @@ get '/dbic_merge_prefetch' => sub { > $c->render( json => $attributes, status => 200 ); > }; > >+get '/dbic_merge_prefetch_recursive' => sub { >+ my $c = shift; >+ my $attributes = {}; >+ my $result_set = Koha::Patron::Relationship->new; >+ $c->stash('koha.embed', { >+ "guarantee" => { >+ "children" => { >+ "article_requests" => {}, >+ "housebound_profile" => { >+ "children" => { >+ "housebound_visits" => {} >+ } >+ }, >+ "housebound_role" => {} >+ } >+ } >+ }); >+ >+ $c->dbic_merge_prefetch({ >+ attributes => $attributes, >+ result_set => $result_set >+ }); >+ >+ $c->render( json => $attributes, status => 200 ); >+}; >+ >+get '/dbic_merge_prefetch_count' => sub { >+ my $c = shift; >+ my $attributes = {}; >+ my $result_set = Koha::Patron::Relationship->new; >+ $c->stash('koha.embed', { >+ "guarantee_count" => { >+ "is_count" => 1 >+ } >+ }); >+ >+ $c->dbic_merge_prefetch({ >+ attributes => $attributes, >+ result_set => $result_set >+ }); >+ >+ $c->render( json => $attributes, status => 200 ); >+}; >+ > get '/merge_q_params' => sub { > my $c = shift; > my $filtered_params = {'biblio_id' => 1}; >@@ -298,13 +343,25 @@ subtest 'dbic_merge_sorting() tests' => sub { > }; > > subtest '/dbic_merge_prefetch' => sub { >- plan tests => 4; >+ plan tests => 10; > > my $t = Test::Mojo->new; > > $t->get_ok('/dbic_merge_prefetch')->status_is(200) >- ->json_like( '/prefetch/0' => qr/item|biblio/ ) >- ->json_like( '/prefetch/1' => qr/item|biblio/ ); >+ ->json_is( '/prefetch/0' => 'biblio' ) >+ ->json_is( '/prefetch/1' => 'item' ); >+ >+ $t->get_ok('/dbic_merge_prefetch_recursive')->status_is(200) >+ ->json_is('/prefetch/0' => { >+ guarantee => [ >+ 'article_requests', >+ {housebound_profile => 'housebound_visits'}, >+ 'housebound_role' >+ ] >+ }); >+ >+ $t->get_ok('/dbic_merge_prefetch_count')->status_is(200) >+ ->json_is('/prefetch/0' => 'guarantee'); > }; > > subtest '/merge_q_params' => sub { >-- >2.21.1 (Apple Git-122.3)
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 24830
:
100393
|
100664
|
100665
|
100666
|
100689
|
100690
| 101089 |
101090