Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 139 | Rev 167 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

class RechercheTest extends ConsultationEflorePhpUnit {

        public function testExecuterRechercheSimple() {
                $_GET['type_nom'] = 'nom_scientifique';
                $_GET['nom'] = 'acer mons';
                Registre::set('niveau', '1');
                $cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
                Config::charger($cheminRacine.'bdtfx.ini');
                Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
                Registre::set('parametres.referentiel', 'bdtfx');
                
                $recherche = new Recherche();
                $recherche->initialiser();
                $recherche->executerRechercheSimple();
                
                $donnees = Registre::get('donneesMoteur');
                $resultat = Registre::get('resultats');
                $sortie = implode('', $recherche->getSortie());
                $this->assertEmpty($donnees, print_r($donnees, true));
                $this->assertNotEmpty($resultat, print_r($resultat, true));
                $this->assertEquals('6', $resultat['entete']['total']);
                $this->assertEquals('6', count($resultat['resultat']));
                $this->assertArrayHasNotKey('auteur', $resultat['resultat']['182']);
                $this->assertNotEmpty($sortie, print_r($sortie, true));
                $this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
                $this->assertContains('<strong class="nom-sci-retenu"><span class="surlignage">Acer</span> <span class="surlignage">mons</span>pessullanum</strong>', $sortie);
        }
        
        public function testExecuterRechercheSimpleResDecompo() {
                $_GET['type_nom'] = 'nom_scientifique';
                $_GET['nom'] = 'acer mons';
                $_GET['resultat'] = 'decompo';
                $cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
                Config::charger($cheminRacine.'bdtfx.ini');
                Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
                Registre::set('parametres.referentiel', 'bdtfx');
        
                $recherche = new Recherche();
                $recherche->initialiser();
                $recherche->executerRechercheSimple();
        
                $donnees = Registre::get('donneesMoteur');
                $resultat = Registre::get('resultats');
                $sortie = implode('', $recherche->getSortie());
                $this->assertEmpty($donnees, print_r($donnees, true));
                $this->assertNotEmpty($resultat, print_r($resultat, true));
                $this->assertEquals('6', $resultat['entete']['total']);
                $this->assertEquals('6', count($resultat['resultat']));
                $this->assertArrayHasKey('auteur', $resultat['resultat']['182']);
                $this->assertNotEmpty($sortie, print_r($sortie, true));
                $this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
        }
}
?>