Bugzilla – Attachment 140401 Details for
Bug 27550
"Duplicate budget" does not keep users associated with the funds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27550: Add unit test for CloneBudgetHierarchy
Bug-27550-Add-unit-test-for-CloneBudgetHierarchy.patch (text/plain), 2.47 KB, created by
Katrin Fischer
on 2022-09-11 13:55:38 UTC
(
hide
)
Description:
Bug 27550: Add unit test for CloneBudgetHierarchy
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-09-11 13:55:38 UTC
Size:
2.47 KB
patch
obsolete
>From d2f794e38a39297610c0342c183a0d5c2c3ee17e Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 8 Sep 2022 12:20:11 +0200 >Subject: [PATCH] Bug 27550: Add unit test for CloneBudgetHierarchy > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Budgets/CloneBudgetHierarchy.t | 62 +++++++++++++++++++ > 1 file changed, 62 insertions(+) > create mode 100755 t/db_dependent/Budgets/CloneBudgetHierarchy.t > >diff --git a/t/db_dependent/Budgets/CloneBudgetHierarchy.t b/t/db_dependent/Budgets/CloneBudgetHierarchy.t >new file mode 100755 >index 0000000000..be221dcb00 >--- /dev/null >+++ b/t/db_dependent/Budgets/CloneBudgetHierarchy.t >@@ -0,0 +1,62 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use Test::More; >+ >+use Koha::Database; >+use Koha::Acquisition::Budget; >+use Koha::Acquisition::Fund; >+ >+use C4::Budgets qw(AddBudget CloneBudgetHierarchy GetBudgetHierarchy); >+ >+use t::lib::TestBuilder; >+ >+plan tests => 1; >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'CloneBudgetHierarchy should clone budget users too' => sub { >+ plan tests => 1; >+ $schema->txn_begin; >+ >+ my $aqbudgetperiod_rs = $schema->resultset('Aqbudgetperiod'); >+ my $budget_1 = Koha::Acquisition::Budget->new( >+ { >+ budget_period_startdate => '2000-01-01', >+ budget_period_enddate => '2999-12-31', >+ } >+ )->store; >+ >+ my $budget_1_fund_1 = Koha::Acquisition::Fund->new( >+ { >+ budget_period_id => $budget_1->id, >+ } >+ )->store; >+ >+ my $patron_1 = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' }); >+ >+ C4::Budgets::ModBudgetUsers($budget_1_fund_1->id, $patron_1->id, $patron_2->id); >+ >+ my $budget_2 = Koha::Acquisition::Budget->new( >+ { >+ budget_period_startdate => '2000-01-01', >+ budget_period_enddate => '2999-12-31', >+ } >+ )->store; >+ >+ CloneBudgetHierarchy( >+ { >+ budgets => C4::Budgets::GetBudgetHierarchy($budget_1->id), >+ new_budget_period_id => $budget_2->id, >+ } >+ ); >+ >+ my @funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_2->id })->as_list; >+ my @borrowernumbers = C4::Budgets::GetBudgetUsers($funds[0]->id); >+ is_deeply(\@borrowernumbers, [$patron_1->id, $patron_2->id], 'cloned budget has the same users as the original'); >+ >+ $schema->txn_rollback; >+}; >-- >2.30.2
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 27550
:
127400
|
127975
|
128050
|
140334
|
140400
| 140401