Bug 31473: Fix fragile test about bad OpacHiddenItems conf

There's been a behavior change in recent MariaDB that made some cases
deal with truncated data in DOUBLE context instead of DECIMAL.

Probably this:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-27380

This made the affected test fail consistently on those versions.

This trick for checking OpacHiddenItems is correct (as introduced on bug
28125 doesn't really make use of the warning, just prints it in
about.pl) so one option was to just check for a warning.

I decided to keep the test, but add the optional DECIMAL|DOUBLE check on
the qr. This way other eventual changes will make it fail and serve as a
warning in case something more relevant changes.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ t/db_dependent/Koha/Items.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3a5fb22ad8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2022-08-26 16:45:10 -03:00 committed by Lucas Gass
parent 54ddc31c71
commit aebaf2495b
1 changed files with 1 additions and 1 deletions

View File

@ -1750,7 +1750,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub {
$rules = { itemlost => ['AB'] };
my $c = Koha::Items->filter_by_visible_in_opac->count;
my @warnings = C4::Context->dbh->selectrow_array('SHOW WARNINGS');
is( $warnings[2], q{Truncated incorrect DOUBLE value: 'AB'});
like( $warnings[2], qr/Truncated incorrect (DOUBLE|DECIMAL) value: 'AB'/);
$schema->storage->txn_rollback;
};