From ac53aa34a0e1b2b095159cbd3ecc927273064ec9 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 9 Feb 2018 18:24:06 +0100 Subject: [PATCH] Bug 20169: Fix two tests when DBD::mysql is 4.041 Tests pass with DBD::mysql 4.028, but not with 4.041. I'm not sure which exact version makes those tests to fail. The problem is that with newer versions of DBD::mysql, 'float' columns get converted to numbers instead of string, thus the comparison fail. This patch converts the expected values to numbers so the comparison should succeed with both versions of DBD::mysql Test plan: 1. Install DBD::mysql 4.041 or newer 2. prove t/db_dependent/Accounts.t t/db_dependent/Bookseller.t Signed-off-by: Mark Tompsett --- t/db_dependent/Accounts.t | 4 ++-- t/db_dependent/Bookseller.t | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 51c094a..f2ab3c4 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -395,7 +395,7 @@ subtest "More Koha::Account::pay tests" => sub { is( $stat->type, 'payment', "Correct statistic type" ); is( $stat->branch, $branch, "Correct branch logged to statistics" ); is( $stat->borrowernumber, $borrowernumber, "Correct borrowernumber logged to statistics" ); - is( $stat->value, "$amount" . "\.0000", "Correct amount logged to statistics" ); + is( 0 + $stat->value, $amount, "Correct amount logged to statistics" ); } }; @@ -449,7 +449,7 @@ subtest "Even more Koha::Account::pay tests" => sub { is( $stat->type, 'payment', "Correct statistic type" ); is( $stat->branch, $branch, "Correct branch logged to statistics" ); is( $stat->borrowernumber, $borrowernumber, "Correct borrowernumber logged to statistics" ); - is( $stat->value, "$partialamount" . "\.0000", "Correct amount logged to statistics" ); + is( 0 + $stat->value, $partialamount, "Correct amount logged to statistics" ); } }; diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t index 416974c..210415e 100644 --- a/t/db_dependent/Bookseller.t +++ b/t/db_dependent/Bookseller.t @@ -67,7 +67,7 @@ my $sample_supplier1 = { listincgst => 1, invoiceincgst => 1, tax_rate => '1.0000', - discount => '1.0000', + discount => 1.0000, notes => 'notes1', deliverytime => undef }; @@ -87,7 +87,7 @@ my $sample_supplier2 = { listincgst => 1, invoiceincgst => 1, tax_rate => '2.0000', - discount => '2.0000', + discount => 2.0000, notes => 'notes2', deliverytime => 2 }; -- 2.1.4