Bugzilla – Attachment 149691 Details for
Bug 11844
Additional fields for order lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11844: Add tests for TransferOrder
Bug-11844-Add-tests-for-TransferOrder.patch (text/plain), 3.09 KB, created by
Martin Renvoize (ashimema)
on 2023-04-14 15:07:27 UTC
(
hide
)
Description:
Bug 11844: Add tests for TransferOrder
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-04-14 15:07:27 UTC
Size:
3.09 KB
patch
obsolete
>From 44caa4f601963fda6c45d23b8008217cdd45a3e6 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 29 Mar 2023 11:44:56 +0200 >Subject: [PATCH] Bug 11844: Add tests for TransferOrder > >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Object/Mixin/AdditionalFields.pm | 1 + > t/db_dependent/Acquisition/TransferOrder.t | 38 +++++++++++++++++++++- > 2 files changed, 38 insertions(+), 1 deletion(-) > >diff --git a/Koha/Object/Mixin/AdditionalFields.pm b/Koha/Object/Mixin/AdditionalFields.pm >index 7990eba37c..bf6598d8c9 100644 >--- a/Koha/Object/Mixin/AdditionalFields.pm >+++ b/Koha/Object/Mixin/AdditionalFields.pm >@@ -1,6 +1,7 @@ > package Koha::Object::Mixin::AdditionalFields; > > use Modern::Perl; >+use Koha::AdditionalFields; > use Koha::AdditionalFieldValues; > > =head1 NAME >diff --git a/t/db_dependent/Acquisition/TransferOrder.t b/t/db_dependent/Acquisition/TransferOrder.t >index a9e59a5637..fc38127049 100755 >--- a/t/db_dependent/Acquisition/TransferOrder.t >+++ b/t/db_dependent/Acquisition/TransferOrder.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 13; >+use Test::More tests => 14; > use C4::Context; > use C4::Acquisition qw( NewBasket GetOrders GetOrder TransferOrder SearchOrders ModReceiveOrder CancelReceipt ); > use C4::Biblio; >@@ -14,6 +14,7 @@ use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Orders; > use t::lib::TestBuilder; > use MARC::Record; >+use String::Random qw(random_string); > > my $schema = Koha::Database->new()->schema(); > $schema->storage->txn_begin(); >@@ -110,4 +111,39 @@ $order = GetOrder( $newordernumber ); > is ( $order->{ordernumber}, $newordernumber, 'Regression test Bug 11549: After a transfer, receive and cancel the receive should be possible.' ); > is ( $order->{basketno}, $basketno2, 'Regression test Bug 11549: The order still exist in the basket where the transfer has been done.'); > >+subtest 'TransferOrder should copy additional fields' => sub { >+ plan tests => 2; >+ >+ my $field = Koha::AdditionalField->new( >+ { >+ tablename => 'aqorders', >+ name => random_string('c' x 100), >+ } >+ ); >+ $field->store()->discard_changes(); >+ my $order = Koha::Acquisition::Order->new( >+ { >+ basketno => $basketno1, >+ quantity => 2, >+ biblionumber => $biblionumber, >+ budget_id => $budget->{budget_id}, >+ } >+ )->store; >+ $order->set_additional_fields( >+ [ >+ { >+ id => $field->id, >+ value => 'additional field value', >+ }, >+ ] >+ ); >+ >+ my $newordernumber = TransferOrder($order->ordernumber, $basketno2); >+ my $neworder = Koha::Acquisition::Orders->find($newordernumber); >+ my $field_values = $neworder->additional_field_values()->as_list; >+ >+ is(scalar @$field_values, 1, 'transfered order has one additional field value'); >+ is($field_values->[0]->value, 'additional field value', 'transfered order additional field has the correct value'); >+}; >+ > $schema->storage->txn_rollback(); >-- >2.40.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 11844
:
25632
|
25638
|
41859
|
41860
|
45674
|
45675
|
45676
|
45758
|
45915
|
45916
|
45917
|
53614
|
53615
|
53616
|
53618
|
53619
|
55529
|
75332
|
75362
|
141116
|
145517
|
145535
|
145536
|
145540
|
146497
|
146500
|
146501
|
146502
|
146503
|
146504
|
146505
|
146506
|
148889
|
148895
|
148897
|
149081
|
149082
|
149083
|
149084
|
149085
|
149086
|
149087
|
149088
|
149089
|
149090
|
149091
|
149682
|
149683
|
149684
|
149685
|
149686
|
149687
|
149688
|
149689
|
149690
|
149691
|
149692
|
150537
|
150538
|
150539
|
150540
|
150541
|
150542
|
150543
|
150544
|
150545
|
150546
|
150547
|
150548
|
151220
|
151221
|
151222
|
151223
|
151224
|
151225
|
151226
|
151227
|
151228
|
151229
|
151230
|
151366