Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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

class RechercheSimpleTest extends ConsultationEflorePhpUnit {
        public function testMoteurRechercheSimple() {
                $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 RechercheSimple();
                
                $sortie =  $recherche->executerFormulaireNom();

                $this->assertNotEmpty($sortie, print_r($sortie, true));
                $this->assertContains('<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie, print_r($sortie,true));
                $this->assertContains('<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
                $this->assertContains('<input id="action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
                $this->assertNotContains('<input id="type_nom_vernaculaire" name="type_nom" value="nom_vernaculaire" type="radio" checked="checked" />', $sortie);
        }

        public function testMoteurRechercheSimpleForm() {
                $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');
                $donnees['type_nom'] = 'nom_vernaculaire';
                $donnees['nom'] = 'acer';
                $donnees['nom_verna'] = 'true';

                $recherche = new RechercheSimple();
                $sortie = $recherche->executerFormulaireNom($donnees);

                $this->assertNotEmpty($sortie, print_r($sortie, true));
                $this->assertNotContains('<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie);
                $this->assertContains('<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
                $this->assertContains('<input id="action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
                $this->assertContains('<input id="type_nom_vernaculaire" name="type_nom" value="nom_vernaculaire" type="radio" checked="checked" />', $sortie);
                $this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer" />', $sortie);

        }
}
?>