Skip to content
Snippets Groups Projects
Commit 96fb6614 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Optimisation tests: passage de fixtures en beforeClass

parent 743a4b1b
Branches
Tags
No related merge requests found
......@@ -20,49 +20,48 @@
*/
class VodeclicTest extends Storm_Test_ModelTestCase{
public function setUp() {
parent::setUp();
protected static $vodeclic;
public static function setUpBeforeClass() {
Class_AdminVar::newInstanceWithId('VODECLIC_ID', ['valeur' => 'api-test']);
Class_AdminVar::newInstanceWithId('VODECLIC_KEY', ['valeur' => '6m5js1dPpFNrtAJbsfXO']);
Class_AdminVar::newInstanceWithId('VODECLIC_BIB_ID', ['valeur' => '12']);
$catalogue_xml = file_get_contents(realpath(dirname(__FILE__)). '/../../../fixtures/vodeclic_catalogue.xml');
$this->_http_client = Storm_Test_ObjectWrapper::mock();
$this->_http_client
$http_client = Storm_Test_ObjectWrapper::mock();
$http_client
->whenCalled('open_url')
->with('https://lms.vodeclic.com/api/catalogue.xml?partenaire=api-test&encrypted_partenaire=f13eba4953115a58bdf7952266ecca9fee8f91ddac6ac901042fdb188db02778&bib_id=12')
->answers($catalogue_xml);
Class_WebService_BibNumerique_Vodeclic::setDefaultHttpClient($this->_http_client);
Class_WebService_BibNumerique_Vodeclic::setDefaultHttpClient($http_client);
Class_WebService_BibNumerique_Vignette::setInstance(Storm_Test_ObjectWrapper::mock()
->whenCalled('updateAlbum')
->answers(true));
Class_Album::beVolatile();
$codif_type_doc=$this->fixture('Class_CodifTypeDoc', ['id' => Class_TypeDoc::VODECLIC,
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumRessource')
->whenCalled('getNextOrderFor')
->answers(1);
$codif_type_doc = self::fixture('Class_CodifTypeDoc', ['id' => Class_TypeDoc::VODECLIC,
'famille_id' => Class_CodifTypeDoc::INCONNU,
'bibliotheques' => '1;8',
'annexes' => '10;12',
'sections' => '18;19']);
$this->fixture('Class_TypeDoc', ['id'=>Class_TypeDoc::VODECLIC,
'codif_type_doc' => $codif_type_doc,
'label'=> 'Formation Vodéclic'
]);
self::fixture('Class_TypeDoc', ['id' => Class_TypeDoc::VODECLIC,
'codif_type_doc' => $codif_type_doc,
'label' => 'Formation Vodéclic']);
$this->_vodeclic = new Class_WebService_BibNumerique_Vodeclic();
/* $this->_vodeclic->harvest(['partenaire_id'=>$this->_partenaire_id,
'key'=> $this->_key,
'bib_id'=>$this->_bib_id]);*/
$this->_vodeclic->harvest('');
self::$vodeclic = new Class_WebService_BibNumerique_Vodeclic();
self::$vodeclic->harvest('');
}
public function setUp() {
parent::setUp();
$this->_vodeclic = self::$vodeclic;
$this->_first_album = $this->_vodeclic->getAlbums()[0];
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment