Bugzilla – Attachment 19920 Details for
Bug 5349
Moving an order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5349: Add unit tests for TransferOrder
Bug-5349-Add-unit-tests-for-TransferOrder.patch (text/plain), 2.96 KB, created by
Julian Maurice
on 2013-07-24 06:53:57 UTC
(
hide
)
Description:
Bug 5349: Add unit tests for TransferOrder
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2013-07-24 06:53:57 UTC
Size:
2.96 KB
patch
obsolete
>From 403137176856dda3abe0de7dcada6f39b19be931 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 13 Jun 2013 12:44:11 +0000 >Subject: [PATCH] Bug 5349: Add unit tests for TransferOrder > >--- > t/db_dependent/Acquisition/TransferOrder.t | 86 ++++++++++++++++++++++++++++ > 1 file changed, 86 insertions(+) > create mode 100644 t/db_dependent/Acquisition/TransferOrder.t > >diff --git a/t/db_dependent/Acquisition/TransferOrder.t b/t/db_dependent/Acquisition/TransferOrder.t >new file mode 100644 >index 0000000..fd294e2 >--- /dev/null >+++ b/t/db_dependent/Acquisition/TransferOrder.t >@@ -0,0 +1,86 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use Test::More; >+use C4::Acquisition; >+use C4::Biblio; >+use C4::Items; >+use C4::Bookseller; >+use C4::Budgets; >+use MARC::Record; >+ >+my $booksellerid1 = C4::Bookseller::AddBookseller( >+ { >+ name => "my vendor 1", >+ address1 => "bookseller's address", >+ phone => "0123456", >+ active => 1 >+ } >+); >+ >+my $basketno1 = C4::Acquisition::NewBasket( >+ $booksellerid1 >+); >+ >+my $booksellerid2 = C4::Bookseller::AddBookseller( >+ { >+ name => "my vendor 2", >+ address1 => "bookseller's address", >+ phone => "0123456", >+ active => 1 >+ } >+); >+ >+my $basketno2 = C4::Acquisition::NewBasket( >+ $booksellerid2 >+); >+ >+my $budgetid = C4::Budgets::AddBudget( >+ { >+ budget_code => "budget_code_test_transferorder", >+ budget_name => "budget_name_test_transferorder", >+ } >+); >+ >+my $budget = C4::Budgets::GetBudget( $budgetid ); >+ >+my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); >+my $itemnumber = AddItem({}, $biblionumber); >+ >+my ( undef, $ordernumber ) = C4::Acquisition::NewOrder( >+ { >+ basketno => $basketno1, >+ quantity => 24, >+ biblionumber => $biblionumber, >+ budget_id => $budget->{budget_id}, >+ } >+); >+NewOrderItem($itemnumber, $ordernumber); >+ >+# Begin tests >+my $order; >+is(scalar GetOrders($basketno1), 1, "1 order in basket1"); >+($order) = GetOrders($basketno1); >+is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 1, "1 item in basket1's order"); >+is(scalar GetOrders($basketno2), 0, "0 order in basket2"); >+ >+diag("Transfering order to basket2"); >+my $newordernumber = TransferOrder($ordernumber, $basketno2); >+is(scalar GetOrders($basketno1), 0, "0 order in basket1"); >+is(scalar GetOrders($basketno2), 1, "1 order in basket2"); >+($order) = GetOrders($basketno2); >+is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 1, "1 item in basket2's order"); >+ >+END { >+ C4::Acquisition::DelOrder( $biblionumber, $ordernumber ); >+ C4::Acquisition::DelOrder( $biblionumber, $newordernumber ); >+ C4::Budgets::DelBudget( $budgetid ); >+ C4::Acquisition::DelBasket( $basketno1 ); >+ C4::Bookseller::DelBookseller( $booksellerid1 ); >+ C4::Acquisition::DelBasket( $basketno2 ); >+ C4::Bookseller::DelBookseller( $booksellerid2 ); >+ C4::Biblio::DelBiblio($biblionumber); >+}; >+ >+done_testing; >-- >1.7.10.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 5349
:
8961
|
8962
|
9909
|
10032
|
10190
|
10375
|
10376
|
10441
|
10462
|
10463
|
10636
|
11117
|
11118
|
11385
|
11386
|
12236
|
12237
|
12238
|
12420
|
12421
|
12422
|
12462
|
12463
|
12464
|
14441
|
14442
|
14443
|
16499
|
16500
|
16501
|
18931
|
18933
|
18934
|
18935
|
19332
|
19333
|
19336
|
19917
|
19918
|
19919
|
19920
|
19921
|
19922
|
20476
|
20477
|
20478
|
20479
|
20480
|
20481
|
20691
|
20692
|
20693
|
20694
|
20695
|
20696