diff --git a/tests/legacy/unit/abstract_sql/10_sql_insert_select.php b/tests/legacy/unit/abstract_sql/10_sql_insert_select.php index 9758a5338e5f4e5e881145a0910d71b107e610ab..6d0ee8335986fb72725ece863578033367b24b05 100644 --- a/tests/legacy/unit/abstract_sql/10_sql_insert_select.php +++ b/tests/legacy/unit/abstract_sql/10_sql_insert_select.php @@ -150,17 +150,17 @@ function test_selections() } // selection avec sql_multi - $res = sql_select(['id_tintin', sql_multi('grrrr', 'fr')], 'spip_test_milou', '', '', 'multi'); + $res = sql_select(['id_milou', sql_multi('grrrr', 'fr')], 'spip_test_milou', '', '', 'multi'); if (sql_count($res) !== $nb_data) { $err[] = 'sql_multi mal interprete'; } $rs = sql_fetch($res); - $id1 = $rs['id_tintin']; + $id1 = intval($rs['id_milou']); $rs = sql_fetch($res); - $id2 = $rs['id_tintin']; + $id2 = intval($rs['id_milou']); $rs = sql_fetch($res); - $id3 = $rs['id_tintin']; + $id3 = intval($rs['id_milou']); if ($id1 !== 3 && $id2 !== 2 && $id3 !== 1) { $err[] = "sql_multi order by multi rate : ordre ({$id1}, {$id2}, {$id3}) - attendu : (3, 2, 1)"; } diff --git a/tests/legacy/unit/abstract_sql/20_sql_update_delete.php b/tests/legacy/unit/abstract_sql/20_sql_update_delete.php index daeeaad08f49731efa64b09092e552258289b135..eeb5ccad6c32240ea5e7504271664530a7f12641 100644 --- a/tests/legacy/unit/abstract_sql/20_sql_update_delete.php +++ b/tests/legacy/unit/abstract_sql/20_sql_update_delete.php @@ -37,7 +37,7 @@ function test_update_data() 'un_bigint' => 'un_bigint+2', ]); $nb2 = sql_getfetsel('un_bigint', 'spip_test_tintin', 'id_tintin=' . sql_quote(1)); - if ($nb + 2 !== $nb2) { + if ($nb + 2 != $nb2) { $err[] = "sql_update n'a pas fait l'adition ! ({$nb} + 2 != {$nb2})"; } diff --git a/tests/legacy/unit/abstract_sql/40_sql_divers.php b/tests/legacy/unit/abstract_sql/40_sql_divers.php index 668e39c26e91c0889fd6cbdb457c26d19cea97cc..8148428f6f8aa98f3baccb58ea188f83ce286a73 100644 --- a/tests/legacy/unit/abstract_sql/40_sql_divers.php +++ b/tests/legacy/unit/abstract_sql/40_sql_divers.php @@ -33,7 +33,7 @@ function test_func_mathematiques() 'AVG' => 3000, ] as $func => $attendu) { $nb = sql_getfetsel("{$func}(un_int) AS nb", ['spip_test_tintin']); - if ($nb !== $attendu) { + if ($nb != $attendu) { $err[] = "Selection {$func} en echec : attendu : {$attendu}, recu : {$nb}"; } } @@ -51,11 +51,11 @@ function test_func_mathematiques() '1.5/2' => (1.5 / 2), '2.0/2' => (2.0 / 2), '2/2' => (2 / 2), - 'md5(8)' => md5(8), + 'md5(8)' => md5("8"), 'md5(' . sql_quote('a') . ')' => md5('a'), ] as $func => $attendu) { $nb = sql_getfetsel("{$func} AS nb", ['spip_test_tintin'], ['id_tintin=' . sql_quote(1)]); - if ($nb !== $attendu) { + if ($nb != $attendu) { $err[] = "Selection {$func} en echec : attendu : {$attendu}, recu : {$nb}"; } } diff --git a/tests/legacy/unit/abstract_sql/inc-sql_datas.inc b/tests/legacy/unit/abstract_sql/inc-sql_datas.inc index 3f631b1c9d10728bc3e4f2e5f921d38a48d30501..7096c22a5bf203b85660fd1a17f991e115a62973 100644 --- a/tests/legacy/unit/abstract_sql/inc-sql_datas.inc +++ b/tests/legacy/unit/abstract_sql/inc-sql_datas.inc @@ -2,15 +2,15 @@ /* * Jeu de donnees pour les differents fichiers de tests sql - * + * * Quelques fonctions utilises souvent : * - test_create_table * - test_drop_table */ -/* - * tableaux des donnees - * +/* + * tableaux des donnees + * */ function test_sql_datas(){ $table_tintin = [ @@ -26,9 +26,9 @@ function test_sql_datas(){ "maj" => "TIMESTAMP" ], 'key'=>[ - + ], - 'nb_key_attendues'=>1 // attention : la primary key DOIT etre dans les cle aussi + 'nb_key_attendues'=>1 // attention : la primary key DOIT etre dans les cle aussi ]; $data_tintin = [ [ @@ -65,7 +65,7 @@ function test_sql_datas(){ //"maj" => "" // doit se remplir automatiquement ] ]; - + $table_milou = [ 'field'=> [ "id_milou" => "INTEGER NOT NULL AUTO_INCREMENT", @@ -109,7 +109,7 @@ function test_sql_datas(){ // "maj" => "" // doit se remplir automatiquement ], ]; - + $table_haddock = [ 'field'=> [ "id_haddock" => "INTEGER NOT NULL AUTO_INCREMENT", @@ -139,7 +139,7 @@ function test_sql_datas(){ "alcool" => "Un début de chaine : <multi>[fr]Vinasse[en]Vinassy</multi>, et [la fin]", ], ]; - + return [ 'spip_test_tintin'=>[ 'desc'=>$table_tintin, @@ -148,16 +148,16 @@ function test_sql_datas(){ 'spip_test_milou'=>[ 'desc'=>$table_milou, 'data'=>$data_milou - ], + ], 'spip_test_haddock'=>[ 'desc'=>$table_haddock, 'data'=>$data_haddock - ], + ], ]; } /* - * Suppression de tables + * Suppression de tables */ function test_drop_table(){ $tables = test_sql_datas(); @@ -182,14 +182,14 @@ function test_create_table(){ foreach ($tables as $t=>$v){ if (!sql_create($t, $v['desc']['field'], $v['desc']['key'])) $err[] = "sql_create $t en echec"; // reponse, arguments - } + } if ($err) { return '<b>Creation de table en echec</b><dl>' . join('', $err) . '</dl>'; } } - + /* * Insertion de champs multiples sql_insertq_multi * et comptage avec sql_countsel @@ -200,12 +200,12 @@ function test_insert_data() { // inserer les donnees dans la table foreach ($tables as $t=>$d){ sql_insertq_multi($t, $d['data']); - $essais[] = [(string)count($d['data']),$t]; + $essais[] = [count($d['data']),$t]; } - $err = tester_fun('sql_countsel', $essais); + $err = tester_fun('sql_countsel', $essais); if ($err) { return '<b>Insertion multiple puis countsel dans table</b><dl>' . join('', $err) . '</dl>'; - } + } } - + ?>