Bugzilla – Attachment 79274 Details for
Bug 21401
Account offsets should save the transacting library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21401: Add tests for transaction_library
Bug-21401-Add-tests-for-transactionlibrary.patch (text/plain), 2.46 KB, created by
Josef Moravec
on 2018-09-24 07:47:35 UTC
(
hide
)
Description:
Bug 21401: Add tests for transaction_library
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-09-24 07:47:35 UTC
Size:
2.46 KB
patch
obsolete
>From 21fbdc0d1e2026325f132ef10edb1977a1f7fbb9 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 24 Sep 2018 07:43:53 +0000 >Subject: [PATCH] Bug 21401: Add tests for transaction_library > >--- > t/db_dependent/Koha/Account.t | 43 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 21f0e62..c5d1dfc 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use Koha::Account; > use Koha::Account::Lines; >@@ -192,3 +192,44 @@ subtest 'add_credit() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'transaction library' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ my $account = $patron->account; >+ my $credit1 = $account->add_credit({ >+ amount => 13, >+ description => 'Payment of 13', >+ note => 'some note', >+ }); >+ my $offset1 = Koha::Account::Offsets->search({ credit_id => $credit1->id })->next; >+ is($offset1->transaction_library, undef, "No transaction library without userenv and no library set"); >+ >+ C4::Context->_new_userenv('my_session1'); >+ C4::Context->set_userenv(0,0,0,'firstname','surname', $library1->branchcode, $library1->branchname, '', '', ''); >+ my $credit2 = $account->add_credit({ >+ amount => 14, >+ description => 'Payment of 14', >+ note => 'some note', >+ }); >+ my $offset2 = Koha::Account::Offsets->search({ credit_id => $credit2->id })->next; >+ is($offset2->transaction_library, $library1->branchcode, "Transaction library should be taken from userenv"); >+ >+ my $offset3 = Koha::Account::Offset->new({ >+ amount => 15, >+ type => 'Payment', >+ credit_id => $credit2->id, >+ transaction_library => $library2->branchcode, >+ })->store; >+ my $offset3_from_db = Koha::Account::Offsets->find( $offset3->id ); >+ is($offset3_from_db->transaction_library, $library2->branchcode, "Transaction library should be set when param transaction_library is set"); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.1.4
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 21401
:
79272
|
79273
|
79274
|
79275
|
79284
|
79285
|
79286
|
79287
|
79288
|
79688
|
80355
|
80356
|
80357
|
80358