Bugzilla – Attachment 23051 Details for
Bug 11243
Supplier list counts all items, even canceled ones
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11243: UT: unit tests for GetBasketsInfosByBookseller
Bug-11243-UT-unit-tests-for-GetBasketsInfosByBooks.patch (text/plain), 4.21 KB, created by
Jonathan Druart
on 2013-11-20 09:14:06 UTC
(
hide
)
Description:
Bug 11243: UT: unit tests for GetBasketsInfosByBookseller
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-11-20 09:14:06 UTC
Size:
4.21 KB
patch
obsolete
>From 45ca97c3c76fd7326dee64992226ea4f2c7f52b4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 20 Nov 2013 10:12:56 +0100 >Subject: [PATCH] Bug 11243: UT: unit tests for GetBasketsInfosByBookseller > >Verify prove t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t >returns green. >--- > .../Acquisition/GetBasketsInfosByBookseller.t | 93 ++++++++++++++++++++ > 1 file changed, 93 insertions(+) > create mode 100644 t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t > >diff --git a/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t b/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t >new file mode 100644 >index 0000000..3b4c96b >--- /dev/null >+++ b/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t >@@ -0,0 +1,93 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Test::More tests => 18; >+use Data::Dumper; >+ >+use C4::Acquisition qw( NewOrder NewBasket GetBasketsInfosByBookseller ); >+use C4::Biblio qw( AddBiblio ); >+use C4::Bookseller qw( AddBookseller ); >+use C4::Budgets qw( AddBudget ); >+use C4::Context; >+my $dbh = C4::Context->dbh; >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ >+my $supplierid = C4::Bookseller::AddBookseller( >+ { >+ name => 'my vendor', >+ address1 => 'bookseller\'s address', >+ phone => '0123456', >+ active => 1, >+ deliverytime => 5, >+ } >+); >+ >+my $basketno; >+ok($basketno = NewBasket($supplierid, 1), 'NewBasket( $supplierid , 1 ) returns $basketno'); >+ >+my $budgetid = C4::Budgets::AddBudget( >+ { >+ budget_code => 'budget_code_test_getordersbybib', >+ budget_name => 'budget_name_test_getordersbybib', >+ } >+); >+my $budget = C4::Budgets::GetBudget( $budgetid ); >+ >+my ($ordernumber1, $ordernumber2, $ordernumber3); >+my ($biblionumber1, $biblioitemnumber1) = AddBiblio(MARC::Record->new, ''); >+my ($biblionumber2, $biblioitemnumber2) = AddBiblio(MARC::Record->new, ''); >+my ($biblionumber3, $biblioitemnumber3) = AddBiblio(MARC::Record->new, ''); >+ >+( undef, $ordernumber1 ) = C4::Acquisition::NewOrder( >+ { >+ basketno => $basketno, >+ quantity => 2, >+ biblionumber => $biblionumber1, >+ budget_id => $budget->{budget_id}, >+ } >+); >+ >+( undef, $ordernumber2 ) = C4::Acquisition::NewOrder( >+ { >+ basketno => $basketno, >+ quantity => 4, >+ biblionumber => $biblionumber2, >+ budget_id => $budget->{budget_id}, >+ } >+); >+ >+my $baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); >+is( scalar(@$baskets), 1, 'Start: 1 basket' ); >+my $basket = $baskets->[0]; >+is( $basket->{total_items}, 6, 'Start with 6 items' ); >+is( $basket->{total_biblios}, 2, 'Start with 2 biblios' ); >+is( $basket->{total_items_cancelled}, 0, 'Start with 0 item cancelled' ); >+is( $basket->{total_biblios_cancelled}, 0, 'Start with 0 biblio cancelled' ); >+ >+C4::Acquisition::DelOrder( $biblionumber2, $ordernumber2 ); >+$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); >+is( scalar(@$baskets), 1, 'Order2 deleted, still 1 basket' ); >+$basket = $baskets->[0]; >+is( $basket->{total_items}, 6, 'Order2 deleted, still 6 items' ); >+is( $basket->{total_biblios}, 2, 'Order2 deleted, still 2 biblios' ); >+is( $basket->{total_items_cancelled}, 4, 'Order2 deleted, 4 items cancelled' ); >+is( $basket->{total_biblios_cancelled}, 1, 'Order2 deleted, 2 biblios cancelled' ); >+ >+C4::Acquisition::DelOrder( $biblionumber1, $ordernumber1 ); >+$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); >+is( scalar(@$baskets), 1, 'Both orders deleted, still 1 basket' ); >+$basket = $baskets->[0]; >+is( $basket->{total_items}, 6, 'Both orders deleted, still 6 items' ); >+is( $basket->{total_biblios}, 2, 'Both orders deleted, still 6 biblios' ); >+is( $basket->{total_items_cancelled}, 6, 'Both orders deleted, 6 items cancelled' ); >+is( $basket->{total_biblios_cancelled}, 2, 'Both orders deleted, 2 biblios cancelled' ); >+ >+C4::Acquisition::CloseBasket( $basketno ); >+$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); >+is( scalar(@$baskets), 0, 'Basket is closed, 0 basket opened' ); >+$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid, 1 ); >+is( scalar(@$baskets), 1, 'Basket is closed, test allbasket parameter'); >+ >+ >+$dbh->rollback >-- >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 11243
:
22906
|
22946
|
23050
|
23051
|
23844
|
23845
|
23846
|
27318
|
27319
|
27320