Bugzilla – Attachment 30089 Details for
Bug 12605
TestBuilder - Refactoring Acquisition/close_reopen_basket.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 12604: refactoring close_reopen_basket.t with TestBuilder
SIGNED-OFF-Bug-12604-refactoring-closereopenbasket.patch (text/plain), 4.49 KB, created by
Kyle M Hall (khall)
on 2014-07-25 12:55:11 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 12604: refactoring close_reopen_basket.t with TestBuilder
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-25 12:55:11 UTC
Size:
4.49 KB
patch
obsolete
>From d5b0e9d8a99e523ad6de7ccef58b931d4127bbe5 Mon Sep 17 00:00:00 2001 >From: Yohann Dufour <dufour.yohann@gmail.com> >Date: Fri, 18 Jul 2014 16:49:02 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 12604: refactoring close_reopen_basket.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/close_reopen_basket.t has to be a success without error or warning : >t/db_dependent/Acquisition/close_reopen_basket.t .. ok >All tests successful. >Files=1, Tests=7, 1 wallclock secs ( 0.03 usr 0.01 sys + 1.71 cusr 0.09 csys = 1.84 CPU) >Result: PASS > >http://bugs.koha-community.org/show_bug.cgi?id=12605 > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Acquisition/close_reopen_basket.t | 99 +++++++++------------- > 1 files changed, 42 insertions(+), 57 deletions(-) > >diff --git a/t/db_dependent/Acquisition/close_reopen_basket.t b/t/db_dependent/Acquisition/close_reopen_basket.t >index 3e7a280..d1f5455 100644 >--- a/t/db_dependent/Acquisition/close_reopen_basket.t >+++ b/t/db_dependent/Acquisition/close_reopen_basket.t >@@ -1,67 +1,54 @@ > #!/usr/bin/env perl > >-use Modern::Perl; >- >-use Test::More tests => 6; >-use C4::Acquisition; >-use C4::Biblio qw( AddBiblio DelBiblio ); >-use C4::Bookseller; >-use C4::Budgets; >-use C4::Context; >- >-# Start transaction >-my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >- >-$dbh->do(q{ >- DELETE FROM aqorders; >-}); >+# 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>. > >-my $booksellerid = C4::Bookseller::AddBookseller( >- { >- name => "my vendor", >- address1 => "bookseller's address", >- phone => "0123456", >- active => 1 >- } >-); >- >-my $basketno = C4::Acquisition::NewBasket( >- $booksellerid >-); >+use Modern::Perl; >+use Test::More tests => 7; >+use t::lib::TestBuilder; > >-my $budgetid = C4::Budgets::AddBudget( >- { >- budget_code => "budget_code_test_close_reopen", >- budget_name => "budget_name_test_close_reopen", >- } >-); >+BEGIN { >+ use_ok('C4::Acquisition'); >+} > >-my $budget = C4::Budgets::GetBudget( $budgetid ); > >-my ($biblionumber1, $biblioitemnumber1) = AddBiblio(MARC::Record->new, ''); >-my ($biblionumber2, $biblioitemnumber2) = AddBiblio(MARC::Record->new, ''); >+my $builder = t::lib::TestBuilder->new(); >+$builder->clear( { source => 'Aqorder' } ); > >-my ($ordernumber1, $ordernumber2); >-( undef, $ordernumber1 ) = C4::Acquisition::NewOrder( >- { >- basketno => $basketno, >- quantity => 24, >- biblionumber => $biblionumber1, >- budget_id => $budget->{budget_id}, >- } >-); >+my $order1 = $builder->build({ >+ source => 'Aqorder', >+ value => { >+ datecancellationprinted => undef, >+ }, >+ only_fk => 1, >+}); >+C4::Acquisition::NewOrder($order1); > >-( undef, $ordernumber2 ) = C4::Acquisition::NewOrder( >- { >- basketno => $basketno, >- quantity => 42, >- biblionumber => $biblionumber2, >- budget_id => $budget->{budget_id}, >- } >-); >+my $order2 = $builder->build({ >+ source => 'Aqorder', >+ value => { >+ basketno => $order1->{basketno}, >+ datecancellationprinted => undef, >+ }, >+ only_fk => 1, >+}); >+C4::Acquisition::NewOrder($order2); > >+my $basketno = $order1->{basketno}; > my $nb_biblio = C4::Acquisition::GetBiblioCountByBasketno( $basketno ); > is ( $nb_biblio, 2, "There are 2 biblio for this basket" ); > my @orders = C4::Acquisition::GetOrders( $basketno ); >@@ -76,5 +63,3 @@ C4::Acquisition::ReopenBasket( $basketno ); > @orders = C4::Acquisition::GetOrders( $basketno ); > is ( scalar( map { $_->{orderstatus} eq 'ordered' ? 1 : () } @orders ), 0, "No order are ordered, the basket is reopen" ); > is ( scalar( map { $_->{orderstatus} eq 'new' ? 1 : () } @orders ), 2, "2 orders are new, the basket is reopen" ); >- >-$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 12605
:
29851
| 30089