Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 191 → Rev 192

/trunk/scripts/modules/tests/Tests.php
109,7 → 109,7
Debug::printr('Lancement des tests unitaires');
$tests_numeros = array_keys($this->tests);
Debug::printr($tests_numeros);
foreach ($tests_numeros as $numero) {
foreach ($tests_numeros as &$numero) {
$info = $this->getInfosTest($numero);
if ($numero < 5) {
159,7 → 159,7
}
}
private function verifierResultats($resultats) {
private function verifierResultats(&$resultats) {
$ok = true;
foreach ($resultats as $resultat) {
if ($resultat == '0') {
216,13 → 216,13
$champs_attendus = explode(',', $this->manuel['champs']);
$champs_presents = array();
foreach ($this->colonnes as $colonne) {
foreach ($this->colonnes as &$colonne) {
$champs_presents[$colonne['Field']] = $colonne;
}
$ok = true;
$champs_manquant = array();
foreach ($champs_attendus as $champ_attendu) {
foreach ($champs_attendus as &$champ_attendu) {
if (!isset($champs_presents[$champ_attendu])) {
$champs_manquant[] = $champ_attendu;
$ok = false;
243,13 → 243,13
private function testerTypeDesChamps() {
$champs_attendus = explode(',', $this->manuel['champs_type']);
$champs_presents = array();
foreach ($this->colonnes as $colonne) {
foreach ($this->colonnes as &$colonne) {
$champs_presents[$colonne['Field']] = $colonne['Type'];
}
// Recercherche des erreurs
$champs_erreur = array();
foreach ($champs_attendus as $champ_attendu) {
foreach ($champs_attendus as &$champ_attendu) {
list($champ_attendu_nom, $champ_attendu_type_taille) = explode('=', trim($champ_attendu));
list($champ_attendu_type, $champ_attendu_taille) = explode('|', trim($champ_attendu_type_taille));
274,9 → 274,10
$info = $this->getInfosTest(4);
$info['special'] = true;
foreach ($this->colonnes as $colonne) {
foreach ($this->colonnes as &$colonne) {
if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
$info['resultat'] = true;
break;
}
}
return $info;
288,7 → 289,7
*/
private function testerTailleDesChamps() {
$tailles_champs_maxi = array();
foreach ($this->colonnes as $colonne) {
foreach ($this->colonnes as &$colonne) {
if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
$tailles_champs_maxi[$colonne['Field']] = $match[1];
}
295,7 → 296,7
}
$tailles_trouvees = array();
foreach ($this->analyses as $analyse) {
foreach ($this->analyses as &$analyse) {
if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
$tailles_trouvees[$match[1]] = $analyse['Max_length'];
}
303,7 → 304,7
$champs_erreur = array();
$champs_attendus = explode(',', $this->manuel['champs']);
foreach ($champs_attendus as $champ_attendu) {
foreach ($champs_attendus as &$champ_attendu) {
if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
$champs_erreur[] = array($champ_attendu, $tailles_champs_maxi[$champ_attendu], $tailles_trouvees[$champ_attendu]);
548,7 → 549,7
if ($nom['rang'] == $this->manuel['rang_sp']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
$nom_sci_ideal .= ' '.strtolower($nom['epithete_sp']);
$nom_sci_ideal .= ' '.utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
if ($nom['nom_sci'] != $nom_sci_ideal) {
$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
568,9 → 569,9
if ($nom['rang'] > $this->manuel['rang_sp']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
$nom_sci_ideal .= ' '.strtolower($nom['epithete_sp']);
$nom_sci_ideal .= ' '.strtolower($nom['type_epithete']);
$nom_sci_ideal .= ' '.strtolower($nom['epithete_infra_sp']);
$nom_sci_ideal .= ' '.utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
$nom_sci_ideal .= ' '.utf8_encode(strtolower(utf8_decode($nom['type_epithete'])));
$nom_sci_ideal .= ' '.utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp'])));
$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
if ($nom['nom_sci'] != $nom_sci_ideal) {
$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
1542,9 → 1543,9
private function formaterStyleNomGenre(&$genre) {
$genre_fmt = '';
if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
$genre_fmt = strtolower($match[1]).' '.ucfirst(strtolower($match[2]));
$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
} else {
$genre_fmt = ucfirst(strtolower($genre));
$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
}
return $genre_fmt;
}