Bugzilla – Attachment 83124 Details for
Bug 21817
Mock userenv should be a t::lib::Mocks method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21817: Fix 2 failing tests
Bug-21817-Fix-2-failing-tests.patch (text/plain), 2.70 KB, created by
Tomás Cohen Arazi
on 2018-12-12 14:37:42 UTC
(
hide
)
Description:
Bug 21817: Fix 2 failing tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2018-12-12 14:37:42 UTC
Size:
2.70 KB
patch
obsolete
>From 6aada0bf601f034d1a3f4a3fc3129f0a7facb93f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 11 Dec 2018 12:28:53 -0300 >Subject: [PATCH] Bug 21817: Fix 2 failing tests > >--- > t/db_dependent/Acquisition/NewOrder.t | 7 +++++-- > t/db_dependent/Bookseller.t | 4 ++-- > 2 files changed, 7 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Acquisition/NewOrder.t b/t/db_dependent/Acquisition/NewOrder.t >index 96a2d72bfe..79a53ec397 100644 >--- a/t/db_dependent/Acquisition/NewOrder.t >+++ b/t/db_dependent/Acquisition/NewOrder.t >@@ -11,6 +11,7 @@ use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Orders; >+use t::lib::TestBuilder; > use t::lib::Mocks; > > my $schema = Koha::Database->new()->schema(); >@@ -18,7 +19,9 @@ $schema->storage->txn_begin(); > my $dbh = C4::Context->dbh; > $dbh->{RaiseError} = 1; > >-t::lib::Mocks::mock_userenv({ branchcode => 'CPL' }); >+my $builder = t::lib::TestBuilder->new; >+my $logged_in_user = $builder->build_object({ class => 'Koha::Patrons' }); >+t::lib::Mocks::mock_userenv({ patron => $logged_in_user }); > > my $bookseller = Koha::Acquisition::Bookseller->new( > { >@@ -89,6 +92,6 @@ my $ordernumber = $order->ordernumber; > $order = Koha::Acquisition::Orders->find( $ordernumber ); > is( $order->quantityreceived, 0, 'Koha::Acquisition::Order->insert set quantityreceivedto 0 if undef is given' ); > is( $order->entrydate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Koha::Acquisition::Order->store set entrydate to today' ); >-is( $order->created_by, 42, 'Koha::Acquisition::Order->store set created_by to logged in user if not given' ); >+is( $order->created_by, $logged_in_user->borrowernumber, 'Koha::Acquisition::Order->store set created_by to logged in user if not given' ); > > $schema->storage->txn_rollback(); >diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t >index 9e5a193820..c6f4c7fa24 100644 >--- a/t/db_dependent/Bookseller.t >+++ b/t/db_dependent/Bookseller.t >@@ -639,7 +639,7 @@ ok( exists( $suppliers{$id_supplier1} ), > "Supplier1 has late orders and $daysago10==$daysago10 " ) > ; > >-t::lib::Mocks::mock_userenv({ flags => 0 }); >+t::lib::Mocks::mock_userenv({ flags => 0, branchcode => 'BRANCH1' }); > > my $module = Test::MockModule->new('C4::Auth'); > $module->mock( >@@ -670,7 +670,7 @@ is( > ); > > # don the cape and turn into Superlibrarian! >-t::lib::Mocks::mock_userenv({ flags => 1 }); >+t::lib::Mocks::mock_userenv({ flags => 1, branchcode => 'BRANCH1' }); > @subscriptions = SearchSubscriptions({expiration_date => '2013-12-31'}); > is( > scalar(grep { !$_->{cannotdisplay} } @subscriptions ), >-- >2.20.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 21817
:
82250
|
83023
|
83052
|
83123
|
83124
|
83125
|
83126
|
83515
|
83516