Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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

class NiveauTest extends ConsultationEflorePhpUnit {
        const TPL_URL_BASE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx';

        public function testAfficherNiveau() {
                $_GET['referentiel'] = 'bdtfx';
                $_GET['module'] = 'recherche';
                $_GET['action'] = 'rechercheSimple';
                $_GET['type_nom'] = 'nom_scientifique';
                $_GET['nom'] = 'acer+mons';
                Registre::set('parametres.niveau', '2');
                $niveau = new Niveau($this->getAppUrls());
                
                $sortie = $niveau->afficherNiveau();

                $this->assertNotEmpty($sortie, print_r($sortie, true));
                $this->assertNotContains(' <input id="niveau_2" name="niveau" value="2" type="radio" checked="checked" />', $sortie);
                $this->assertContains('<input id="eflore_niveau_type_nom" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie, print_r($sortie,true));
                $this->assertContains('<input id="eflore_niveau_referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
                $this->assertContains('<input id="eflore_niveau_action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
                $this->assertContains('<input id="eflore_niveau_nom" name="nom" type="hidden" value="acer+mons" />', $sortie);
        }
        
        protected function getAppUrls() {
                $AppUrls = $this->getMock('AppUrls', array('obtenirUrlBase'), array(), '', false);
                $AppUrls->expects($this->any())
                ->method('obtenirUrlBase')
                ->will($this->returnCallback(array($this, 'genererUrlBase')));
                return $AppUrls;
        }
        public function genererUrlBase($id) {
                return sprintf(self::TPL_URL_BASE, $id);
        }
}
?>