[Koha-bugs] [Bug 9593] Prices not imported correctly from a staged file
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Nov 12 16:12:35 CET 2013
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9593
--- Comment #51 from Koha Team Lyon 3 <koha at univ-lyon3.fr> ---
I know very few about unit test. Would something like that do the trick ?
#!/usr/bin/perl
use strict;
use warnings;
use C4::Biblio;
use Test::More tests=>1;
# start transaction
my $dbh = C4::Context->dbh;
$dbh->{AutoCommit} = 0;
$dbh->{RaiseError} = 1;
# set a test price string
my $PRICE_STRING='25.5 EUR, $32, $LD35';
my $expectedout='32';
# set active currency test data
my $CURRENCY = 'TEST';
my $SYMBOL = '$';
my $ISOCODE = 'USD';
my $RATE= 1;
# disables existing active currency if necessary.
my $active_currency = C4::Budgets->GetCurrency();
my $curr;
if ($active_currency) {
$curr = $active_currency->{'currency'};
$dbh->do("UPDATE currency set active = 0 where currency = '$curr'");
}
$dbh->do("INSERT INTO currency ( currency,symbol,isocode,rate,active )
VALUES ('$CURRENCY','$SYMBOL','$ISOCODE','$RATE',1)");
my $mungemarcprice=MungeMarcPrice($PRICE_STRING);
ok ($mungemarcprice eq $expectedout, "MungeMarcPrice returned $expectedout as
expected");
# Cleanup
$dbh->rollback;
Olivier Crouzet
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list