/tags/2014-04-14/tests/metier/EfloreTest.php |
---|
New file |
0,0 → 1,20 |
<?php |
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php'; |
class EfloreTest extends ConsultationEflorePhpUnit { |
public function testFormulerUrl() { |
$ressources = array('bdtfx', 'noms'); |
$parametres = array('masque' => 'acer', 'recherche' => 'stricte', 'ns.format' => 'htm'); |
$url = $this->creerUrl($ressources, $parametres); |
$eflore = $this->getMock('Eflore'); |
$formaterUrl = self::getMethodeProtegee($eflore, 'formaterUrl'); |
$tpl = ConsultationEflorePhpUnit::URL_API . '/{projet}/noms?masque={valeur}&recherche={type}&ns.format=htm'; |
$param = array('projet' => 'bdtfx' ,'valeur' => 'acer', 'type' => 'stricte'); |
$urlf = $formaterUrl->invoke($eflore, $tpl, $param); |
$this->assertEquals($url, $urlf); |
} |
} |
?> |
/tags/2014-04-14/tests/metier/NomsTest.php |
---|
New file |
0,0 → 1,60 |
<?php |
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php'; |
class NomsTest extends ConsultationEflorePhpUnit { |
public function testRechercheEtendue() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Noms(); |
$resultats = $noms->getRechercheEtendue('aceras'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('15', $resultats['entete']['total']); |
$this->assertNotEmpty($resultats['resultat']['243']); |
$this->assertEquals('Aceras hircinum', $resultats['resultat']['243']['nom_sci']); |
$this->assertArrayNotHasKey('nom_retenu.id', $resultats['resultat']['243']); |
$this->assertArrayNotHasKey('auteur', $resultats['resultat']['243']); |
$this->assertArrayNotHasKey('annee', $resultats['resultat']['243']); |
$this->assertArrayNotHasKey('biblio_origine', $resultats['resultat']['243']); |
} |
public function testRechercheEtendueDetermination() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Noms(); |
$resultats = $noms->getRechercheEtendue('aceras', 'determination'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('15', $resultats['entete']['total']); |
$this->assertNotEmpty($resultats['resultat']['243']); |
$this->assertEquals('Aceras hircinum', $resultats['resultat']['243']['nom_sci']); |
$this->assertEquals('75170', $resultats['resultat']['243']['nom_retenu.id']); |
$this->assertArrayNotHasKey('auteur', $resultats['resultat']['243']); |
$this->assertArrayNotHasKey('annee', $resultats['resultat']['243']); |
$this->assertArrayNotHasKey('biblio_origine', $resultats['resultat']['243']); |
} |
public function testRechercheEtendueDecompo() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Noms(); |
$resultats = $noms->getRechercheEtendue('aceras', 'decompo'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('15', $resultats['entete']['total']); |
$this->assertNotEmpty($resultats['resultat']['243']); |
$this->assertEquals('Aceras hircinum', $resultats['resultat']['243']['nom_sci']); |
$this->assertArrayNotHasKey('nom_retenu.id', $resultats['resultat']['243']); |
$this->assertArrayHasKey('auteur', $resultats['resultat']['243']); |
$this->assertArrayHasKey('annee', $resultats['resultat']['243']); |
$this->assertArrayHasKey('biblio_origine', $resultats['resultat']['243']); |
} |
public function testRechercheFloue() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Noms(); |
$resultats = $noms->getRechercheFloue('aceras'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('27', $resultats['entete']['total']); |
} |
} |
?> |
/tags/2014-04-14/tests/metier/TaxonsTest.php |
---|
New file |
0,0 → 1,68 |
<?php |
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php'; |
class TaxonsTest extends ConsultationEflorePhpUnit { |
public function testStatsInitialesFamille() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Taxons(); |
$resultats = $noms->getStatsInitialesFamille(); |
$this->assertNotEmpty($resultats); |
// bdtfx v2 |
$this->assertEquals('25', $resultats['A']); |
} |
public function testStatsInitialesGenre() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Taxons(); |
$resultats = $noms->getStatsInitialesGenre(); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('9', $resultats['U']); |
} |
public function testListeFamilleParInitiale() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Taxons(); |
$resultats = $noms->getListeFamilleParInitiale('U'); |
$this->assertNotEmpty($resultats); |
$this->assertCount(2, $resultats); |
} |
public function testListeGenreParInitiale() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Taxons(); |
$resultats = $noms->getListeGenreParInitiale('U'); |
$this->assertNotEmpty($resultats); |
$this->assertNotEmpty($resultats[84640]); |
$this->assertCount(9, $resultats); |
} |
public function testRechercheEtendue() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Taxons(); |
$resultats = $noms->getRechercheEtendue('acer'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('49', $resultats['entete']['total']); |
} |
/* |
équivalent de: |
SELECT count(num_nom) FROM bdtfx_v1_01 WHERE num_nom = num_nom_retenu AND (( SOUNDEX(nom_sci) = SOUNDEX('aceras')) OR ( SOUNDEX(REVERSE(nom_sci)) = SOUNDEX(REVERSE('aceras')))) LIMIT 0, 100; |
~/projets/services/modules/0.1/bdtfx/Taxons.php:275 |
*/ |
public function testRechercheFloue() { |
Registre::set('parametres.referentiel', 'bdtfx'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new Taxons(); |
$resultats = $noms->getRechercheFloue('aceras'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('15', $resultats['entete']['total']); |
} |
} |
?> |
/tags/2014-04-14/tests/metier/NomsVernaculairesTest.php |
---|
New file |
0,0 → 1,33 |
<?php |
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php'; |
class NomsVernaculairesTest extends ConsultationEflorePhpUnit { |
public function testRechercheEtendue() { |
Registre::set('parametres.referentiel', 'nvjfl'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new NomsVernaculaires(); |
$resultats = $noms->getRechercheEtendue('abricotier'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('3', $resultats['entete']['total']); |
} |
public function testRechercheEtendueDetermination() { |
Registre::set('parametres.referentiel', 'nvjfl'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new NomsVernaculaires(); |
$resultats = $noms->getRechercheEtendue('abricotier', 'determination'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('3', $resultats['entete']['total']); |
} |
public function testRechercheFloue() { |
Registre::set('parametres.referentiel', 'nvjfl'); |
Config::charger(CONFIG_DIR . '/config.ini'); |
$noms = new NomsVernaculaires(); |
$resultats = $noms->getRechercheFloue('abricotier'); |
$this->assertNotEmpty($resultats); |
$this->assertEquals('1', $resultats['entete']['total']); |
} |
} |
?> |