Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 238 → Rev 239

/trunk/tests/services/RechercheTest.php
New file
0,0 → 1,63
<?php
require_once dirname(__FILE__).'/../ReferentielPhpUnit.php';
 
class RechercheTest extends ReferentielPhpUnit {
 
public function testElementParDefaut() {
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
Config::charger($cheminRacine.'jrest.ini.php');
$config['database'] = Config::get('database');
$config['settings'] = Config::get('settings');
$recherche = new Recherche($config);
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
7 => '*', 8 => '75538', 9 => '*', 10 => '*', 11 => '*', 12 => '*', 13 => '*' );
$donnees = $recherche->getElementParDefaut($param);
$this->assertNotEmpty($donnees, print_r($donnees, true));
$this->assertEquals('1', count($donnees), print_r($donnees, true));
}
public function testElementTaxon() {
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
Config::charger($cheminRacine.'jrest.ini.php');
$config['database'] = Config::get('database');
$config['settings'] = Config::get('settings');
$recherche = new Recherche($config);
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
7 => '*', 8 => '*', 9 => '*', 10 => '*', 11 => '1', 12 => '*', 13 => '*' );
$donnees = $recherche->getElementParTaxon($param);
$this->assertNotEmpty($donnees, print_r($donnees, true));
$this->assertEquals('5', count($donnees), print_r($donnees, true));
}
public function testElementPresentFrance() {
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
Config::charger($cheminRacine.'jrest.ini.php');
$config['database'] = Config::get('database');
$config['settings'] = Config::get('settings');
$recherche = new Recherche($config);
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
7 => '*', 8 => '*', 9 => '*', 10 => '*', 11 => '*', 12 => '1', 13 => '*' );
$donnees = $recherche->getElementParDefaut($param);
$this->assertNotEmpty($donnees, print_r($donnees, true));
$this->assertEquals('2', count($donnees), print_r($donnees, true));
}
public function testElementTaxref() {
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
Config::charger($cheminRacine.'jrest.ini.php');
$config['database'] = Config::get('database');
$config['settings'] = Config::get('settings');
$recherche = new Recherche($config);
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
7 => '*', 8 => '*', 9 => '*', 10 => '*', 11 => '*', 12 => '*', 13 => '1' );
$donnees = $recherche->getElementParDefaut($param);
$this->assertNotEmpty($donnees, print_r($donnees, true));
$this->assertEquals('3', count($donnees), print_r($donnees, true));
}
}
?>