Bugzilla – Attachment 76177 Details for
Bug 20906
Fix Debian 9 Test Failures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20906: Prevent test failures due to precision changes (2)
Bug-20906-Prevent-test-failures-due-to-precision-c.patch (text/plain), 5.17 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-06-19 14:34:32 UTC
(
hide
)
Description:
Bug 20906: Prevent test failures due to precision changes (2)
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-06-19 14:34:32 UTC
Size:
5.17 KB
patch
obsolete
>From 1a68256599092f4fcb55fef87e0faa0569d3ebc7 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 8 Jun 2018 15:21:22 +0100 >Subject: [PATCH] Bug 20906: Prevent test failures due to precision changes (2) > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Bookseller.t | 44 +++++++++++++++++++++++-------------- > 1 file changed, 28 insertions(+), 16 deletions(-) > >diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t >index b9de02cf9c..48b2cef53e 100644 >--- a/t/db_dependent/Bookseller.t >+++ b/t/db_dependent/Bookseller.t >@@ -67,8 +67,8 @@ my $sample_supplier1 = { > gstreg => 1, > listincgst => 1, > invoiceincgst => 1, >- tax_rate => '1.0000', >- discount => '1.0000', >+ tax_rate => '1.0000', >+ discount => 1.0000, > notes => 'notes1', > deliverytime => undef > }; >@@ -87,8 +87,8 @@ my $sample_supplier2 = { > gstreg => 1, > listincgst => 1, > invoiceincgst => 1, >- tax_rate => '2.0000', >- discount => '2.0000', >+ tax_rate => '2.0000', >+ discount => 2.0000, > notes => 'notes2', > deliverytime => 2 > }; >@@ -118,7 +118,7 @@ for my $bookseller ( @bookseller2 ) { > } > > $sample_supplier2->{id} = $id_supplier2; >-is_deeply( $bookseller2[0], $sample_supplier2, >+is_deeply( cast_precision($bookseller2[0]), $sample_supplier2, > "Koha::Acquisition::Booksellers->search returns the right informations about supplier $sample_supplier2->{name}" ); > > $supplier1 = Koha::Acquisition::Bookseller->new($sample_supplier1)->store; >@@ -126,6 +126,7 @@ $id_supplier1 = $supplier1->id; > my @booksellers = Koha::Acquisition::Booksellers->search(); > for my $bookseller ( @booksellers ) { > $bookseller = field_filter( $bookseller->unblessed ); >+ $bookseller = cast_precision($bookseller); > } > > $sample_supplier1->{id} = $id_supplier1; >@@ -150,7 +151,7 @@ is( $bookseller1fromid, undef, > "find returns undef if no id given" ); > $bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 ); > $bookseller1fromid = field_filter($bookseller1fromid->unblessed); >-is_deeply( $bookseller1fromid, $sample_supplier1, >+is_deeply( cast_precision($bookseller1fromid), $sample_supplier1, > "Get Supplier1 (find a bookseller by id)" ); > > $bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 ); >@@ -229,8 +230,8 @@ $sample_supplier2 = { > gstreg => 1, > listincgst => 1, > invoiceincgst => 1, >- tax_rate => '2.0000 ', >- discount => '2.0000', >+ tax_rate => '2.0000', >+ discount => 2.0000, > notes => 'notes2 modified', > deliverytime => 2, > }; >@@ -259,8 +260,8 @@ my $sample_supplier3 = { > gstreg => 1, > listincgst => 1, > invoiceincgst => 1, >- tax_rate => '3.0000', >- discount => '3.0000', >+ tax_rate => '3.0000', >+ discount => 3.0000, > notes => 'notes3', > deliverytime => 3 > }; >@@ -279,8 +280,8 @@ my $sample_supplier4 = { > gstreg => 1, > listincgst => 1, > invoiceincgst => 1, >- tax_rate => '3.0000', >- discount => '3.0000', >+ tax_rate => '3.0000', >+ discount => 3.0000, > notes => 'notes3', > }; > my $supplier3 = Koha::Acquisition::Bookseller->new($sample_supplier3)->store; >@@ -358,7 +359,7 @@ my $order1 = Koha::Acquisition::Order->new( > entrydate => '2013-01-01', > currency => $curcode, > notes => "This is a note1", >- tax_rate => 0.0500, >+ tax_rate => 0.0500, > orderstatus => 1, > subscriptionid => $id_subscription1, > quantityreceived => 2, >@@ -378,7 +379,7 @@ my $order2 = Koha::Acquisition::Order->new( > entrydate => '2013-01-01', > currency => $curcode, > notes => "This is a note2", >- tax_rate => 0.0500, >+ tax_rate => 0.0500, > orderstatus => 1, > subscriptionid => $id_subscription2, > rrp => 10, >@@ -396,7 +397,7 @@ my $order3 = Koha::Acquisition::Order->new( > entrydate => '2013-02-02', > currency => $curcode, > notes => "This is a note3", >- tax_rate => 0.0500, >+ tax_rate => 0.0500, > orderstatus => 2, > subscriptionid => $id_subscription3, > rrp => 11, >@@ -414,7 +415,7 @@ my $order4 = Koha::Acquisition::Order->new( > entrydate => '2013-02-02', > currency => $curcode, > notes => "This is a note3", >- tax_rate => 0.0500, >+ tax_rate => 0.0500, > orderstatus => 2, > subscriptionid => $id_subscription3, > rrp => 11, >@@ -780,3 +781,14 @@ sub field_filter { > } > return $struct; > } >+ >+# ensure numbers are actually tested as numbers to prevent >+# precision changes causing test failures (D8->D9 Upgrades) >+sub cast_precision { >+ my ($struct) = @_; >+ my @cast = ('discount'); >+ for my $cast (@cast) { >+ $struct->{$cast} = $struct->{$cast}+0; >+ } >+ return $struct; >+} >-- >2.17.1
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 20906
:
75916
|
75920
|
75921
|
75929
|
76175
|
76176
| 76177 |
76178