Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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) {
                $resultats['viola his'] = array(
                                'entete' => array(
                                        'masque' => 'nom_sci=%viola% his%',
                                        'depart' => 0,
                                        'limite' => 3000,
                                        'total' => 5),
                                'resultat' => array(
                                        '72291' => array(
                                                'nom_sci' => 'Viola hispida Lapeyr. [1813]',
                                                'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72291',
                                                'retenu' => false,
                                                'nom_retenu' => 'Viola bubanii Timb.-Lagr. [1852]',
                                                'nom_retenu.id' => '72117',
                                                'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72117'),
                                        '72288' => array(
                                                'nom_sci' => 'Viola hispida Lam. [1779]',
                                                'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72288',
                                                'retenu' => true,
                                                'nom_retenu' => 'Viola hispida Lam. [1779]',
                                                'nom_retenu.id' => '72288',
                                                'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72288'),
                                        '72341' => array(
                                                'nom_sci' => 'Viola lutea var. hispida Nyman [1878]',
                                                'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72341',
                                                'retenu' => false,
                                                'nom_retenu' => 'Viola bubanii Timb.-Lagr. [1852]',
                                                'nom_retenu.id' => '72117',
                                                'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72117'),
                                        '72289' => array(
                                                'nom_sci' => 'Viola hispida subsp. cryana (Gillot) P.Fourn. [1928]',
                                                'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72289',
                                                'retenu' => false,
                                                'nom_retenu' => 'Viola cryana Gillot [1878]',
                                                'nom_retenu.id' => '72201',
                                                'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72201'),
                                        '72290' => array(
                                                'nom_sci' => 'Viola hispida subsp. rothomagensis P.Fourn. [1928]',
                                                'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72290',
                                                'retenu' => false,
                                                'nom_retenu' => 'Viola hispida Lam. [1779]',
                                                'nom_retenu.id' => '72288',
                                                'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72288')));
                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);
        }
}
?>