Bug 21613: Turn strict SQL modes on for tests
This patch will turn the strict SQL modes on When tests are ran with prove. Test plan: - Apply the first patch - prove t/db_dependent/Koha/Database.t => Will pass if you have <strict_sql_modes>1</strict_sql_modes> in your koha-conf.xml => Will fail otherwise - Apply the second patch - prove t/db_dependent/Koha/Database.t => Will pass whatever the value of strict_sql_modes in your koha-conf.xml Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
5a979fd0c4
commit
bab5ff0645
|
|
@ -76,10 +76,10 @@ sub _new_schema {
|
|||
%encoding_attr = ( mysql_enable_utf8 => 1 );
|
||||
$encoding_query = "set NAMES 'utf8mb4'";
|
||||
$tz_query = qq(SET time_zone = "$tz") if $tz;
|
||||
unless ( C4::Context->config('strict_sql_modes') ) {
|
||||
$sql_mode_query = q{SET sql_mode = 'IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'};
|
||||
} else {
|
||||
if ( $ENV{_} =~ m|prove| or C4::Context->config('strict_sql_modes') ) {
|
||||
$sql_mode_query = q{SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'};
|
||||
} else {
|
||||
$sql_mode_query = q{SET sql_mode = 'IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'};
|
||||
}
|
||||
}
|
||||
elsif ( $db_driver eq 'Pg' ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue