Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1301 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';

class TaxonsTest extends ConsultationEflorePhpUnit {
        
        public function testStatsInitialesFamille() {
                Registre::set('parametres.referentiel', 'bdtfx');
                Config::charger(CONFIG_DIR . '/config.ini');
                $noms = new Taxons();
                $resultats = $noms->getStatsInitialesFamille();
                $this->assertNotEmpty($resultats);
                // bdtfx v2
                $this->assertEquals('25', $resultats['A']);
        }
        
        public function testStatsInitialesGenre() {
                Registre::set('parametres.referentiel', 'bdtfx');
                Config::charger(CONFIG_DIR . '/config.ini');
                $noms = new Taxons();
                $resultats = $noms->getStatsInitialesGenre();
                $this->assertNotEmpty($resultats);
                $this->assertEquals('9', $resultats['U']);
        }
        
        public function testListeFamilleParInitiale() {
                Registre::set('parametres.referentiel', 'bdtfx');
                Config::charger(CONFIG_DIR . '/config.ini');
                $noms = new Taxons();
                $resultats = $noms->getListeFamilleParInitiale('U');
                $this->assertNotEmpty($resultats);
                $this->assertCount(2, $resultats);
        }
        
        public function testListeGenreParInitiale() {
                Registre::set('parametres.referentiel', 'bdtfx');
                Config::charger(CONFIG_DIR . '/config.ini');
                $noms = new Taxons();
                $resultats = $noms->getListeGenreParInitiale('U');
                $this->assertNotEmpty($resultats);
                $this->assertNotEmpty($resultats[84640]);
                $this->assertCount(9, $resultats);
        }
        
        public function testRechercheEtendue() {
                Registre::set('parametres.referentiel', 'bdtfx');
                Config::charger(CONFIG_DIR . '/config.ini');
                $noms = new Taxons();
                $resultats = $noms->getRechercheEtendue('acer');
                $this->assertNotEmpty($resultats);
                $this->assertEquals('49', $resultats['entete']['total']);
        }

        /*
          équivalent de:
          SELECT count(num_nom) FROM bdtfx_v1_01 WHERE num_nom = num_nom_retenu AND (( SOUNDEX(nom_sci) = SOUNDEX('aceras')) OR ( SOUNDEX(REVERSE(nom_sci)) = SOUNDEX(REVERSE('aceras')))) LIMIT 0, 100;
          ~/projets/services/modules/0.1/bdtfx/Taxons.php:275
        */
        public function testRechercheFloue() {
                Registre::set('parametres.referentiel', 'bdtfx');
                Config::charger(CONFIG_DIR . '/config.ini');
                $noms = new Taxons();
                $resultats = $noms->getRechercheFloue('aceras');
                $this->assertNotEmpty($resultats);
                $this->assertEquals('15', $resultats['entete']['total']);
        }
        
}
?>