Bugzilla – Attachment 89613 Details for
Bug 22850
SharedContent.t wrongly use ->set_userenv
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22850: Do no longer use set_userenv in tests (SharedContent.t)
Bug-22850-Do-no-longer-use-setuserenv-in-tests-Sha.patch (text/plain), 3.02 KB, created by
Katrin Fischer
on 2019-05-11 16:22:38 UTC
(
hide
)
Description:
Bug 22850: Do no longer use set_userenv in tests (SharedContent.t)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-05-11 16:22:38 UTC
Size:
3.02 KB
patch
obsolete
>From 3084cf10a309a6091b3184776dd9c8fc4aebb9c4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 4 May 2019 12:31:05 -0400 >Subject: [PATCH] Bug 22850: Do no longer use set_userenv in tests > (SharedContent.t) > >Since bug 21817 we should use the mock_userenv subroutine instead. > >Test plan: >The tests must pass after this patch > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Koha/SharedContent.t | 29 ++++++++++++----------------- > 1 file changed, 12 insertions(+), 17 deletions(-) > >diff --git a/t/db_dependent/Koha/SharedContent.t b/t/db_dependent/Koha/SharedContent.t >index 67be87ec55..2739afbce6 100644 >--- a/t/db_dependent/Koha/SharedContent.t >+++ b/t/db_dependent/Koha/SharedContent.t >@@ -111,19 +111,20 @@ is($request->method, 'POST', 'Share report - Method is post'); > is($request->uri->path, '/report.json', 'Path is report.json'); > > # prepare shared data >-my $loggedinuser = $builder->build({ >- source => 'Borrower', >+my $library = $builder->build_object({ >+ class => 'Koha::Libraries', >+}); >+ >+my $loggedinuser = $builder->build_object({ >+ class => 'Koha::Patrons', > value => { > email => '', > emailpro => '', >- B_email => '' >+ B_email => '', >+ branchcode => $library->branchcode, > } > }); > >-my $library = $builder->build({ >- source => 'Branch', >-}); >- > my $biblio = $builder->build({ > source => 'Biblio', > }); >@@ -153,17 +154,12 @@ my $subscription = $builder->build({ > } > }); > >-C4::Context->_new_userenv('xxx'); >-C4::Context->set_userenv(0,0,0, >- $loggedinuser->{firstname}, >- $loggedinuser->{surname}, >- $library->{branchcode}, >- 'Midway Public Library', '', '', ''); >+t::lib::Mocks::mock_userenv({ patron => $loggedinuser}); > > t::lib::Mocks::mock_preference('language', 'en'); > > $post_request = 1; >-$result = Koha::SharedContent::send_entity('en', $loggedinuser->{borrowernumber}, $subscription->{subscriptionid}, 'subscription'); >+$result = Koha::SharedContent::send_entity('en', $loggedinuser->borrowernumber, $subscription->{subscriptionid}, 'subscription'); > is($result->{code}, 200, 'send_entity success'); > > my $s = Koha::Subscriptions->find($subscription->{subscriptionid}); >@@ -171,14 +167,13 @@ is($s->mana_id, 5, 'Mana id is set'); > > my $data = Koha::SharedContent::prepare_entity_data( > '', >- $loggedinuser->{borrowernumber}, >+ $loggedinuser->borrowernumber, > $subscription->{subscriptionid}, > 'subscription' > ); > > is($data->{language}, 'en', 'Language is set to default'); >-my $branch = Koha::Libraries->find($library->{branchcode}); >-is($data->{exportemail}, $branch->branchemail, 'Email is set with the userenv branch one'); >+is($data->{exportemail}, $library->branchemail, 'Email is set with the userenv branch one'); > is($data->{title}, $biblio->{title}, 'Shared title'); > is($data->{sfdescription}, $subscriptionFrequency->{description}, 'Shared sfdescription'); > is($data->{unit}, $subscriptionFrequency->{unit}, 'Shared unit'); >-- >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 22850
:
89353
|
89578
| 89613