Bugzilla – Attachment 30091 Details for
Bug 12607
TestBuilder - Refactoring Acquisition/GetBasketsInfosByBookseller.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 12607: refactoring GetBasketsInfosByBookseller.t with TestBuilder
SIGNED-OFF-Bug-12607-refactoring-GetBasketsInfosBy.patch (text/plain), 4.96 KB, created by
Kyle M Hall (khall)
on 2014-07-25 12:58:41 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 12607: refactoring GetBasketsInfosByBookseller.t with TestBuilder
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-25 12:58:41 UTC
Size:
4.96 KB
patch
obsolete
>From ae8b71e62e6555220047b7a9b17f27e17ad546e0 Mon Sep 17 00:00:00 2001 >From: Yohann Dufour <dufour.yohann@gmail.com> >Date: Fri, 18 Jul 2014 17:14:12 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 12607: refactoring GetBasketsInfosByBookseller.t with TestBuilder > >The tests have been refactored with the module TestBuilder. > >Test plan: >1/ Apply the patch 12603 and the last patch of bug 11518. >2/ The command : prove t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t has to be a success without error or warning : >t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t .. ok >All tests successful. >Files=1, Tests=18, 2 wallclock secs ( 0.03 usr 0.01 sys + 1.71 cusr 0.09 csys = 1.84 CPU) >Result: PASS > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../Acquisition/GetBasketsInfosByBookseller.t | 102 ++++++++++---------- > 1 files changed, 51 insertions(+), 51 deletions(-) > >diff --git a/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t b/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t >index 3b4c96b..379e459 100644 >--- a/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t >+++ b/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t >@@ -1,61 +1,64 @@ > #!/usr/bin/perl > >+# This file is part of Koha. >+# >+# Copyright 2014 - Biblibre SARL >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ > 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; >+use t::lib::TestBuilder; > >-my $supplierid = C4::Bookseller::AddBookseller( >- { >- name => 'my vendor', >- address1 => 'bookseller\'s address', >- phone => '0123456', >- active => 1, >- deliverytime => 5, >- } >-); >+BEGIN { >+ use_ok('C4::Acquisition'); >+} > >-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 $builder = t::lib::TestBuilder->new(); >+$builder->clear( { source => 'Aqorder' } ); > >-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, ''); >+my $order1 = $builder->build({ >+ source => 'Aqorder', >+ value => { >+ quantity => 2, >+ quantityreceived => 0, >+ datecancellationprinted => undef, >+ basketno => { >+ closedate => undef, >+ }, >+ }, >+ only_fk => 1, >+}); >+my (undef, $ordernumber1) = C4::Acquisition::NewOrder($order1); > >-( undef, $ordernumber1 ) = C4::Acquisition::NewOrder( >- { >- basketno => $basketno, >- quantity => 2, >- biblionumber => $biblionumber1, >- budget_id => $budget->{budget_id}, >- } >-); >+my $order2 = $builder->build({ >+ source => 'Aqorder', >+ value => { >+ basketno => $order1->{basketno}, >+ quantity => 4, >+ quantityreceived => 0, >+ datecancellationprinted => undef, >+ }, >+ only_fk => 1, >+}); >+my (undef, $ordernumber2) = C4::Acquisition::NewOrder($order2); > >-( undef, $ordernumber2 ) = C4::Acquisition::NewOrder( >- { >- basketno => $basketno, >- quantity => 4, >- biblionumber => $biblionumber2, >- budget_id => $budget->{budget_id}, >- } >-); >+my $basketno = $order1->{basketno}; >+my $biblionumber1 = $order1->{biblionumber}; >+my $biblionumber2 = $order2->{biblionumber}; >+my $supplierid = $order1->{_fk}->{basketno}->{booksellerid}; > > my $baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); > is( scalar(@$baskets), 1, 'Start: 1 basket' ); >@@ -88,6 +91,3 @@ $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.2.5
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 12607
:
29854
| 30091