Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 843 → Rev 844

/tags/v0.1-20130830/services/tests/0.2/bibliotheque/ProjetTest.php
New file
0,0 → 1,66
<?php
require_once dirname(__FILE__).'/../ServicePhpUnit.php';
 
class ProjetTest extends ServicePhpUnit {
 
private function initialiser($ressourcesUrl = array()) {
$ressources = new Ressources($ressourcesUrl);
$projet = new Projet($ressources);
$projet->setCheminBase(realpath(dirname(__FILE__).'/../../../modules/0.2').'/');
$projet->setCheminConfig(realpath(dirname(__FILE__).'/../../../configurations').'/');
$projet->setCheminBiblio(realpath(dirname(__FILE__).'/../../../bibliotheque').'/');
$paramsVerif = $this->getMock('ParametresVerificateur');
$projet->setParamsVerif($paramsVerif);
$ressourcesVerif = $this->getMock('RessourcesVerificateur');
$projet->setRessourcesVerif($ressourcesVerif);
$versionVerif = $this->getMock('VersionVerificateur');
$projet->setVersionVerif($versionVerif);
return $projet;
}
 
public function testerInitialiserAutoLoad() {
$ressourcesUrl = array('fournier', 'noms', '1');
 
$projet = $this->initialiser($ressourcesUrl);
$projet->initialiser();
 
$nomDetails = $this->getMock('NomDetailsGenerique');
$test = new NomDetailsFournier($nomDetails);
}
 
public function testerInitialiserConfig() {
$ressourcesUrl = array('fournier', 'noms', '1');
 
$projet = $this->initialiser($ressourcesUrl);
$projet->initialiser();
 
$this->assertNotNull(Config::get('nomProjet'));
$this->assertNotNull(Config::get('bddTable'));
$this->assertNotNull(Config::get('bddTableMeta'));
$this->assertNotNull(Config::get('baseServiceUrl'));
$this->assertNotNull(Config::get('baseProjetUrl'));
$this->assertNotNull(Config::get('listeUrl'));
$this->assertNotNull(Config::get('detailsHrefTpl'));
$this->assertNotNull(Config::get('ontologieHrefTpl'));
$this->assertNotNull(Config::get('servicesDispo'));
$this->assertNotNull(Config::get('parametresAPI'));
$this->assertNotNull(Config::get('champsProjet'));
}
 
public function testerVerifierExistanceClasseService() {
$ressourcesUrl = array('fournier', 'ServiceInexistant', '1');
 
$projet = $this->initialiser($ressourcesUrl);
 
try {
$projet->verifier();
} catch(Exception $e) {
$messageAttendu = "La classe du service demandé 'ServiceInexistant' n'existe pas dans le projet 'fournier' !";
$this->assertEquals($messageAttendu, $e->getMessage());
$this->assertEquals(404, $e->getCode());
return null;
}
$this->fail("Aucune exception n'a été soulevée.");
}
}
?>