239 |
delphine |
1 |
<?php
|
|
|
2 |
require_once dirname(__FILE__).'/../ReferentielPhpUnit.php';
|
|
|
3 |
|
|
|
4 |
class RechercheTest extends ReferentielPhpUnit {
|
|
|
5 |
|
|
|
6 |
public function testElementParDefaut() {
|
|
|
7 |
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
|
|
|
8 |
Config::charger($cheminRacine.'jrest.ini.php');
|
|
|
9 |
$config['database'] = Config::get('database');
|
|
|
10 |
$config['settings'] = Config::get('settings');
|
|
|
11 |
$recherche = new Recherche($config);
|
|
|
12 |
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
|
|
|
13 |
7 => '*', 8 => '75538', 9 => '*', 10 => '*', 11 => '*', 12 => '*', 13 => '*' );
|
|
|
14 |
$donnees = $recherche->getElementParDefaut($param);
|
|
|
15 |
|
|
|
16 |
$this->assertNotEmpty($donnees, print_r($donnees, true));
|
|
|
17 |
$this->assertEquals('1', count($donnees), print_r($donnees, true));
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
public function testElementTaxon() {
|
|
|
21 |
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
|
|
|
22 |
Config::charger($cheminRacine.'jrest.ini.php');
|
|
|
23 |
$config['database'] = Config::get('database');
|
|
|
24 |
$config['settings'] = Config::get('settings');
|
|
|
25 |
$recherche = new Recherche($config);
|
|
|
26 |
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
|
|
|
27 |
7 => '*', 8 => '*', 9 => '*', 10 => '*', 11 => '1', 12 => '*', 13 => '*' );
|
|
|
28 |
$donnees = $recherche->getElementParTaxon($param);
|
|
|
29 |
|
|
|
30 |
$this->assertNotEmpty($donnees, print_r($donnees, true));
|
|
|
31 |
$this->assertEquals('5', count($donnees), print_r($donnees, true));
|
|
|
32 |
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
public function testElementPresentFrance() {
|
|
|
36 |
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
|
|
|
37 |
Config::charger($cheminRacine.'jrest.ini.php');
|
|
|
38 |
$config['database'] = Config::get('database');
|
|
|
39 |
$config['settings'] = Config::get('settings');
|
|
|
40 |
$recherche = new Recherche($config);
|
|
|
41 |
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
|
|
|
42 |
7 => '*', 8 => '*', 9 => '*', 10 => '*', 11 => '*', 12 => '1', 13 => '*' );
|
|
|
43 |
$donnees = $recherche->getElementParDefaut($param);
|
|
|
44 |
|
|
|
45 |
$this->assertNotEmpty($donnees, print_r($donnees, true));
|
|
|
46 |
$this->assertEquals('2', count($donnees), print_r($donnees, true));
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
public function testElementTaxref() {
|
|
|
50 |
$cheminRacine = realpath(dirname(__FILE__).'/../../').'/services/';
|
|
|
51 |
Config::charger($cheminRacine.'jrest.ini.php');
|
|
|
52 |
$config['database'] = Config::get('database');
|
|
|
53 |
$config['settings'] = Config::get('settings');
|
|
|
54 |
$recherche = new Recherche($config);
|
|
|
55 |
$param = Array (0 => 'bdtfx', 1 => '*', 2 => '*', 3 => 'acer', 4 => 'davidii', 5 => '*', 6 => '*',
|
|
|
56 |
7 => '*', 8 => '*', 9 => '*', 10 => '*', 11 => '*', 12 => '*', 13 => '1' );
|
|
|
57 |
$donnees = $recherche->getElementParDefaut($param);
|
|
|
58 |
|
|
|
59 |
$this->assertNotEmpty($donnees, print_r($donnees, true));
|
|
|
60 |
$this->assertEquals('3', count($donnees), print_r($donnees, true));
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
?>
|