Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 145 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

<?php
include_once dirname(__FILE__).'/../../../bibliotheque/Surligneur.php';
include_once dirname(__FILE__).'/../../../bibliotheque/Trieur.php';
include_once dirname(__FILE__).'/../../../modules/resultat/ParametresResultats.php';
include_once dirname(__FILE__).'/../../../modules/resultat/Formateur.php';
include_once dirname(__FILE__).'/../../../bibliotheque/ChaineManipulateur.php';

class ResultatFormateurCommun extends PHPUnit_Framework_TestCase {
        const TPL_URL_FICHE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx&module=fiche&action=fiche&nn=%s';

        protected function getParametres($type, $masque) {
                $parametres = new ParametresResultats();
                $parametres->type = $type;
                $parametres->masqueRecherche = $masque;
                return $parametres;
        }

        protected function getResultatsPourMasque($masque) {
                $resultatsJson = file_get_contents(dirname(__FILE__).'/resultats.json');
                $resultats = json_decode($resultatsJson, true);
                return $resultats[$masque];
        }

        protected function getSurligneur() {
                $surligneur = new Surligneur();
                return $surligneur;
        }

        protected function getTrieur() {
                $trieur = new Trieur();
                return $trieur;
        }

        protected function getAppUrls() {
                $AppUrls = $this->getMock('AppUrls', array('obtenirUrlFiche'), array(), '', false);
                $AppUrls->expects($this->any())
                ->method('obtenirUrlFiche')
                ->will($this->returnCallback(array($this, 'genererUrlFiche')));
                return $AppUrls;
        }

        public function genererUrlFiche($id) {
                return sprintf(self::TPL_URL_FICHE, $id);
        }
}
?>