Bugzilla – Attachment 17650 Details for
Bug 5336
Acq history search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5336: Add unit tests for 3 acq routines
Bug-5336-Add-unit-tests-for-3-acq-routines.patch (text/plain), 3.78 KB, created by
Jonathan Druart
on 2013-04-24 12:57:51 UTC
(
hide
)
Description:
Bug 5336: Add unit tests for 3 acq routines
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-04-24 12:57:51 UTC
Size:
3.78 KB
patch
obsolete
>From ff5333be2bf96b80a79a56904a645724284a79e4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 23 Apr 2013 16:50:22 +0200 >Subject: [PATCH] Bug 5336: Add unit tests for 3 acq routines > >Unit tests In C4::Acquisition for: >- CloseBasket >- ReopenBasket >- GetBiblioCountByBasketno >--- > t/db_dependent/Acquisition/close_reopen_basket.t | 75 ++++++++++++++++++++++ > t/db_dependent/lib/KohaTest/Acquisition.pm | 2 + > 2 files changed, 77 insertions(+) > create mode 100644 t/db_dependent/Acquisition/close_reopen_basket.t > >diff --git a/t/db_dependent/Acquisition/close_reopen_basket.t b/t/db_dependent/Acquisition/close_reopen_basket.t >new file mode 100644 >index 0000000..51c7b8d >--- /dev/null >+++ b/t/db_dependent/Acquisition/close_reopen_basket.t >@@ -0,0 +1,75 @@ >+#!/usr/bin/env perl >+ >+use Modern::Perl; >+ >+use Test::More; >+use C4::Acquisition; >+use C4::Bookseller; >+use C4::Budgets; >+ >+my $booksellerid = C4::Bookseller::AddBookseller( >+ { >+ name => "my vendor", >+ address1 => "bookseller's address", >+ phone => "0123456", >+ active => 1 >+ } >+); >+ >+my $basketno = C4::Acquisition::NewBasket( >+ $booksellerid >+); >+ >+my $budgetid = C4::Budgets::AddBudget( >+ { >+ budget_code => "budget_code_test_close_reopen", >+ budget_name => "budget_name_test_close_reopen", >+ } >+); >+ >+my $budget = C4::Budgets::GetBudget( $budgetid ); >+ >+my ($ordernumber1, $ordernumber2); >+( undef, $ordernumber1 ) = C4::Acquisition::NewOrder( >+ { >+ basketno => $basketno, >+ quantity => 24, >+ biblionumber => 1, >+ budget_id => $budget->{budget_id}, >+ } >+); >+ >+( undef, $ordernumber2 ) = C4::Acquisition::NewOrder( >+ { >+ basketno => $basketno, >+ quantity => 42, >+ biblionumber => 2, >+ budget_id => $budget->{budget_id}, >+ } >+); >+ >+my $nb_biblio = C4::Acquisition::GetBiblioCountByBasketno( $basketno ); >+is ( $nb_biblio, 2, "There are 2 biblio for this basket" ); >+my @orders = C4::Acquisition::GetOrders( $basketno ); >+is( scalar(@orders), 2, "2 orders are created" ); >+is ( scalar( map { $_->{orderstatus} == 0 ? 1 : () } @orders ), 2, "2 order are new before closing the basket" ); >+ >+C4::Acquisition::CloseBasket( $basketno ); >+@orders = C4::Acquisition::GetOrders( $basketno ); >+is ( scalar( map { $_->{orderstatus} == 1 ? 1 : () } @orders ), 2, "2 orders are ordered, the basket is closed" ); >+ >+C4::Acquisition::ReopenBasket( $basketno ); >+@orders = C4::Acquisition::GetOrders( $basketno ); >+is ( scalar( map { $_->{orderstatus} == 1 ? 1 : () } @orders ), 0, "No order are ordered, the basket is reopen" ); >+is ( scalar( map { $_->{orderstatus} == 0 ? 1 : () } @orders ), 2, "2 order are new, the basket is reopen" ); >+ >+ >+END { >+ C4::Acquisition::DelOrder( 1, $ordernumber1 ); >+ C4::Acquisition::DelOrder( 2, $ordernumber2 ); >+ C4::Budgets::DelBudget( $budgetid ); >+ C4::Acquisition::DelBasket( $basketno ); >+ C4::Bookseller::DelBookseller( $booksellerid ); >+}; >+ >+done_testing; >diff --git a/t/db_dependent/lib/KohaTest/Acquisition.pm b/t/db_dependent/lib/KohaTest/Acquisition.pm >index e7618c9..6966ffc 100644 >--- a/t/db_dependent/lib/KohaTest/Acquisition.pm >+++ b/t/db_dependent/lib/KohaTest/Acquisition.pm >@@ -20,6 +20,7 @@ sub methods : Test( 1 ) { > my @methods = qw( GetBasket > NewBasket > CloseBasket >+ ReopenBasket > GetPendingOrders > GetOrders > GetOrderNumber >@@ -34,6 +35,7 @@ sub methods : Test( 1 ) { > GetLateOrders > GetHistory > GetRecentAcqui >+ GetBiblioCountByBasketno > ); > > can_ok( $self->testing_class, @methods ); >-- >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 5336
:
11603
|
11604
|
11792
|
14067
|
14188
|
14213
|
16013
|
17612
|
17613
|
17615
|
17617
|
17648
|
17649
|
17650
|
17883
|
18187
|
18411
|
18412
|
18413
|
18414
|
18496
|
18497
|
18498
|
18499
|
18500
|
19317
|
19318
|
19319
|
19320
|
19321
|
19550
|
20894
|
20895
|
20896
|
20897
|
20898
|
20899
|
21689
|
21690
|
21691
|
21692
|
21693
|
21694
|
21695
|
21696
|
21697
|
21707
|
21708
|
21709
|
21751
|
21752
|
21753
|
21754
|
21755
|
21756
|
21757
|
21758