diff --git a/VERSIONS_HOTLINE/94530 b/VERSIONS_HOTLINE/94530 new file mode 100644 index 0000000000000000000000000000000000000000..2994b28746e5e36efe17314099b382654b02a39a --- /dev/null +++ b/VERSIONS_HOTLINE/94530 @@ -0,0 +1 @@ + - ticket #94530 : connecteur Philharmonie Paris : nouvelle url de moissonnage prise en compte \ No newline at end of file diff --git a/VERSIONS_HOTLINE/96483 b/VERSIONS_HOTLINE/96483 new file mode 100644 index 0000000000000000000000000000000000000000..348f008e466f259816517e79216918fdcd04a485 --- /dev/null +++ b/VERSIONS_HOTLINE/96483 @@ -0,0 +1 @@ + - ticket #96483 : Compte utilisateur : Les liens de réinitialisation de mot de passe envoyés par courriel expirent désormais en 24h \ No newline at end of file diff --git a/VERSIONS_HOTLINE/96508 b/VERSIONS_HOTLINE/96508 new file mode 100644 index 0000000000000000000000000000000000000000..fd5ab085a0e787ac35162b549ac576ca6f1cc7ce --- /dev/null +++ b/VERSIONS_HOTLINE/96508 @@ -0,0 +1 @@ + - ticket #96508 : Facettes dynamiques : Seul le premier des sous champs unimarc répétés dans les notices était pris en compte dans la recherche \ No newline at end of file diff --git a/VERSIONS_HOTLINE/97222 b/VERSIONS_HOTLINE/97222 new file mode 100644 index 0000000000000000000000000000000000000000..176ba82e1bb7b58957708dacaebfd56c62fd43a5 --- /dev/null +++ b/VERSIONS_HOTLINE/97222 @@ -0,0 +1 @@ + - ticket #97222: OPAC Compte utilisateur : La page d'impression de la liste de prêt dans le compte utilisateur à l'OPAC n'affichait pas les données \ No newline at end of file diff --git a/application/modules/opac/views/scripts/print.phtml b/application/modules/opac/views/scripts/print.phtml index 272b2434bcc5366b648a4236b7efb9a4884c55ac..fc0e8c9ff08fe956eb09a711e1f79940701f0d30 100644 --- a/application/modules/opac/views/scripts/print.phtml +++ b/application/modules/opac/views/scripts/print.phtml @@ -1,3 +1,11 @@ -<?php -echo $this->tagModelFusion($this->params); -?> +<!DOCTYPE html> +<html lang="<?php echo $this->_translate()->getLocale() ?>"> + <head> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + </head> + <body> + <?php + echo $this->tagModelFusion($this->params); + ?> + </body> +</html> diff --git a/cosmogramme/VERSIONS_HOTLINE/96549 b/cosmogramme/VERSIONS_HOTLINE/96549 new file mode 100644 index 0000000000000000000000000000000000000000..eaf69e81d9dbba63dc6945659ae294d9477f479c --- /dev/null +++ b/cosmogramme/VERSIONS_HOTLINE/96549 @@ -0,0 +1 @@ + - ticket #96549 : SIGB Orphée : les exemplaires avec la situation "en réserve" sont réservables \ No newline at end of file diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index aee82556b88fdc97aab999103cb7a543326083b0..79596f24f69729036236ce65fa6032d2276874be 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -50,6 +50,7 @@ class notice_unimarc extends iso2709_record { private $id_genre_documentaire; // Identifiant pour le genre "documentaire" private $controle_codes_barres; // Exception de filtrage des codes-barres protected $_id_bib; // Bibliotheque d'intégration + protected $_fluent; // Class_NoticeUnimarc_Fluent public function __construct($id_bib=null) { @@ -94,10 +95,18 @@ class notice_unimarc extends iso2709_record { } $this->setNotice($data, $this->profil['accents']); + $this->_fluent = null; return true; } + protected function _getFluent() { + return $this->_fluent + ? $this->_fluent + : $this->_fluent = Class_NoticeUnimarc_Fluent::fromLegacy($this); + } + + public function updateItemsWithUrl(&$exemplaires) { if (!$champ_url = $this->profil['attributs'][Class_IntProfilDonnees::FT_RECORDS][Class_IntProfilDonnees::FIELD_ITEM_URL]) return $this; @@ -187,7 +196,7 @@ class notice_unimarc extends iso2709_record { $notice["dewey"] = $this->getDewey(); - $notice["thesauri"] = $this->getThesauri($notice); + $notice["thesauri"] = $this->getThesauri(); $notice["pcdm4"] = $this->getPcdm4(); @@ -1258,7 +1267,7 @@ class notice_unimarc extends iso2709_record { } - public function getThesauri($notice) { + public function getThesauri() { return array_merge($this->_findThesauriIn686(), $this->_findOtherThesauri()); @@ -1271,27 +1280,34 @@ class notice_unimarc extends iso2709_record { } + /** @return array thesaurus list */ protected function _findThesauriIn686() { - $thesaurus = []; - $data = $this->get_subfield('686'); + $thesauri = $this + ->_getFluent() + ->zonesCollect(function($zone) + { + return $this->_findThesauriIn686Zone($zone); + }); - foreach($data as $items) { - $sous_champs = $this->decoupe_bloc_champ($items); - $code_thesaurus = null; - $id_origine = null; - foreach($sous_champs as $item) { - if ($item["code"] == "a") - $id_origine = $item['valeur']; - if ($item["code"] == "2") - $code_thesaurus = trim($item['valeur']); - - if ($code_thesaurus && $id_origine ) { - $thesaurus[] = Class_CodifThesaurus::findByIdOrigineAndCode($id_origine, - $code_thesaurus); - } - } - } - return $thesaurus; + return array_filter($thesauri->getArrayCopy()); + } + + + /** + * @param $zone Class_NoticeUnimarc_Zone + * @return Class_CodifThesaurus + */ + protected function _findThesauriIn686Zone($zone) { + if (!$zone->isLabel('686')) + return; + + $id_field = $zone->detectFieldByCode('a'); + $code_field = $zone->detectFieldByCode('2'); + + return $id_field && $code_field + ? Class_CodifThesaurus::findByIdOrigineAndCode($id_field->getValue(), + trim($code_field->getValue())) + : null; } diff --git a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php index 9af40c220138a19314f03e2d9e181c5c82f9a1f8..8c6999588e2106eb43d5ddba63e2cc7669dd788a 100644 --- a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php +++ b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php @@ -27,7 +27,9 @@ abstract class KohaRecordIntegrationTestCase extends NoticeIntegrationTestCase { public function getProfilDonnees() { - return Class_IntProfilDonnees::forKoha()->getRawAttributes(); + return Class_IntProfilDonnees::forKoha() + ->setIdProfil(45) + ->getRawAttributes(); } } @@ -73,11 +75,6 @@ class KohaRecordIntegrationRecordWithoutMainTitleTest extends KohaRecordIntegrat class KohaRecordIntegrationBdMilleniumTest extends KohaRecordIntegrationTestCase { - public function getProfilDonnees() { - return Class_IntProfilDonnees::forKoha()->getRawAttributes(); - } - - public function setUp() { parent::setUp(); $this->loadNotice('unimarc_bd_millenium'); @@ -99,6 +96,18 @@ class KohaRecordIntegrationBdMilleniumTest extends KohaRecordIntegrationTestCase public function collectionMilleniumShouldBeIndexed() { $this->assertEquals('MILLENIUM MILENIUM', $this->millenium->getRawAttributes()['collection']); } + + + /** @test */ + public function firstItemIdDataProfileShouldBe45() { + $this->assertEquals(45, Class_Exemplaire::find(1)->getIdDataProfile()); + } + + + /** @test */ + public function itemDataProfileLabelShouldBeUnimarcKoha() { + $this->assertEquals('Unimarc Koha', Class_Exemplaire::find(1)->getDataProfile()->getLibelle()); + } } @@ -569,18 +578,18 @@ class KohaRecordIntegrationDeduplicateTest extends KohaRecordIntegrationTestCase $this->loadRecordsFromFile('unimarc_mementos'); $this->fixture('Class_IntBib', - ['id' => 2, - 'nom' => 'My other library', - 'nom_court' => 'MOL', - 'mail' => '', - 'qualite' => 10, - 'dernier_ajout' => '2015-01-01', - 'ecart_ajouts' => '0', - 'date_mail' => '', - 'sigb' => $this->_sigb, - 'planif_mode' => 'r', - 'comm_sigb' => 0, - 'comm_params' => 'N']); + ['id' => 2, + 'nom' => 'My other library', + 'nom_court' => 'MOL', + 'mail' => '', + 'qualite' => 10, + 'dernier_ajout' => '2015-01-01', + 'ecart_ajouts' => '0', + 'date_mail' => '', + 'sigb' => $this->_sigb, + 'planif_mode' => 'r', + 'comm_sigb' => 0, + 'comm_params' => 'N']); $this->loadRecordsFromFile('unimarc_mementos', 2); $this->loadRecordsFromFile('unimarc_mementos'); @@ -610,4 +619,77 @@ class KohaRecordIntegrationDeduplicateTest extends KohaRecordIntegrationTestCase $this->assertEquals(2, Class_Exemplaire::countBy(['id_int_bib' => 2, 'id_origine' => 397126])); } -} \ No newline at end of file +} + +/** @see http://forge.afi-sa.fr/issues/96508 */ +class KohaRecordIntegrationMultipleSECTIntegrationTest extends KohaRecordIntegrationTestCase { + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + + + $this->fixture('Class_CodifThesaurus', + ['id' => 74, + 'libelle' => 'Secteur', + 'libelle_facette' => '', + 'id_thesaurus' => 'SECT', + 'id_origine' => null, + 'code' => 'SECT', + 'rule_zone' => '099', + 'rule_label_field' => 'y', + 'rule_id_field' => '', + 'rule_filter_field' => '', + 'rule_filter_value' => '' + ]); + + + + $this->fixture('Class_CodifThesaurus', + ['id' => 76, + 'libelle' => 'SANTESOCIAL', + 'libelle_facette' => 'SANTESOCIAL', + 'id_thesaurus' => 'SECT0001', + 'id_origine' => 'SANTESOCIAL', + 'code' => 'SECT', + ]); + + $this->fixture('Class_CodifThesaurus', + ['id' => 77, + 'libelle' => 'ADMINISTRATION', + 'libelle_facette' => '', + 'id_thesaurus' => 'SECT0002', + 'id_origine' => 'ADMINISTRATION', + 'code' => 'SECT'] + ); + + $this->fixture('Class_CodifThesaurus', + ['id' => 78, + 'libelle' => 'TRAVAILEMPLOI', + 'libelle_facette' => 'TRAVAILEMPLOI', + 'id_thesaurus' => 'SECT0003', + 'id_origine' => 'TRAVAILEMPLOI', + 'code' => 'SECT', + ]); + + + $writer = new Class_NoticeUnimarc_Writer(); + $writer->setNotice(file_get_contents(dirname(__FILE__)."/unimarc_minsoc_ia.txt")); + + $writer->add_field('995', ' ', [ + ['f', '12345'], + ['v', '1']]); + + $writer->update(); + $this->loadNoticeFromString($writer->getFullRecord()); + + } + + /** @test */ + public function RecordFacetsShouldContainsHSECT0001AndHSECT0002AndHSECT0003() { + $this->assertContains('HSECT0002 HSECT0001 HSECT0003', Class_Notice::find(1)->getFacettes()); + } + +} diff --git a/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php index d6701a6a176d1f5ea52c59f404e3c93bdbdd5e01..018efa8ca9031abc42aad52d4f773e4ed3262d2a 100644 --- a/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php @@ -592,9 +592,148 @@ class NanookRecordsIntegrationMultiClassificationTest extends NanookRecordsInteg -class NanookRecordsIntegrationModifLabelOnDynamicFacetTest extends NanookRecordsIntegrationTestCase { - protected $_storm_default_to_volatile = true; +/** @see http://forge.afi-sa.fr/issues/94786 */ +class NanookRecordsIntegrationExistingRecordWithRemovedClasstificationTest + extends NanookRecordsIntegrationTestCase { + protected $_facets; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Notice', + [ + 'id' => 10843, + 'type_doc' => '3', + 'alpha_titre' => 'SUITES DE BALLETS', + 'alpha_auteur' => 'TCHAIKOVSKI PIOTR ILYICH', + 'titres' => 'SUITES SUIT BALLETS BAL LAC CYGNES SIN SUITE EXTRAITE EXTRAIT BALLET 20 BELLE BEL BOIS BOI DORMANT DORMAN 66 CASSE KAS NOISETTE NOISET 71 PIOTR ILYICH ILICH TCHAIKOVSKI WITOLD OUITOL ROWICKI ROUIKI DIR FERDINAND FERDINAN LEITNER LEITN ORCHESTRE ORKESTR SYMPHONIQUE SINFONIK PHILHARMONIE FILARMONI NATIONALE NASIONAL VARSOVIE VARSOVI BERL PANORAMA CLASSIQUE KLASIK', + 'auteurs' => 'TCHAIKOVSKI PIOTR ILYICH ILICH ROWICKI ROUIKI WITOLD OUITOL LEITNER LEITN FERDINAND FERDINAN ORCHESTRE ORKESTR SYMPHONIQUE SINFONIK PHILHARMONIE FILARMONI NATIONALE NASIONAL VARSOVIE VARSOVI BERLINER BERLIN PHILHARMONIKER FILARMONIK', + 'editeur' => 'Polydor', + 'collection' => 'PANORAMA CLASSIQUE KLASIK', + 'matieres' => 'BALLET BAL MUSIQUE MUSIK CLASSIQUE KLASIK', + 'dewey' => 'MUSIQUE MUSIK CLASSIQUE KLASIK SAVANTE SAVANT OCCIDENTALE OKSIDANTAL 4 10 ANS TEST TES 1 COMPACT KONPAKT DISQUES DISK ADULTECOMPACT ADULTEKONPAKT ADULTE ADULT', + 'facettes' => 'P3 HNIVE0003 HNIVE0001 A19940 A25031 A25032 A25033 A13670 M6999 M4926 G5 T3 B1 S1 E37 Y1 V1', + 'cote' => '3 TCH 28', + 'isbn' => '', + 'ean' => '', + 'id_commerciale' => '', + 'id_bnf' => '', + 'clef_alpha' => 'SUITESDEBALLETS--TCHAIKOVSKIP--POLYDOR-1993-3', + 'clef_oeuvre' => 'SUITESDEBALLETS--TCHAIKOVSKIP-', + 'clef_chapeau' => 'PANORAMA CLASSIQUE', + 'tome_alpha' => '', + 'annee' => '1993', + 'qualite' => '5', + 'exportable' => '1', + 'date_creation' => '0000-00-00 00:00:00', + 'date_maj' => '2019-07-26 23:13:37', + 'unimarc' => '01613njm0 2200301 450 00100060000001000110000610000450001720000220006221000260008422500320011041000230014246400540016546400610021946401950028060600110047560600220048668600760050868600390058470000310062370200200065470200230067471200670069771200280076480100170079290003240080999300150113399601630114811785 d41,5 F a20110812u u u0frey50 1 aSuites de ballets cPolydordRééd. 19932 aPanorama classique9id:2999 0tPanorama classique tLe Lac des cygnes:suite extraite du ballet op. 20 tLa belle au bois dormant:suite extraite du ballet op. 66 tCasse-noisette:suite extraite du ballet op. 71/ Piotr Ilyich Tchaïkovski, Witold Rowicki, dir., Ferdinand Leitner, dir., Orchestre Symphonique de la Philharmonie Nationale de Varsovie, Berl 1aballet amusique classique a3tMusique classique (Musique savante de tradition occidentale)2Cestas aAdultestAdultes2Code stat Cestas 1aTchaïkovskibPiotr Ilyich 1aRowickibWitold 1aLeitnerbFerdinand02aOrchestre Symphonique de la Philharmonie Nationale de Varsovie 1aBerliner Philharmoniker 2aFrc20190726 aLe Lac des cygnes:suite extraite du ballet op. 20 ; La belle au bois dormant:suite extraite du ballet op. 66 ; Casse-noisette:suite extraite du ballet op. 71/ Piotr Ilyich Tchaïkovski, Witold Rowicki, dir., Ferdinand Leitner, dir., Orchestre Symphonique de la Philharmonie Nationale de Varsovie, BerllContientntracks 41a0-4 ans f35025224k3 TCH 28m00000000n00000000aFonds propreb2vMédiathèque MunicipalexCompact disques adulteeCompact disque adulterCD1Document en bon état31', + 'z3950_retry' => '0', + 'nb_visu' => '0', + 'nb_resa' => '0', + 'url_vignette' => 'NO', + 'url_image' => 'NO', + 'created_at' => null, + 'other_terms' => '', + 'type' => '1', + 'file_content' => '', + ]); + + $this->fixture('Class_Exemplaire', + [ + 'id' => '58723', + 'id_notice' => '10843', + 'id_bib' => '1', + 'code_barres' => '35025224', + 'cote' => '3 TCH 28', + 'genre' => '5', + 'documentaire' => '0', + 'section' => '1', + 'activite' => 'En rayon', + 'emplacement' => '37', + 'annexe' => '1', + 'date_nouveaute' => '0000-00-00', + 'zone995' => 'a:14:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:23:"Médiathèque de Cestas";}i:1;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:8:"35025224";}i:2;a:2:{s:4:"code";s:1:"k";s:6:"valeur";s:8:"3 TCH 28";}i:3;a:2:{s:4:"code";s:1:"m";s:6:"valeur";s:8:"20190726";}i:4;a:2:{s:4:"code";s:1:"q";s:6:"valeur";s:1:"d";}i:5;a:2:{s:4:"code";s:1:"r";s:6:"valeur";s:2:"je";}i:6;a:2:{s:4:"code";s:1:"o";s:6:"valeur";s:1:"p";}i:7;a:2:{s:4:"code";s:1:"v";s:6:"valeur";s:1:"1";}i:8;a:2:{s:4:"code";s:1:"2";s:6:"valeur";s:47:"[DISPO][Disponible][0][1][En rayon][0][0][0][0]";}i:9;a:2:{s:4:"code";s:1:"5";s:6:"valeur";s:1:"0";}i:10;a:2:{s:4:"code";s:1:"6";s:6:"valeur";s:2:"41";}i:11;a:2:{s:4:"code";s:1:"7";s:6:"valeur";s:1:"5";}i:12;a:2:{s:4:"code";s:1:"8";s:6:"valeur";s:1:"1";}i:13;a:2:{s:4:"code";s:1:"9";s:6:"valeur";s:1:"1";}}', + 'id_origine' => '11785', + 'id_int_bib' => '1', + 'is_available' => '1', + 'url' => null, + 'to_delete' => '0', + 'type' => '1', + ]); + + + $this->fixture('Class_CodifThesaurus', + ['id' => 73, + 'libelle' => 'Niveau de lecture', + 'libelle_facette' => 'Niveau de lecture', + 'Id_thesaurus' => 'NIVE', + 'id_origine' => null, + 'code' => 'NIVE', + 'rule_zone' => '993', + 'rule_label_field' => 'a', + 'rule_id_field' => '4', + 'rule_filter_field' => '', + 'rule_filter_value' => '', + 'rules' => '{"LabelStartPos":"1","LabelLength":"0","Zone":"993","LabelField":"a","IdField":"4","FilterField":"","FilterValue":""}', + ]); + + $this->fixture('Class_CodifThesaurus', + ['id' => 75, + 'libelle' => '0-4 ans', + 'libelle_facette' => '0-4 ans', + 'id_thesaurus' => 'NIVE0001', + 'id_origine' => 1, + 'code' => 'NIVE', + ]); + + $this->fixture('Class_CodifThesaurus', + ['id' => 89, + 'libelle' => '4-10 Ans', + 'libelle_facette' => '4-10 Ans', + 'id_thesaurus' => 'NIVE0003', + 'id_origine' => 3, + 'code' => 'NIVE', + ]); + + $this->fixture('Class_CodifThesaurus', + ['id' => 5, + 'libelle' => 'Adultes', + 'id_thesaurus' => 'CFCF00010003', + 'id_origine' => 'CFCF00010003', + 'code' => 'Custom Fields', + 'rule' => null + ]); + + // storm volatile cannot find all by not null + $this->onLoaderOfModel('Class_CodifThesaurus') + ->whenCalled('findAllBy') + ->with(['rules not' => null]) + ->answers([Class_CodifThesaurus::find(73)]); + + $this->loadNotice('unimarc_cestas_tchaikovsky'); + $this->_facets = Class_Notice::find(10843)->getFacetCodes(); + } + + /** @test */ + public function recordFacetsShouldStillContainsNIVE0001() { + $this->assertContains('HNIVE0001', $this->_facets, + json_encode($this->_facets, JSON_PRETTY_PRINT)); + } + + + /** @test */ + public function recordFacetsShouldNoLongerContainsNIVE0003() { + $this->assertNotContains('HNIVE0003', $this->_facets, + json_encode($this->_facets, JSON_PRETTY_PRINT)); + } +} + + + + +class NanookRecordsIntegrationModifLabelOnDynamicFacetTest extends NanookRecordsIntegrationTestCase { public function setUp() { parent::setUp(); diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 236d240ea668e84f9fc0e01eb29e06fcad1b4c1b..5ac077079ac59a5efc6380dd4a383494be95744a 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -25,69 +25,69 @@ require_once 'ModelTestCase.php'; abstract class NoticeIntegrationTestCase extends ModelTestCase { - protected - $notice_sgbd, - $_mock_sql, - $_insert_increment, + protected + $notice_sgbd, + $_mock_sql, + $_insert_increment, $_sigb = Class_IntBib::COM_PERGAME; - public function getProfilDonnees() { - return $this->_profil_donnees; - } + public function getProfilDonnees() { + return $this->_profil_donnees; + } - public function setupProfilDonnees() { - $this->_insert_increment = 12; + public function setupProfilDonnees() { + $this->_insert_increment = 12; - $this->_profil_donnees = $this->getProfilDonnees(); + $this->_profil_donnees = $this->getProfilDonnees(); - if (!isset($this->_profil_donnees)) - return; + if (!isset($this->_profil_donnees)) + return; - $req_profils = 'select * from profil_donnees where id_profil='.$this->_profil_donnees['id_profil']; + $req_profils = 'select * from profil_donnees where id_profil='.$this->_profil_donnees['id_profil']; $this->_profil_donnees['id'] = $this->_profil_donnees['id_profil']; - $this->fixture('Class_IntProfilDonnees', $this->_profil_donnees); - - $this->_mock_sql - ->whenCalled('fetchEnreg') - ->with($req_profils) - ->answers($this->_profil_donnees) - - ->whenCalled('fetchEnreg') - ->with($req_profils, false) - ->answers($this->_profil_donnees); - } - - - public function setUp() { - parent::setUp(); - - global $sql; - $sql = $this->_mock_sql = $this->mock(); - profil_donnees::clearCache(); - - $this->_mock_sql - ->whenCalled('execute')->answers(true) - ->whenCalled('fetchAll')->answers(null) - ->whenCalled('insert')->willDo( - function() { - $args = func_get_args(); - if ($args[0] == 'notices') { - $inc = $this->_insert_increment; - $this->_insert_increment++; - return $inc; - } - return 12; - }) - ->whenCalled('update')->answers(null) - ->whenCalled('fetchEnreg')->answers(null) - ->whenCalled('fetchOne')->answers(null); - - - VariableCache::getInstance() - ->setValeurCache(['filtrer_fulltext' => 1, + $this->fixture('Class_IntProfilDonnees', $this->_profil_donnees); + + $this->_mock_sql + ->whenCalled('fetchEnreg') + ->with($req_profils) + ->answers($this->_profil_donnees) + + ->whenCalled('fetchEnreg') + ->with($req_profils, false) + ->answers($this->_profil_donnees); + } + + + public function setUp() { + parent::setUp(); + + global $sql; + $sql = $this->_mock_sql = $this->mock(); + profil_donnees::clearCache(); + + $this->_mock_sql + ->whenCalled('execute')->answers(true) + ->whenCalled('fetchAll')->answers(null) + ->whenCalled('insert')->willDo( + function() { + $args = func_get_args(); + if ($args[0] == 'notices') { + $inc = $this->_insert_increment; + $this->_insert_increment++; + return $inc; + } + return 12; + }) + ->whenCalled('update')->answers(null) + ->whenCalled('fetchEnreg')->answers(null) + ->whenCalled('fetchOne')->answers(null); + + + VariableCache::getInstance() + ->setValeurCache(['filtrer_fulltext' => 1, 'mode_doublon'=> 1, 'tracer_accents_iso'=>1, 'non_exportable'=> 'electre;decitre;gam;zebris', @@ -96,42 +96,42 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase { 'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY, 'champs_sup' => '', 'ean_345' => '']) - ->setListeCache(['nature_docs'=> "1:Collection\r\n2:Dataset\r\n3:Event\r\n4:Image"]); + ->setListeCache(['nature_docs'=> "1:Collection\r\n2:Dataset\r\n3:Event\r\n4:Image"]); Codif_Langue::getInstance() - ->setCodif(['fre' => ['id_langue' => 'fre', - 'libelle' => 'français']]); + ->setCodif(['fre' => ['id_langue' => 'fre', + 'libelle' => 'français']]); $this->fixture('Class_CodifLangue', ['id' => 'fre', 'libelle' => 'Français']); - $this->fixture('Class_IntBib', - ['id' => 1, - 'nom' => 'My wonderful library', - 'nom_court' => 'MWL', - 'mail' => '', - 'qualite' => 10, - 'dernier_ajout' => '2015-01-01', - 'ecart_ajouts' => '0', - 'date_mail' => '', - 'sigb' => $this->_sigb, - 'planif_mode' => 'r', - 'comm_sigb' => 0, - 'comm_params' => 'N']); - - $this->notice_sgbd = new notice_unimarc(); - $this->setupProfilDonnees(); - } + $this->fixture('Class_IntBib', + ['id' => 1, + 'nom' => 'My wonderful library', + 'nom_court' => 'MWL', + 'mail' => '', + 'qualite' => 10, + 'dernier_ajout' => '2015-01-01', + 'ecart_ajouts' => '0', + 'date_mail' => '', + 'sigb' => $this->_sigb, + 'planif_mode' => 'r', + 'comm_sigb' => 0, + 'comm_params' => 'N']); + + $this->notice_sgbd = new notice_unimarc(); + $this->setupProfilDonnees(); + } - public function loadNotice($filename) { - $this->loadNoticeFromString(file_get_contents(__DIR__ . '/' . $filename . '.txt')); - } + public function loadNotice($filename) { + $this->loadNoticeFromString(file_get_contents(__DIR__ . '/' . $filename . '.txt')); + } - public function loadNoticeFromString($unimarc, $id_bib = 1) { - $this->notice_integration = new notice_integration(); - $this->notice_integration->setParamsIntegration($id_bib, + public function loadNoticeFromString($unimarc, $id_bib = 1) { + $this->notice_integration = new notice_integration(); + $this->notice_integration->setParamsIntegration($id_bib, 0, isset($this->_profil_donnees['id_profil']) ? $this->_profil_donnees['id_profil'] @@ -141,20 +141,20 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase { ->whenCalled('run') ->answers(['statut' => 'KO']); $this->notice_integration->setServiceRunner($this->_service_runner); - $this->notice_integration->traiteNotice($unimarc); - $this->notice_integration->traiteFacettes(); - $this->notice_data = $this->notice_integration->getNotice(); - } + $this->notice_integration->traiteNotice($unimarc); + $this->notice_integration->traiteFacettes(); + $this->notice_data = $this->notice_integration->getNotice(); + } public function loadRecordsFromFile($filename, $id_bib = 1) { $contents = file_get_contents(dirname(__FILE__) . "/" . $filename . '.txt'); - array_map(function($content) use ($id_bib) + array_map(function($content) use ($id_bib) { return $this->loadNoticeFromString($content, $id_bib); }, - preg_split('/'.chr(30).chr(29).'/', $contents)); + preg_split('/'.chr(30).chr(29).'/', $contents)); } } @@ -167,88 +167,88 @@ class NoticeIntegrationLollipopGeneratedNoticeRecordTest extends NoticeIntegrati } - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->loadNotice('unimarc_lollipop'); - } + $this->loadNotice('unimarc_lollipop'); + } - /** @test */ - public function facetteShouldContainsLangueFre() { - $this->assertContains(' Lfre', $this->notice_data['facettes']); - } + /** @test */ + public function facetteShouldContainsLangueFre() { + $this->assertContains(' Lfre', $this->notice_data['facettes']); + } - /** @test */ - public function codeAlphaShouldBeLollipop() { - $this->assertEquals('LOLLIPOP--NOSTLINGERC--ECOLEDESLOISIRS-1987-1', + /** @test */ + public function codeAlphaShouldBeLollipop() { + $this->assertEquals('LOLLIPOP--NOSTLINGERC--ECOLEDESLOISIRS-1987-1', $this->notice_data['clef_alpha']); - } + } - /** @test */ - public function typeDocShouldBeBook() { - $this->assertEquals(Class_TypeDoc::LIVRE, $this->notice_data['type_doc']); - } + /** @test */ + public function typeDocShouldBeBook() { + $this->assertEquals(Class_TypeDoc::LIVRE, $this->notice_data['type_doc']); + } - /** @test */ - public function clefOeuvreShouldBeLollipop() { - $this->assertEquals('LOLLIPOP--NOSTLINGERC-', $this->notice_data['clef_oeuvre']); - } + /** @test */ + public function clefOeuvreShouldBeLollipop() { + $this->assertEquals('LOLLIPOP--NOSTLINGERC-', $this->notice_data['clef_oeuvre']); + } - /** @test */ - public function noticeDbEnregTitresShouldBeLollipopAndLolipop() { - $this->assertEquals('LOLLIPOP LOLIPOP NEUF NEF', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['titres']); - } + /** @test */ + public function noticeDbEnregTitresShouldBeLollipopAndLolipop() { + $this->assertEquals('LOLLIPOP LOLIPOP NEUF NEF', + $this->notice_integration->noticeToDBEnreg($this->notice_data)['titres']); + } - /** @test */ - public function noticeDbEnregEditeurShouldBeEcoleEkolLoisirsLoisir() { - $this->assertEquals('ECOLE EKOL LOISIRS LOISIR', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['editeur']); - } + /** @test */ + public function noticeDbEnregEditeurShouldBeEcoleEkolLoisirsLoisir() { + $this->assertEquals('ECOLE EKOL LOISIRS LOISIR', + $this->notice_integration->noticeToDBEnreg($this->notice_data)['editeur']); + } } abstract class NoticeIntegrationMarc21ToUnimarcTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->notice_marc21 = new notice_marc21(); - $this->notice_marc21->ouvrirNotice(file_get_contents(dirname(__FILE__)."/marc21_etalon.txt"), 0); - $this->notice_sgbd->ouvrirNotice($this->notice_marc21->getFullRecord()); - } + $this->notice_marc21 = new notice_marc21(); + $this->notice_marc21->ouvrirNotice(file_get_contents(dirname(__FILE__)."/marc21_etalon.txt"), 0); + $this->notice_sgbd->ouvrirNotice($this->notice_marc21->getFullRecord()); + } - /** @test */ - public function zone461TInUnimarcShouldContainsTitres() { - $this->assertEquals(['Titre général ;', 'titre general ;'], $this->notice_sgbd->get_subfield('461', 't')); - } + /** @test */ + public function zone461TInUnimarcShouldContainsTitres() { + $this->assertEquals(['Titre général ;', 'titre general ;'], $this->notice_sgbd->get_subfield('461', 't')); + } - /** @test */ - public function zone461TInMarc21ShouldContainsTitres() { - $this->assertEquals(['Titre général ;', 'titre general ;'], $this->notice_marc21->get_subfield('461', 't')); - } + /** @test */ + public function zone461TInMarc21ShouldContainsTitres() { + $this->assertEquals(['Titre général ;', 'titre general ;'], $this->notice_marc21->get_subfield('461', 't')); + } } abstract class NoticeIntegrationMarc21DynixTestCase extends NoticeIntegrationTestCase { - protected $_profil_donnees = ['id' => 150, + protected $_profil_donnees = ['id' => 150, 'id_profil' => 150, - 'libelle' => 'MARC21 Dynix', - 'accents' => '4', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '0', - 'type_fichier' => '0', - 'format' => '6', - 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:12:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:22:"LIV;MS;LDV;LVI;LV;LIVC";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:12:"PER;REVC;REV";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:17:"CD;LIVCD;LIVK7;K7";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:25:"DIAPO;DVD;VHS;VHD;VD;DVDJ";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"7";s:5:"label";s:0:"";s:8:"zone_995";s:7:"LCA;LCD";}i:7;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:8;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:10;a:3:{s:4:"code";s:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:2:"JV";}i:11;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:3:"999";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:1:"r";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"z";s:17:"champ_emplacement";s:1:"u";s:12:"champ_annexe";s:1:"b";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"v";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"n";}i:6;a:2:{s:4:"zone";s:3:"901";s:5:"champ";s:1:"a";}}']; + 'libelle' => 'MARC21 Dynix', + 'accents' => '4', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '0', + 'type_fichier' => '0', + 'format' => '6', + 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:12:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:22:"LIV;MS;LDV;LVI;LV;LIVC";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:12:"PER;REVC;REV";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:17:"CD;LIVCD;LIVK7;K7";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:25:"DIAPO;DVD;VHS;VHD;VD;DVDJ";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"7";s:5:"label";s:0:"";s:8:"zone_995";s:7:"LCA;LCD";}i:7;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:8;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:10;a:3:{s:4:"code";s:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:2:"JV";}i:11;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:3:"999";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:1:"r";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"z";s:17:"champ_emplacement";s:1:"u";s:12:"champ_annexe";s:1:"b";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"v";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"n";}i:6;a:2:{s:4:"zone";s:3:"901";s:5:"champ";s:1:"a";}}']; } @@ -257,76 +257,76 @@ abstract class NoticeIntegrationMarc21DynixTestCase extends NoticeIntegrationTes class NoticeIntegrationMarc21CoupCavalierToUnimarcTest extends NoticeIntegrationMarc21DynixTestCase { - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->fixture('Class_CodifSection', - ['id' => 2, 'regles' => '996$z=ADU']); + $this->fixture('Class_CodifSection', + ['id' => 2, 'regles' => '996$z=ADU']); - $this->notice_marc21 = new notice_marc21(); - $this->notice_marc21->ouvrirNotice(file_get_contents(dirname(__FILE__)."/marc21_coup_cavalier.txt"), + $this->notice_marc21 = new notice_marc21(); + $this->notice_marc21->ouvrirNotice(file_get_contents(dirname(__FILE__)."/marc21_coup_cavalier.txt"), $this->_profil_donnees['id_profil']); - $this->notice_data = $this->notice_marc21->getNoticeIntegration(); - } + $this->notice_data = $this->notice_marc21->getNoticeIntegration(); + } - /** @test */ - public function zone200AShouldBeLeCoupDuCavalier() { - $this->assertEquals('Le coup du cavalier', + /** @test */ + public function zone200AShouldBeLeCoupDuCavalier() { + $this->assertEquals('Le coup du cavalier', $this->notice_marc21->get_subfield('200', 'a')[0]); - } - - - /** @test */ - public function zone210CShouldBeEditeurMetailie() { - $this->assertEquals('Métailié,', $this->notice_marc21->get_subfield('210', 'c')[0]); - } + } - /** @test */ - public function zone996iShouldBe00715585() { - $this->assertEquals('00715585', $this->notice_marc21->get_subfield('996', 'i')[0]); - } + /** @test */ + public function zone210CShouldBeEditeurMetailie() { + $this->assertEquals('Métailié,', $this->notice_marc21->get_subfield('210', 'c')[0]); + } - /** @test */ - public function sectionShouldHaveId2() { - $this->assertEquals(2, $this->notice_data['exemplaires'][0]['section']); - } + /** @test */ + public function zone996iShouldBe00715585() { + $this->assertEquals('00715585', $this->notice_marc21->get_subfield('996', 'i')[0]); + } - /** @test */ - public function getAllShouldReturnAllFields() { - $all = $this->notice_marc21->getAll(); + /** @test */ + public function sectionShouldHaveId2() { + $this->assertEquals(2, $this->notice_data['exemplaires'][0]['section']); + } - $this->assertEquals('Le coup du cavalier', $all['titre_princ']); - $this->assertEquals([ ['Longueur de la notice', 920], - ['Statut de la notice', 'n'], - ['Type de document', 'am'], - ['Niveau hiérarchique', 0], - ['Adresse des données', 193], - ['Niveau de catalogage' , '1'] - ], - $all['label']); - $this->assertEquals('Quadruppani, Serge', $all['zones'][11]['champs'][0]['valeur']); - $this->assertEquals('ADU', trim($all['zones'][12]['champs'][14]['valeur'])); - } + /** @test */ + public function getAllShouldReturnAllFields() { + $all = $this->notice_marc21->getAll(); + + $this->assertEquals('Le coup du cavalier', $all['titre_princ']); + $this->assertEquals([ ['Longueur de la notice', 920], + ['Statut de la notice', 'n'], + ['Type de document', 'am'], + ['Niveau hiérarchique', 0], + ['Adresse des données', 193], + ['Niveau de catalogage' , '1'] + ], + + $all['label']); + $this->assertEquals('Quadruppani, Serge', $all['zones'][11]['champs'][0]['valeur']); + $this->assertEquals('ADU', trim($all['zones'][12]['champs'][14]['valeur'])); + } } class NoticeIntegrationMarc21BorisToUnimarcTest extends NoticeIntegrationMarc21DynixTestCase { - public function setUp() { - parent::setUp(); - $this->loadNotice('marc21_boris'); - } - - /** @test */ - public function sectionShouldHaveId2() { - $this->assertEquals('BORIS-JAI1AN1AN1AN1AN---TMAGNIER-2014-0', $this->notice_data['clef_alpha']); - } + public function setUp() { + parent::setUp(); + $this->loadNotice('marc21_boris'); + } + + /** @test */ + public function sectionShouldHaveId2() { + $this->assertEquals('BORIS-JAI1AN1AN1AN1AN---TMAGNIER-2014-0', $this->notice_data['clef_alpha']); + } } @@ -360,7 +360,7 @@ class NoticeIntegrationMarc21WithItemsIn952Test extends NoticeIntegrationMarc21D 'valeurs' => '']]]) ->setIdProfil(23) ->getRawAttributes(); - } + } public function setUp() { @@ -400,98 +400,85 @@ class NoticeIntegrationMarc21WithItemsIn952Test extends NoticeIntegrationMarc21D class NoticeIntegrationBourdieuWithElectreGeneratedNoticeRecordTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - - Codif_langue::getInstance() - ->setCodif(['fre' => ['id_langue' => 'fre', - 'libelle' => 'français']]); - - $this->fixture('Class_CodifThesaurus', - ['id' => 2222, - 'id_origine' => 'T380500', - 'id_thesaurus' => 'AAAA0001222', - 'code' => 'thèmeelectre', - 'libelle' => 'Modes de vie et comportements selon les pays', - 'rules' => null]); + public function setUp() { + parent::setUp(); - $this->fixture('Class_CodifThesaurus', - ['id' => 88, - 'id_origine' => 'PS0100', - 'id_thesaurus' => 'AAAA88', - 'code' => 'publicelectre', - 'libelle' => 'Public motivé', - 'rules' => null]); + Codif_langue::getInstance() + ->setCodif(['fre' => ['id_langue' => 'fre', + 'libelle' => 'français']]); - $this->notice_integration = new notice_integration(); - $this->notice_integration->setParamsIntegration(1, 0, 1); - $this->notice_integration->traiteNotice(file_get_contents(dirname(__FILE__)."/unimarc_bourdieu.txt")); - $this->notice_integration->traiteFacettes(); - $this->notice_data = $this->notice_integration->getNotice(); - } + $this->fixture('Class_CodifThesaurus', + ['id' => 88, + 'id_origine' => 'PS0100', + 'id_thesaurus' => 'AAAA88', + 'code' => 'publicelectre', + 'libelle' => 'Public motivé', + 'rules' => null]); + $this->notice_integration = new notice_integration(); + $this->notice_integration->setParamsIntegration(1, 0, 1); + $this->notice_integration->traiteNotice(file_get_contents(dirname(__FILE__)."/unimarc_bourdieu.txt")); + $this->notice_integration->traiteFacettes(); + $this->notice_data = $this->notice_integration->getNotice(); - /** @test */ - public function clefOeuvreShouldBeLaMisereDuMonde() { - $this->assertEquals('MISEREDUMONDELA--BOURDIEUP-', $this->notice_data['clef_oeuvre']); - } + } - /** @test */ - public function themeElectreShouldBeTAAAA0001222() { - $this->assertEquals('AAAA0001222', $this->notice_data['thesauri'][0]->getIdThesaurus()); - } + /** @test */ + public function clefOeuvreShouldBeLaMisereDuMonde() { + $this->assertEquals('MISEREDUMONDELA--BOURDIEUP-', $this->notice_data['clef_oeuvre']); + } - /** @test */ - public function codeShouldBePublicElectre() { - $this->assertEquals('publicelectre', $this->notice_data['thesauri'][2]->getCode()); - } + /** @test */ + public function codeShouldBePublicElectre() { + $this->assertEquals('publicelectre', $this->notice_data['thesauri'][0]->getCode()); + } - /** @test */ - public function libelleShouldBePublicMotive() { - $this->assertEquals('Public motivé', $this->notice_data['thesauri'][2]->getLibelle()); - } + /** @test */ + public function libelleShouldBePublicMotive() { + $this->assertEquals('Public motivé', $this->notice_data['thesauri'][0]->getLibelle()); + } - /** @test */ - public function facetteShouldContainsThesaurusIds() { - $this->assertContains('HAAAA0001222 HAAAA88 ', $this->notice_data['facettes']); - } + /** @test */ + public function facetteShouldContainsThesaurusIds() { + $this->assertContains('HAAAA88 ', $this->notice_data['facettes']); + } - /** @test */ - public function fullTextShouldContainsThesaurusLibelles() { - $this->assertContains('Modes de vie et comportements selon les pays Public motivé', $this->notice_data['full_dewey']); - } + /** @test */ + public function fullTextShouldContainsThesaurusLibelles() { + $this->assertContains('Public motivé', $this->notice_data['full_dewey']); + } } class NoticeIntegrationSupertrampWithElectreAndPcmd4GeneratedNoticeRecordTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - Codif_langue::getInstance()->setCodif(['fre' => ['id_langue' => 'fre', - 'libelle' => 'français']]); + Codif_langue::getInstance()->setCodif(['fre' => ['id_langue' => 'fre', + 'libelle' => 'français']]); - $this->notice_integration = new notice_integration(); - $this->notice_integration->setParamsIntegration(1, 0, 1); - $this->notice_integration->traiteNotice(file_get_contents(dirname(__FILE__)."/unimarc_supertramp.txt")); - $this->notice_integration->traiteFacettes(); - $this->notice_data = $this->notice_integration->getNotice(); + $this->notice_integration = new notice_integration(); + $this->notice_integration->setParamsIntegration(1, 0, 1); + $this->notice_integration->traiteNotice(file_get_contents(dirname(__FILE__)."/unimarc_supertramp.txt")); + $this->notice_integration->traiteFacettes(); + $this->notice_data = $this->notice_integration->getNotice(); - } + } - /** @test */ - public function facetteShouldBePcdm4() { - $this->assertContains('P215', $this->notice_data['facettes']); - } + /** @test */ + public function facetteShouldBePcdm4() { + $this->assertContains('P215', $this->notice_data['facettes']); + } } @@ -552,190 +539,190 @@ class NoticeIntegrationKohaNeonWithPcmd4GeneratedNoticeRecordTest extends Notice class NoticeIntegrationMussoWithoutRenvoisTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - $this->loadNotice("unimarc_musso"); - } + public function setUp() { + parent::setUp(); + $this->loadNotice("unimarc_musso"); + } - /** @test */ - public function auteursShouldContainsMUSSO() { - $this->assertContains('MUSSO MUSO GUILLAUME', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['auteurs']); - } + /** @test */ + public function auteursShouldContainsMUSSO() { + $this->assertContains('MUSSO MUSO GUILLAUME', + $this->notice_integration->noticeToDBEnreg($this->notice_data)['auteurs']); + } } class NoticeIntegrationCekovTest extends NoticeIntegrationTestCase { - protected - $_profil_donnees = - ['id_profil' => 409, - 'libelle' => 'UNIMARC', - 'accents' => '1', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '0', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => 'a:6:{i:0;a:7:{s:8:"type_doc";a:11:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:0:"";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:10:"champ_cote";s:1:"k";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"u";s:12:"champ_annexe";s:1:"a";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:4;a:5:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";s:6:"format";s:0:"";s:5:"jours";s:0:"";s:7:"valeurs";s:0:"";}i:5;a:2:{s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:10:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";}}}' - ]; - - public function setUp() { - parent::setUp(); - $this->loadNotice("unimarc_cekov"); - $this->notice_integration->analyseurUpdate(); - } - - - /** @test */ - public function auteurPrincipalShouldBeCechov() { - $this->assertEquals('ÄŒehov', - $this->notice_integration->get_subfield('700', 'a')[0]); - } - - - /** @test */ - public function zone200bShouldBeTexteImprime() { - $this->assertEquals('Texte imprimé', - $this->notice_integration->get_subfield('200', 'b')[0]); - } - - - /** @test */ - public function noticeShouldHaveOneItem() { - $this->assertEquals(1, count($this->notice_data['exemplaires'])); - } - - - /** @test */ - public function noticeFirstItemShouldHaveZone995AsSerializedArray() { - $this->assertEquals( - serialize([['code' => 'a', 'valeur' => 'Béalières'], - ['code' => 'f', 'valeur' => '0002'], - ['code' => 'k', 'valeur' => '915.770 ÄŒEH'], - ['code' => 'm', 'valeur' => '20131106'], - ['code' => 'q', 'valeur' => 'a'], - ['code' => 'r', 'valeur' => 'aa'], - ['code' => 'o', 'valeur' => 'c'], - ['code' => '2', 'valeur' => '[DISP][Disponible][0][1][En rayon][0][0][0][0]'], - ['code' => '4', 'valeur' => '2014-02-04'], - ['code' => '8', 'valeur' => '2'], - ['code' => '9', 'valeur' => '2']]), - - $this->notice_data['exemplaires'][0]['zone995']); - } - - - /** @test */ - public function firstItemCoteShouldBe915Etc() { - $this->assertEquals('915.770 ÄŒEH', $this->notice_data['exemplaires'][0]['cote']); - } - - - /** @test */ - public function firstItemActivityShouldBeEnRayon() { - $this->assertEquals('En rayon', - $this->notice_data['exemplaires'][0]['activite']); - } + protected + $_profil_donnees = + ['id_profil' => 409, + 'libelle' => 'UNIMARC', + 'accents' => '1', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '0', + 'type_fichier' => '0', + 'format' => '0', + 'attributs' => 'a:6:{i:0;a:7:{s:8:"type_doc";a:11:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:0:"";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:10:"champ_cote";s:1:"k";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"u";s:12:"champ_annexe";s:1:"a";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:4;a:5:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";s:6:"format";s:0:"";s:5:"jours";s:0:"";s:7:"valeurs";s:0:"";}i:5;a:2:{s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:10:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";}}}' + ]; + + public function setUp() { + parent::setUp(); + $this->loadNotice("unimarc_cekov"); + $this->notice_integration->analyseurUpdate(); + } + + + /** @test */ + public function auteurPrincipalShouldBeCechov() { + $this->assertEquals('ÄŒehov', + $this->notice_integration->get_subfield('700', 'a')[0]); + } + + + /** @test */ + public function zone200bShouldBeTexteImprime() { + $this->assertEquals('Texte imprimé', + $this->notice_integration->get_subfield('200', 'b')[0]); + } + + + /** @test */ + public function noticeShouldHaveOneItem() { + $this->assertEquals(1, count($this->notice_data['exemplaires'])); + } + + + /** @test */ + public function noticeFirstItemShouldHaveZone995AsSerializedArray() { + $this->assertEquals( + serialize([['code' => 'a', 'valeur' => 'Béalières'], + ['code' => 'f', 'valeur' => '0002'], + ['code' => 'k', 'valeur' => '915.770 ÄŒEH'], + ['code' => 'm', 'valeur' => '20131106'], + ['code' => 'q', 'valeur' => 'a'], + ['code' => 'r', 'valeur' => 'aa'], + ['code' => 'o', 'valeur' => 'c'], + ['code' => '2', 'valeur' => '[DISP][Disponible][0][1][En rayon][0][0][0][0]'], + ['code' => '4', 'valeur' => '2014-02-04'], + ['code' => '8', 'valeur' => '2'], + ['code' => '9', 'valeur' => '2']]), + + $this->notice_data['exemplaires'][0]['zone995']); + } + + + /** @test */ + public function firstItemCoteShouldBe915Etc() { + $this->assertEquals('915.770 ÄŒEH', $this->notice_data['exemplaires'][0]['cote']); + } + + + /** @test */ + public function firstItemActivityShouldBeEnRayon() { + $this->assertEquals('En rayon', + $this->notice_data['exemplaires'][0]['activite']); + } } class NoticeIntegrationLearningWithRenvoisTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - $this->loadNotice("unimarc_learning_from_vernacular"); - } + public function setUp() { + parent::setUp(); + $this->loadNotice("unimarc_learning_from_vernacular"); + } - /** @test */ - public function auteursShouldContainsFrey() { - $this->assertContains('FREY FRAI PIERRE PIER', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['auteurs']); - } + /** @test */ + public function auteursShouldContainsFrey() { + $this->assertContains('FREY FRAI PIERRE PIER', + $this->notice_integration->noticeToDBEnreg($this->notice_data)['auteurs']); + } } class NoticeIntegrationBearsBeerMicrobibTest extends NoticeIntegrationTestCase { - public function getProfilDonnees() { - return - ['id_profil' => 106, - 'libelle' => 'Microbib', - 'accents' => '1', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '2', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => serialize( - [ [ - 'type_doc' => [ - [ 'code' => '0', 'label' => '', 'zone_995' => '' ], - [ 'code' => '1', 'label' => 'am;as', 'zone_995' => 'az' ], - [ 'code' => '2', 'label' => '', 'zone_995' => ''], - [ 'code' => '3', 'label' => 'i;j;k', 'zone_995' => ''], - [ 'code' => '4', 'label' => 'g','zone_995' => ''], - [ 'code' => '5', 'label' => 'l;m', 'zone_995' => ''], - [ 'code' => '8', 'label' => '', 'zone_995' => ''], - [ 'code' => '9', 'label' => '', 'zone_995' => '' ], - [ 'code' => '10', 'label' => '', 'zone_995' => ''], - [ 'code' => '9', 'label' => '', 'zone_995' => ''], - [ 'code' => '10', 'label' => '', 'zone_995' => ''] - ], - 'champ_code_barres' => 'f', - 'champ_cote' => 'k', - 'champ_type_doc' => '', - 'champ_genre' => 'e', - 'champ_section' => 'q', - 'champ_emplacement' => 'u', - 'champ_annexe' => '' - ], - - [ 'champs' => ''], - [ 'champs' => ''], - [ 'champs' => ''], - [ 'champs' => '', 'xml_balise_abonne' => '', 'xml_champs_abonne' => [ 'IDABON' => '', - 'ORDREABON' => '', - 'NOM' => '', - 'PRENOM' => '', - 'NAISSANCE' => '', - 'PASSWORD' => '', - 'MAIL' => '', - 'DATE_DEBUT' => '', - 'DATE_FIN' => '', - 'ID_SIGB' => '' ] ], - [ 'zone' => '995', 'champ' => 's', 'format' => '3', 'jours' => '', 'valeurs' => 'nouveaute'] - ])]; - } - - - public function setUp() { - parent::setUp(); - $this->loadNotice('unimarc_bears_beer'); - } - - - /** @test */ - public function auteursShouldContainsBEAULIEUJIMMY() { - $this->assertEquals('BEAULIEU BOLI JIMMY JIMI APOSTOLIDES APOSTOLID JEAN JAN MARIE MARI BOSSE BOS SIMON BOUCHARD BOUCHAR GREGOIRE GREGOIR PIERRE PIER BROERSMA MATTHEW MATEW DELPORTE DELPORT JULIE JULI DOYON DOION RIVEST RIVES EKEBOM EKEBON TERHI TERI FORSYTHE FORSIT GENEST CATHERINE KATERIN GIARD JIAR LUC GIRARD JIRAR PASCAL PASKAL GOLDBERG GOLDBER ELEONORE ELEONOR HUBER UB MARKUS MARKU IRIS IRI JOLY JOLI BENOIT BENOI LEMAY LEMAI SYLVAIN SILVIN MUSTURI TOMMI TOMI NYLSO NILSO OBOM OBON PISHIER PICHI RICCI RIKSI STEFANO SAMSON JACQUES JAK DIECK DIEK MARTIN TOM TRAHAN TRAN SEBASTIEN SEBASTIN TURGEON TURJON DAVID DAVI VAYRYNEN VAIRINAN MIKKO MIKO VIAU VIO MICHEL WARD OIR BARNABY BARNABI WIGGERT OUIJER GREGOR ZVIANE ZVIAN', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['auteurs']); - } - - - /** @test */ - public function titlesContainsBEAR() { - $this->assertEquals('BEARS BEAR BEER BE FORMULE FORMUL 1', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['titres']); - } - - - /** @test */ - public function titleShouldBeBears() { - $this->assertEquals('Bears + beer : formule n°1', - $this->notice_integration->get_subfield('200', 'a')[0]); - } + public function getProfilDonnees() { + return + ['id_profil' => 106, + 'libelle' => 'Microbib', + 'accents' => '1', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '2', + 'type_fichier' => '0', + 'format' => '0', + 'attributs' => serialize( + [ [ + 'type_doc' => [ + [ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;as', 'zone_995' => 'az' ], + [ 'code' => '2', 'label' => '', 'zone_995' => ''], + [ 'code' => '3', 'label' => 'i;j;k', 'zone_995' => ''], + [ 'code' => '4', 'label' => 'g','zone_995' => ''], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => ''], + [ 'code' => '8', 'label' => '', 'zone_995' => ''], + [ 'code' => '9', 'label' => '', 'zone_995' => '' ], + [ 'code' => '10', 'label' => '', 'zone_995' => ''], + [ 'code' => '9', 'label' => '', 'zone_995' => ''], + [ 'code' => '10', 'label' => '', 'zone_995' => ''] + ], + 'champ_code_barres' => 'f', + 'champ_cote' => 'k', + 'champ_type_doc' => '', + 'champ_genre' => 'e', + 'champ_section' => 'q', + 'champ_emplacement' => 'u', + 'champ_annexe' => '' + ], + + [ 'champs' => ''], + [ 'champs' => ''], + [ 'champs' => ''], + [ 'champs' => '', 'xml_balise_abonne' => '', 'xml_champs_abonne' => [ 'IDABON' => '', + 'ORDREABON' => '', + 'NOM' => '', + 'PRENOM' => '', + 'NAISSANCE' => '', + 'PASSWORD' => '', + 'MAIL' => '', + 'DATE_DEBUT' => '', + 'DATE_FIN' => '', + 'ID_SIGB' => '' ] ], + [ 'zone' => '995', 'champ' => 's', 'format' => '3', 'jours' => '', 'valeurs' => 'nouveaute'] + ])]; + } + + + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_bears_beer'); + } + + + /** @test */ + public function auteursShouldContainsBEAULIEUJIMMY() { + $this->assertEquals('BEAULIEU BOLI JIMMY JIMI APOSTOLIDES APOSTOLID JEAN JAN MARIE MARI BOSSE BOS SIMON BOUCHARD BOUCHAR GREGOIRE GREGOIR PIERRE PIER BROERSMA MATTHEW MATEW DELPORTE DELPORT JULIE JULI DOYON DOION RIVEST RIVES EKEBOM EKEBON TERHI TERI FORSYTHE FORSIT GENEST CATHERINE KATERIN GIARD JIAR LUC GIRARD JIRAR PASCAL PASKAL GOLDBERG GOLDBER ELEONORE ELEONOR HUBER UB MARKUS MARKU IRIS IRI JOLY JOLI BENOIT BENOI LEMAY LEMAI SYLVAIN SILVIN MUSTURI TOMMI TOMI NYLSO NILSO OBOM OBON PISHIER PICHI RICCI RIKSI STEFANO SAMSON JACQUES JAK DIECK DIEK MARTIN TOM TRAHAN TRAN SEBASTIEN SEBASTIN TURGEON TURJON DAVID DAVI VAYRYNEN VAIRINAN MIKKO MIKO VIAU VIO MICHEL WARD OIR BARNABY BARNABI WIGGERT OUIJER GREGOR ZVIANE ZVIAN', + $this->notice_integration->noticeToDBEnreg($this->notice_data)['auteurs']); + } + + + /** @test */ + public function titlesContainsBEAR() { + $this->assertEquals('BEARS BEAR BEER BE FORMULE FORMUL 1', + $this->notice_integration->noticeToDBEnreg($this->notice_data)['titres']); + } + + + /** @test */ + public function titleShouldBeBears() { + $this->assertEquals('Bears + beer : formule n°1', + $this->notice_integration->get_subfield('200', 'a')[0]); + } } @@ -743,124 +730,124 @@ class NoticeIntegrationBearsBeerMicrobibTest extends NoticeIntegrationTestCase { class NoticeIntegrationItemsIn999Test extends NoticeIntegrationTestCase { - protected $_profil_donnees = - ['id_profil' => 111, - 'libelle' => 'Unimarc Dynix', - 'accents' => '1', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '2', - 'type_fichier' => '0', - 'format' => '6', - 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:22:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:11:"am;na;ac;ad";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:8:"as;aa;ab";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:1:"j";s:8:"zone_995";s:2:"CD";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:3:"DVD";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:1:"c";s:8:"zone_995";s:3:"PAR";}i:7;a:3:{s:4:"code";s:1:"7";s:5:"label";s:2:"em";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:2:"15";s:5:"label";s:1:"i";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:19;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:20;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:21;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:3:"999";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:1:"x";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"z";s:17:"champ_emplacement";s:1:"l";s:12:"champ_annexe";s:1:"m";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"996";s:5:"champ";s:1:"u";s:6:"format";s:1:"4";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}']; - - public function setUp() { - parent::setUp(); - - $this->fixture('Class_CodifSection', - ['id' => 2, - 'libelle' => 'enfants', - 'regles' => '996$z=ENF']); - - - $this->fixture('Class_CodifEmplacement', - ['id' => 54, - 'libelle' => 'enfants', - 'regles' => '996$l=07MJENF']); - - - $this->loadNotice('unimarc_items_in_996'); - } - - - /** - * @return format [expected, item index, item field] - */ - public function itemsProvider() { - return [ - ['00519824', 0, 'code_barres'], - ['EM A MUS J', 0, 'cote'], - [2, 0, 'section'], - ['CRETBUS', 0, 'annexe'], - [54, 0, 'emplacement'], - ['2010-02-23', 0, 'date_nouveaute'], - [false, 0, 'ignore_exemplaire'], - [true, 3, 'ignore_exemplaire'], - ]; - } - - - /** @test */ - public function noticeShouldHave5Items() { - $this->assertEquals(5, count($this->notice_data['exemplaires'])); - } - - - /** - * @test - * @dataProvider itemsProvider - */ - public function itemsPropertyShouldBeAsExpected($expected, $index, $property) { - $this->assertEquals($expected, $this->notice_data['exemplaires'][$index][$property]); - } + protected $_profil_donnees = + ['id_profil' => 111, + 'libelle' => 'Unimarc Dynix', + 'accents' => '1', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '2', + 'type_fichier' => '0', + 'format' => '6', + 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:22:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:11:"am;na;ac;ad";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:8:"as;aa;ab";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:1:"j";s:8:"zone_995";s:2:"CD";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:3:"DVD";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:1:"c";s:8:"zone_995";s:3:"PAR";}i:7;a:3:{s:4:"code";s:1:"7";s:5:"label";s:2:"em";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:2:"15";s:5:"label";s:1:"i";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:19;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:20;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:21;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:3:"999";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:1:"x";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"z";s:17:"champ_emplacement";s:1:"l";s:12:"champ_annexe";s:1:"m";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"996";s:5:"champ";s:1:"u";s:6:"format";s:1:"4";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}']; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CodifSection', + ['id' => 2, + 'libelle' => 'enfants', + 'regles' => '996$z=ENF']); + + + $this->fixture('Class_CodifEmplacement', + ['id' => 54, + 'libelle' => 'enfants', + 'regles' => '996$l=07MJENF']); + + + $this->loadNotice('unimarc_items_in_996'); + } + + + /** + * @return format [expected, item index, item field] + */ + public function itemsProvider() { + return [ + ['00519824', 0, 'code_barres'], + ['EM A MUS J', 0, 'cote'], + [2, 0, 'section'], + ['CRETBUS', 0, 'annexe'], + [54, 0, 'emplacement'], + ['2010-02-23', 0, 'date_nouveaute'], + [false, 0, 'ignore_exemplaire'], + [true, 3, 'ignore_exemplaire'], + ]; + } + + + /** @test */ + public function noticeShouldHave5Items() { + $this->assertEquals(5, count($this->notice_data['exemplaires'])); + } + + + /** + * @test + * @dataProvider itemsProvider + */ + public function itemsPropertyShouldBeAsExpected($expected, $index, $property) { + $this->assertEquals($expected, $this->notice_data['exemplaires'][$index][$property]); + } } class NoticeIntegrationItemsIn852Test extends NoticeIntegrationTestCase { - protected $_profil_donnees = - ['id_profil' => 111, - 'libelle' => 'Unimarc Moulins', - 'accents' => '1', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '2', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:19:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:6:"PATEST";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:16:"am;bm;cm;em;gm;m";s:8:"zone_995";s:59:"BDA;BDJ;LFA;LFJ;LDA;LDJ;LCDA;LCDJ;PATIMP;PATMS;PERIP;PATINC";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:14:"PEA;PEJ;PATPER";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:5:"jm;im";s:8:"zone_995";s:21:"CDMA;CDMJ;CDTLA;CDTLJ";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:2:"mm";s:8:"zone_995";s:43:"DVF00;DVF12;DVF16;DVF18;DVDOCA;DVDOCJ;DVDOC";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:2:"lm";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:5:"cm;dm";s:8:"zone_995";s:10:"PAR;PATPAR";}i:7;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:3:"852";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:0:"";s:17:"champ_emplacement";s:0:"";s:12:"champ_annexe";s:0:"";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"852";s:5:"champ";s:1:"d";s:6:"format";s:1:"5";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}']; - - public function setUp() { - parent::setUp(); - - $this->fixture('Class_CodifSection', - ['id' => 2, - 'invisible' => 0, - 'regles' => '852$q=AVJE']); - - - $this->fixture('Class_CodifSection', - ['id' => 3, - 'invisible' => 1, - 'regles' => '852$q=MOJE']); - - $this->loadNotice('unimarc_items_in_852'); - } - - - /** - * @return format [expected, item index, item field] - */ - public function itemsProvider() { - return [['0024100013', 0, 'code_barres'], - ['JBD HER 16', 0, 'cote'], - [2, 0, 'section'], - ['AVER', 0, 'annexe'], - [false, 0, 'ignore_exemplaire'], - ['2005-08-15', 0, 'date_nouveaute']]; - } - - - /** @test */ - public function noticeShouldHave2Items() { - $this->assertEquals(2, count($this->notice_data['exemplaires'])); - } - - - /** - * @test - * @dataProvider itemsProvider - */ - public function itemsPropertyShouldBeAsExpected($expected, $index, $property) { - $this->assertEquals($expected, $this->notice_data['exemplaires'][$index][$property]); - } + protected $_profil_donnees = + ['id_profil' => 111, + 'libelle' => 'Unimarc Moulins', + 'accents' => '1', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '2', + 'type_fichier' => '0', + 'format' => '0', + 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:19:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:6:"PATEST";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:16:"am;bm;cm;em;gm;m";s:8:"zone_995";s:59:"BDA;BDJ;LFA;LFJ;LDA;LDJ;LCDA;LCDJ;PATIMP;PATMS;PERIP;PATINC";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:14:"PEA;PEJ;PATPER";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:5:"jm;im";s:8:"zone_995";s:21:"CDMA;CDMJ;CDTLA;CDTLJ";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:2:"mm";s:8:"zone_995";s:43:"DVF00;DVF12;DVF16;DVF18;DVDOCA;DVDOCJ;DVDOC";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:2:"lm";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:5:"cm;dm";s:8:"zone_995";s:10:"PAR;PATPAR";}i:7;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:3:"852";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:0:"";s:17:"champ_emplacement";s:0:"";s:12:"champ_annexe";s:0:"";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"852";s:5:"champ";s:1:"d";s:6:"format";s:1:"5";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}']; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CodifSection', + ['id' => 2, + 'invisible' => 0, + 'regles' => '852$q=AVJE']); + + + $this->fixture('Class_CodifSection', + ['id' => 3, + 'invisible' => 1, + 'regles' => '852$q=MOJE']); + + $this->loadNotice('unimarc_items_in_852'); + } + + + /** + * @return format [expected, item index, item field] + */ + public function itemsProvider() { + return [['0024100013', 0, 'code_barres'], + ['JBD HER 16', 0, 'cote'], + [2, 0, 'section'], + ['AVER', 0, 'annexe'], + [false, 0, 'ignore_exemplaire'], + ['2005-08-15', 0, 'date_nouveaute']]; + } + + + /** @test */ + public function noticeShouldHave2Items() { + $this->assertEquals(2, count($this->notice_data['exemplaires'])); + } + + + /** + * @test + * @dataProvider itemsProvider + */ + public function itemsPropertyShouldBeAsExpected($expected, $index, $property) { + $this->assertEquals($expected, $this->notice_data['exemplaires'][$index][$property]); + } } @@ -870,294 +857,294 @@ class NoticeIntegrationItemsIn852Test extends NoticeIntegrationTestCase { * @see http://forge.afi-sa.fr/issues/14869 */ class NoticeIntegrationPergameEmplacementZeroTest extends NoticeIntegrationTestCase { - protected $_profil_donnees = [ - 'id_profil' => 100, - 'libelle' => 'Unimarc Pergame', - 'accents' => 2, - 'rejet_periodiques' => 0, - 'id_article_periodique' => 1, - 'type_fichier' => 0, - 'format' => 0, - 'attributs' => 'a:6:{i:0;a:6:{s:8:"type_doc";a:11:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:2:"am";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:2:"je";s:8:"zone_995";s:0:"";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:2:"gd";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:2:"le";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"6";s:12:"champ_annexe";s:1:"8";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"4";s:6:"format";s:1:"1";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:5;a:2:{s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:10:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";}}}' - ]; + protected $_profil_donnees = [ + 'id_profil' => 100, + 'libelle' => 'Unimarc Pergame', + 'accents' => 2, + 'rejet_periodiques' => 0, + 'id_article_periodique' => 1, + 'type_fichier' => 0, + 'format' => 0, + 'attributs' => 'a:6:{i:0;a:6:{s:8:"type_doc";a:11:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:2:"am";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:2:"je";s:8:"zone_995";s:0:"";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:2:"gd";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:2:"le";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"6";s:12:"champ_annexe";s:1:"8";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"4";s:6:"format";s:1:"1";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:5;a:2:{s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:10:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";}}}' + ]; - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->fixture('Class_CodifSection', - ['id' => 1, - 'libelle' => 'adulte', - 'regles' => '995$q=A']); + $this->fixture('Class_CodifSection', + ['id' => 1, + 'libelle' => 'adulte', + 'regles' => '995$q=A']); - $this->fixture('Class_CodifEmplacement', - ['id' => 3, - 'libelle' => 'enfants', - 'regles' => '995$6=0']); + $this->fixture('Class_CodifEmplacement', + ['id' => 3, + 'libelle' => 'enfants', + 'regles' => '995$6=0']); - $this->loadNotice('unimarc_emplacement_codif_zero'); - $this->exemplaire = Class_Exemplaire::findFirstBy([]); - } + $this->loadNotice('unimarc_emplacement_codif_zero'); + $this->exemplaire = Class_Exemplaire::findFirstBy([]); + } - /** @test */ - public function shouldHaveOneItem() { - $this->assertEquals(1, count(Class_Exemplaire::findAll())); - } + /** @test */ + public function shouldHaveOneItem() { + $this->assertEquals(1, count(Class_Exemplaire::findAll())); + } - /** @test */ - public function exemplaireEmplacementShouldBeThree() { - $this->assertEquals(3, $this->exemplaire->getEmplacement()); - } + /** @test */ + public function exemplaireEmplacementShouldBeThree() { + $this->assertEquals(3, $this->exemplaire->getEmplacement()); + } - /** @test */ - public function exemplaireBarcodeShouldBeL01528() { - $this->assertEquals('L-01528', $this->exemplaire->getCodeBarres()); - } + /** @test */ + public function exemplaireBarcodeShouldBeL01528() { + $this->assertEquals('L-01528', $this->exemplaire->getCodeBarres()); + } - /** @test */ - public function exemplaireCodeShouldBeOk() { - $this->assertEquals('R BOI B', $this->exemplaire->getCote()); - } + /** @test */ + public function exemplaireCodeShouldBeOk() { + $this->assertEquals('R BOI B', $this->exemplaire->getCote()); + } - /** @test */ - public function exemplaireSectionShouldBeOne() { - $this->assertEquals(1, $this->exemplaire->getSection()); - } + /** @test */ + public function exemplaireSectionShouldBeOne() { + $this->assertEquals(1, $this->exemplaire->getSection()); + } - /** @test */ - public function exemplaireZone995ShouldContaineDollarSixEqualsZero() { - foreach(unserialize($this->exemplaire->getZone995()) as $field) { - if ('6' == $field['code']) { - $this->assertEquals('0', $field['valeur']); - return; - } - } - $this->fail('No 995$6 found'); - } + /** @test */ + public function exemplaireZone995ShouldContaineDollarSixEqualsZero() { + foreach(unserialize($this->exemplaire->getZone995()) as $field) { + if ('6' == $field['code']) { + $this->assertEquals('0', $field['valeur']); + return; + } + } + $this->fail('No 995$6 found'); + } } class NoticeIntegrationDossier64Test extends NoticeIntegrationTestCase { - protected $_profil_donnees = [ - 'id_profil' => 100, - 'libelle' => 'Unimarc Pergame', - 'accents' => 1, - 'rejet_periodiques' => 1, - 'id_article_periodique' => 0, - 'type_fichier' => 0, - 'format' => 0, - 'attributs' => 'a:4:{i:0;a:6:{s:8:"type_doc";a:11:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:2:"am";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:2:"je";s:8:"zone_995";s:0:"";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:2:"gd";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:2:"le";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"6";s:12:"champ_annexe";s:1:"8";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}}' - ]; - - - public function setUp() { - parent::setUp(); - $this->loadNotice('unimarc_dossier64'); - $this->datas = $this->notice_integration->noticeToDBEnreg($this->notice_data); - $this->notice_sgbd->ouvrirNotice($this->datas['unimarc'], 0); - } - - /** @test */ - public function priceShouldBeTwentyTwoEuros() { - $this->assertEquals('22.90 €', $this->notice_sgbd->get_subfield('010', 'd')[0]); - } - - /** @test */ - public function titleShouldBeDossier64() { - $this->assertContains('DOSSIER', $this->datas['titres']); - } - - /** @test */ - public function zone200aShouldBeDossier64() { - $this->assertEquals('Dossier 64', $this->notice_sgbd->get_subfield('200', 'a')[0]); - } + protected $_profil_donnees = [ + 'id_profil' => 100, + 'libelle' => 'Unimarc Pergame', + 'accents' => 1, + 'rejet_periodiques' => 1, + 'id_article_periodique' => 0, + 'type_fichier' => 0, + 'format' => 0, + 'attributs' => 'a:4:{i:0;a:6:{s:8:"type_doc";a:11:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:2:"am";s:8:"zone_995";s:0:"";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:0:"";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:2:"je";s:8:"zone_995";s:0:"";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:2:"gd";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:2:"le";s:8:"zone_995";s:0:"";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"6";s:12:"champ_annexe";s:1:"8";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}}' + ]; + + + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_dossier64'); + $this->datas = $this->notice_integration->noticeToDBEnreg($this->notice_data); + $this->notice_sgbd->ouvrirNotice($this->datas['unimarc'], 0); + } + + /** @test */ + public function priceShouldBeTwentyTwoEuros() { + $this->assertEquals('22.90 €', $this->notice_sgbd->get_subfield('010', 'd')[0]); + } + + /** @test */ + public function titleShouldBeDossier64() { + $this->assertContains('DOSSIER', $this->datas['titres']); + } + + /** @test */ + public function zone200aShouldBeDossier64() { + $this->assertEquals('Dossier 64', $this->notice_sgbd->get_subfield('200', 'a')[0]); + } } class NoticeIntegrationGenreMultiple902Test extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - - $this->fixture('Class_CodifGenre', - ['id' => 81, - 'libelle' => 'Genre1', - 'regles' => '902$a=Genre1']); - - $this->fixture('Class_CodifGenre', - ['id' => 82, - 'libelle' => 'Genre2', - 'regles' => '902$a=Genre2']); - - $this->fixture('Class_CodifGenre', - ['id' => 83, - 'libelle' => 'Genre3', - 'regles' => '902$a=Genre3']); - - $this->loadNotice('test-genre-multiple-902'); - } - - - /** @test */ - public function noticeShouldHaveThreeGenres() { - $this->assertInternalType('array', $this->notice_data['genres']); - $this->assertCount(3, $this->notice_data['genres']); - $this->assertContains(81, $this->notice_data['genres']); - $this->assertContains(82, $this->notice_data['genres']); - $this->assertContains(83, $this->notice_data['genres']); - } - - /** @test */ - public function facettesShouldContainThreeGenres() { - $this->assertContains(' G81', $this->notice_data['facettes']); - $this->assertContains(' G82', $this->notice_data['facettes']); - $this->assertContains(' G83', $this->notice_data['facettes']); - } + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CodifGenre', + ['id' => 81, + 'libelle' => 'Genre1', + 'regles' => '902$a=Genre1']); + + $this->fixture('Class_CodifGenre', + ['id' => 82, + 'libelle' => 'Genre2', + 'regles' => '902$a=Genre2']); + + $this->fixture('Class_CodifGenre', + ['id' => 83, + 'libelle' => 'Genre3', + 'regles' => '902$a=Genre3']); + + $this->loadNotice('test-genre-multiple-902'); + } + + + /** @test */ + public function noticeShouldHaveThreeGenres() { + $this->assertInternalType('array', $this->notice_data['genres']); + $this->assertCount(3, $this->notice_data['genres']); + $this->assertContains(81, $this->notice_data['genres']); + $this->assertContains(82, $this->notice_data['genres']); + $this->assertContains(83, $this->notice_data['genres']); + } + + /** @test */ + public function facettesShouldContainThreeGenres() { + $this->assertContains(' G81', $this->notice_data['facettes']); + $this->assertContains(' G82', $this->notice_data['facettes']); + $this->assertContains(' G83', $this->notice_data['facettes']); + } } class NoticeIntegrationUpdateExistingNoticeTest extends NoticeIntegrationTestCase { - protected $_profil_donnees = [ - 'id_profil' => 100, - 'libelle' => 'Unimarc Orphee', - 'accents' => 1, - 'rejet_periodiques' => 0, - 'id_article_periodique' => 4, - 'type_fichier' => 0, - 'format' => 0, - 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:18:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:8:"am;na;mn";s:8:"zone_995";s:9:"LIV;MS;uu";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:3:"PER";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:17:"CD;LIVCD;LIVK7;K7";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:20:"DIAPO;DVD;VHS;VHD;VD";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:6:"l;m;mm";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:9;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"a";s:10:"champ_cote";s:1:"f";s:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:1:"#";s:13:"champ_section";s:1:"w";s:17:"champ_emplacement";s:1:"x";s:12:"champ_annexe";s:1:"h";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"5";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"1";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}' - ]; - - - public function setUp() { - parent::setUp(); - $this->loadNotice('unimarc_chaperon_rouge'); - $this->datas = $this->notice_integration->noticeToDBEnreg($this->notice_data); - $this->notice_sgbd->ouvrirNotice($this->datas['unimarc'], 0); - } - - - - /** @test */ - public function auteurShouldBeChristianGuibbaud() { - $this->assertContains('Guibbaud|Christian', $this->notice_data['auteurs'][0]); - } - - /** @test */ - public function zone700aShouldBeGuibbaud() { - $this->assertEquals('Guibbaud', $this->notice_sgbd->get_subfield('700', 'a')[0]); - } + protected $_profil_donnees = [ + 'id_profil' => 100, + 'libelle' => 'Unimarc Orphee', + 'accents' => 1, + 'rejet_periodiques' => 0, + 'id_article_periodique' => 4, + 'type_fichier' => 0, + 'format' => 0, + 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:18:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:8:"am;na;mn";s:8:"zone_995";s:9:"LIV;MS;uu";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:3:"PER";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:17:"CD;LIVCD;LIVK7;K7";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:20:"DIAPO;DVD;VHS;VHD;VD";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:6:"l;m;mm";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:7;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:8;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:9;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"a";s:10:"champ_cote";s:1:"f";s:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:1:"#";s:13:"champ_section";s:1:"w";s:17:"champ_emplacement";s:1:"x";s:12:"champ_annexe";s:1:"h";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"5";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"1";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}' + ]; + + + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_chaperon_rouge'); + $this->datas = $this->notice_integration->noticeToDBEnreg($this->notice_data); + $this->notice_sgbd->ouvrirNotice($this->datas['unimarc'], 0); + } + + + + /** @test */ + public function auteurShouldBeChristianGuibbaud() { + $this->assertContains('Guibbaud|Christian', $this->notice_data['auteurs'][0]); + } + + /** @test */ + public function zone700aShouldBeGuibbaud() { + $this->assertEquals('Guibbaud', $this->notice_sgbd->get_subfield('700', 'a')[0]); + } } class NoticeIntegrationMachecoulTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - $this->loadNotice('unimarc_ledu_stephanie'); - $this->datas = $this->notice_integration->noticeToDBEnreg($this->notice_data); - $this->notice_sgbd->ouvrirNotice($this->datas['unimarc'], 0); - } + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_ledu_stephanie'); + $this->datas = $this->notice_integration->noticeToDBEnreg($this->notice_data); + $this->notice_sgbd->ouvrirNotice($this->datas['unimarc'], 0); + } - /** @test */ - public function auteurShoulBeLeduStephanie() { - $this->assertContains('Ledu|Stéphanie', $this->notice_data['auteurs'][0]); - } + /** @test */ + public function auteurShoulBeLeduStephanie() { + $this->assertContains('Ledu|Stéphanie', $this->notice_data['auteurs'][0]); + } - /** @test */ - public function facetteShouldContainsA12() { - $this->assertContains('A1', $this->notice_data['facettes']); - } + /** @test */ + public function facetteShouldContainsA12() { + $this->assertContains('A1', $this->notice_data['facettes']); + } - /** @test */ - public function authorStephanieLeduShouldHaveBeenCreated() { - $this->assertEquals('Stéphanie Ledu', - Class_CodifAuteur::findFirstBy(['formes' => 'LEDUxSTEPHANIE']) - ->getLibelle()); - } + /** @test */ + public function authorStephanieLeduShouldHaveBeenCreated() { + $this->assertEquals('Stéphanie Ledu', + Class_CodifAuteur::findFirstBy(['formes' => 'LEDUxSTEPHANIE']) + ->getLibelle()); + } } /** @see http://forge.afi-sa.fr/issues/15762 */ class NoticeIntegrationConcertoSaintSaensTest extends NoticeIntegrationTestCase { - public function getProfilDonnees() { - $profil = Class_IntProfilDonnees::forDynix()->setIdProfil(108); - return $profil->getRawAttributes(); - } - - - public function setUp() { - parent::setUp(); - $this->fixture('Class_Notice', - ['id' => 239003, - 'type_doc' => 3, - 'alpha_titre' => 'CONCERTO POUR VIOLONCELLE N 1 OP 33 LA MINEUR', - 'alpha_auteur' => 'SAINT SAENS CAMILLE', - 'titres' => 'CONCERTO KONSERTO POUR VIOLONCELLE VIOLONSEL 1 33 MINEUR MINER SONATE SONAT PIANO 32 UT ROMANCE ROMANS 36 SERENADE SERENAD SUITE SUIT 16 CARNAVAL KARNAVAL ANIMAUX ANIMO GRANDE GRAND FANTASIE FANTASI ZOOLOGIQUE ZOULOJIK', - 'auteurs' => 'SAINT SIN SAENS SAN CAMILLE KAMIL DEMARQUETTE DEMARKET HENRI ANRI BEREZOVSKY BEREZOVSKI BORIS BORI ENGERER ANJER BRIGITTE BRIJIT SWENSEN SWENSAN JOSEPH JOS ENSEMBLE ANSANBL ORCHESTRAL ORKESTRAL PARIS PARI', - 'editeur' => 'Mirare,', - 'collection' => '', - 'matieres' => 'MUSIQUE MUSIK INSTRUMENTALE INSTRUMANTAL FRANCE FRANS 19EME EM SIECLE SIEKL CONTES KONT MUSICAUX MUSIKO CONCERTOS KONSERTO VIOLONCELLE VIOLONSEL', - 'dewey' => '', - 'facettes' => 'A16708 A27427 A29866 A70213 A45981 A57131 M44307 M26694 M1319 T3 B2 YLB 2000-01', - 'code' => '3 SAI 19.43', - 'isbn' => '', - 'ean' => '', - 'id_commerciale' => 'MIRAREMIR108CONCERTOPOURVIOLONCE', - 'id_bnf' => '', - 'clef_alpha' => 'CONCERTOPOURVIOLONCELLEN1OP33LAMINEUR--SAINTSAENSCAMILLE--MIRARE-2010-3', - 'clef_oeuvre' => 'CONCERTOPOURVIOLONCELLEN1OP33LAMINEUR--SAINTSAENSCAMILLE-', - 'clef_chapeau' => '', - 'tome_alpha' => '', - 'annee' => 2010, - 'qualite' => 5, - 'exportable' => 1, - 'date_creation' => '2000-01-01 00:00:00', - 'date_maj' => '2014-09-16 12:25:58', - 'unimarc' => '02580njm0 22003131i 450 001000700000005004100007071002100048200008900069210002600158215002100184330071300205464027100918464007501189464011601264464012301380464010901503464012401612464011601736606005001852606002001902606002801922700003901950702005001989702004302039702004302082702002002125711003302145996008802178419536140812s2010 | | |||||d01aMIR108 ;bMirare01aConcerto pour violoncelle N°1, op. 33, la mineurb[enr. CD] /fCamille Saint-Saëns01aS.l. :cMirare,d201001a1 disque compact01aPour ce disque-concept autour des oeuvres pour violoncelle de Camille Saint-Saëns, Henri Demarquette s\'est entouré de ses amis et partenaires de prédilection Brigitte Engerer et Boris Berezovsky (piano), ainsi que l\'Ensemble Orchestral de Paris et ses solistes, sous la houlette de Joseph Swensen, pour présenter un disque original. Au côté de certaines oeuvres très connues, comme le facétieux Carnaval des animaux, et le Concerto pour violoncelle et orchestre n', - 'z3950_retry' => 0, - 'nb_visu' => 0, - 'nb_resa' => 0, - 'url_vignette' => '', - 'url_image' => '']); - - - $this->fixture('Class_IntBib', - ['id' => 1, - 'qualite' => 5]); - - $this->loadNotice('unimarc_concerto_saintsaens'); - } - - - /** @test */ - public function notesShouldNotContainsRawAsciiDegree() { - $this->assertNotContains('n' . chr(0xb0), - Class_Notice::find(239003)->get_subfield(330, 'a')[0]); - } - - - /** @test */ - public function notesShouldContainsValidUtf8Degree() { - $this->assertContains('n' . chr(0xc2).chr(0xb0), - Class_Notice::find(239003)->get_subfield(330, 'a')[0]); - } + public function getProfilDonnees() { + $profil = Class_IntProfilDonnees::forDynix()->setIdProfil(108); + return $profil->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + $this->fixture('Class_Notice', + ['id' => 239003, + 'type_doc' => 3, + 'alpha_titre' => 'CONCERTO POUR VIOLONCELLE N 1 OP 33 LA MINEUR', + 'alpha_auteur' => 'SAINT SAENS CAMILLE', + 'titres' => 'CONCERTO KONSERTO POUR VIOLONCELLE VIOLONSEL 1 33 MINEUR MINER SONATE SONAT PIANO 32 UT ROMANCE ROMANS 36 SERENADE SERENAD SUITE SUIT 16 CARNAVAL KARNAVAL ANIMAUX ANIMO GRANDE GRAND FANTASIE FANTASI ZOOLOGIQUE ZOULOJIK', + 'auteurs' => 'SAINT SIN SAENS SAN CAMILLE KAMIL DEMARQUETTE DEMARKET HENRI ANRI BEREZOVSKY BEREZOVSKI BORIS BORI ENGERER ANJER BRIGITTE BRIJIT SWENSEN SWENSAN JOSEPH JOS ENSEMBLE ANSANBL ORCHESTRAL ORKESTRAL PARIS PARI', + 'editeur' => 'Mirare,', + 'collection' => '', + 'matieres' => 'MUSIQUE MUSIK INSTRUMENTALE INSTRUMANTAL FRANCE FRANS 19EME EM SIECLE SIEKL CONTES KONT MUSICAUX MUSIKO CONCERTOS KONSERTO VIOLONCELLE VIOLONSEL', + 'dewey' => '', + 'facettes' => 'A16708 A27427 A29866 A70213 A45981 A57131 M44307 M26694 M1319 T3 B2 YLB 2000-01', + 'code' => '3 SAI 19.43', + 'isbn' => '', + 'ean' => '', + 'id_commerciale' => 'MIRAREMIR108CONCERTOPOURVIOLONCE', + 'id_bnf' => '', + 'clef_alpha' => 'CONCERTOPOURVIOLONCELLEN1OP33LAMINEUR--SAINTSAENSCAMILLE--MIRARE-2010-3', + 'clef_oeuvre' => 'CONCERTOPOURVIOLONCELLEN1OP33LAMINEUR--SAINTSAENSCAMILLE-', + 'clef_chapeau' => '', + 'tome_alpha' => '', + 'annee' => 2010, + 'qualite' => 5, + 'exportable' => 1, + 'date_creation' => '2000-01-01 00:00:00', + 'date_maj' => '2014-09-16 12:25:58', + 'unimarc' => '02580njm0 22003131i 450 001000700000005004100007071002100048200008900069210002600158215002100184330071300205464027100918464007501189464011601264464012301380464010901503464012401612464011601736606005001852606002001902606002801922700003901950702005001989702004302039702004302082702002002125711003302145996008802178419536140812s2010 | | |||||d01aMIR108 ;bMirare01aConcerto pour violoncelle N°1, op. 33, la mineurb[enr. CD] /fCamille Saint-Saëns01aS.l. :cMirare,d201001a1 disque compact01aPour ce disque-concept autour des oeuvres pour violoncelle de Camille Saint-Saëns, Henri Demarquette s\'est entouré de ses amis et partenaires de prédilection Brigitte Engerer et Boris Berezovsky (piano), ainsi que l\'Ensemble Orchestral de Paris et ses solistes, sous la houlette de Joseph Swensen, pour présenter un disque original. Au côté de certaines oeuvres très connues, comme le facétieux Carnaval des animaux, et le Concerto pour violoncelle et orchestre n', + 'z3950_retry' => 0, + 'nb_visu' => 0, + 'nb_resa' => 0, + 'url_vignette' => '', + 'url_image' => '']); + + + $this->fixture('Class_IntBib', + ['id' => 1, + 'qualite' => 5]); + + $this->loadNotice('unimarc_concerto_saintsaens'); + } + + + /** @test */ + public function notesShouldNotContainsRawAsciiDegree() { + $this->assertNotContains('n' . chr(0xb0), + Class_Notice::find(239003)->get_subfield(330, 'a')[0]); + } + + + /** @test */ + public function notesShouldContainsValidUtf8Degree() { + $this->assertContains('n' . chr(0xc2).chr(0xb0), + Class_Notice::find(239003)->get_subfield(330, 'a')[0]); + } } @@ -1168,144 +1155,144 @@ class NoticeIntegrationArchivesAlsaceTest extends NoticeIntegrationTestCase { public function getProfilDonnees() { - return Class_IntProfilDonnees::forKarvi() - ->setIdProfil(110) - ->getRawAttributes(); - } + return Class_IntProfilDonnees::forKarvi() + ->setIdProfil(110) + ->getRawAttributes(); + } - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); $this->fixture('Class_CodifLangue', ['id' => 'fre', 'libelle' => 'Français']); - $this->fixture('Class_CodifMatiere', + $this->fixture('Class_CodifMatiere', ['id' => 1, 'libelle' => 'Alsace (France) : Descriptions Et Voyages : Vues : 1870-1914', 'code_alpha' => 'ALSACE FRANCE DESCRIPTIONS ET VOYAGES VUES 1870 1914', ]); - $this->fixture('Class_CodifDewey', - ['id' => 94438, - 'libelle' => 'Lorraine et Alsace']); + $this->fixture('Class_CodifDewey', + ['id' => 94438, + 'libelle' => 'Lorraine et Alsace']); Class_CodifAuteur::beVolatile(); - Class_CosmoVar::newInstanceWithId('unimarc_zone_matiere', - ['valeur' => '600abcjxyz;601abcx;602ajxyz;605a;606ajxyz;607ajxyz;608ajxyz;610aejxyz;615amnx;616acfjxy;620abcdefghi']); + Class_CosmoVar::newInstanceWithId('unimarc_zone_matiere', + ['valeur' => '600abcjxyz;601abcx;602ajxyz;605a;606ajxyz;607ajxyz;608ajxyz;610aejxyz;615amnx;616acfjxy;620abcdefghi']); - $this->loadNotice('unimarc_archives_alsace'); - } + $this->loadNotice('unimarc_archives_alsace'); + } - /** @test */ - public function matieresShouldAlsaceDescriptions() { - $this->assertEquals('ALSACE ALSAS FRANCE FRANS DESCRIPTIONS DESKRIPSION VOYAGES VOIAJ VUES VU 1870 1914 OUVRAGES OUVRAJ ILLUSTRES ILUSTR 1871 1918 PERIODE PERIOD ALLEMANDE ALEMAND', - Class_Notice::find(1)->getMatieres()); - } + /** @test */ + public function matieresShouldAlsaceDescriptions() { + $this->assertEquals('ALSACE ALSAS FRANCE FRANS DESCRIPTIONS DESKRIPSION VOYAGES VOIAJ VUES VU 1870 1914 OUVRAGES OUVRAJ ILLUSTRES ILUSTR 1871 1918 PERIODE PERIOD ALLEMANDE ALEMAND', + Class_Notice::find(1)->getMatieres()); + } - /** @test */ - public function deweyShouldBeLorraineAlsace() { - $this->assertEquals('LORRAINE LORAIN ALSACE ALSAS', - Class_Notice::find(1)->getDewey()); - } + /** @test */ + public function deweyShouldBeLorraineAlsace() { + $this->assertEquals('LORRAINE LORAIN ALSACE ALSAS', + Class_Notice::find(1)->getDewey()); + } - /** @test */ - public function codifMatiereOneShouldContainsAlsace() { - $this->assertEquals('Alsace (France) : Descriptions et voyages : Vues : 1870-1914', - Class_CodifMatiere::find(1)->getLibelle()); - } + /** @test */ + public function codifMatiereOneShouldContainsAlsace() { + $this->assertEquals('Alsace (France) : Descriptions et voyages : Vues : 1870-1914', + Class_CodifMatiere::find(1)->getLibelle()); + } - /** @test */ - public function codifMatiereTwoShouldContainsOuvragesIllustres() { - $this->assertEquals('Alsace (France) : Ouvrages illustrés : 1871-1918 (Période allemande)', - Class_CodifMatiere::find(2)->getLibelle()); - } + /** @test */ + public function codifMatiereTwoShouldContainsOuvragesIllustres() { + $this->assertEquals('Alsace (France) : Ouvrages illustrés : 1871-1918 (Période allemande)', + Class_CodifMatiere::find(2)->getLibelle()); + } - /** @test */ - public function facettesShouldContainsM1AndM2AndD1() { - $this->assertEquals('T1 D94438 A1 M1 M2 Lfre', - Class_Notice::find(1)->getFacettes()); - } + /** @test */ + public function facettesShouldContainsM1AndM2AndD1() { + $this->assertEquals('T1 D94438 A1 M1 M2 Lfre', + Class_Notice::find(1)->getFacettes()); + } - /** @test */ - public function facettesWithExemplairesShouldContainsM1AndM2AndD1() { - $this->assertEquals('D94438 A1 M1 M2 Lfre T1 B1 YBibliothèque des Dominicains', - Class_Notice::find(1)->updateFacetsFromExemplaires()->getFacettes()); - } + /** @test */ + public function facettesWithExemplairesShouldContainsM1AndM2AndD1() { + $this->assertEquals('D94438 A1 M1 M2 Lfre T1 B1 YBibliothèque des Dominicains', + Class_Notice::find(1)->updateFacetsFromExemplaires()->getFacettes()); + } } /** @see http://forge.afi-sa.fr/issues/15989 */ class NoticeIntegrationMarioCartWiiTest extends NoticeIntegrationTestCase { - public function getProfilDonnees() { - $profil = Class_IntProfilDonnees::forAstrolab()->setIdProfil(110); - return $profil->getRawAttributes(); - } + public function getProfilDonnees() { + $profil = Class_IntProfilDonnees::forAstrolab()->setIdProfil(110); + return $profil->getRawAttributes(); + } - public function setUp() { - parent::setUp(); - $this->fixture('Class_CodifEmplacement', - ['id' => 3, 'libelle' => 'Art', 'regles' => '995$u=ART']); - $this->fixture('Class_CodifEmplacement', - ['id' => 8, 'libelle' => 'Enfance', 'regles' => '995$u=ENF']); - $this->fixture('Class_CodifEmplacement', - ['id' => 9, 'libelle' => 'Espace bébés', 'regles' => '995$u=43;Espace bébés']); + public function setUp() { + parent::setUp(); + $this->fixture('Class_CodifEmplacement', + ['id' => 3, 'libelle' => 'Art', 'regles' => '995$u=ART']); + $this->fixture('Class_CodifEmplacement', + ['id' => 8, 'libelle' => 'Enfance', 'regles' => '995$u=ENF']); + $this->fixture('Class_CodifEmplacement', + ['id' => 9, 'libelle' => 'Espace bébés', 'regles' => '995$u=43;Espace bébés']); - $writer = new Class_NoticeUnimarc_Writer(); + $writer = new Class_NoticeUnimarc_Writer(); $writer->setNotice(file_get_contents(dirname(__FILE__)."/unimarc_mario_kart.txt")); $writer->add_field('995', ' ', [ ['f', '12345'], - ['r', 'JV'], + ['r', 'JV'], ['u', 'Espace bébés'], - ['a', 'MED'], - ['q', 'BEB'], - ['k', 'JV WII MAR B'] + ['a', 'MED'], + ['q', 'BEB'], + ['k', 'JV WII MAR B'] ]); - $writer->update(); + $writer->update(); Class_CosmoVar::setValueOf('other_index_fields', '300$a;330$a'); - $this->loadNoticeFromString($writer->getFullRecord()); - $this->items = Class_Notice::findFirstBy([])->getExemplaires(); - } + $this->loadNoticeFromString($writer->getFullRecord()); + $this->items = Class_Notice::findFirstBy([])->getExemplaires(); + } - /** @test */ - public function firstItemLocationShouldBeSet() { - $this->assertItemLocation($this->items[0], 3); - } + /** @test */ + public function firstItemLocationShouldBeSet() { + $this->assertItemLocation($this->items[0], 3); + } - /** @test */ - public function secondItemLocationShouldBeSet() { - $this->assertItemLocation($this->items[1], 8); - } + /** @test */ + public function secondItemLocationShouldBeSet() { + $this->assertItemLocation($this->items[1], 8); + } - /** @test */ - public function thirdItemLocationShouldBeSet() { - $this->assertItemLocation($this->items[2] , 3); - } + /** @test */ + public function thirdItemLocationShouldBeSet() { + $this->assertItemLocation($this->items[2] , 3); + } - /** @test */ - public function fourthItemLocationShouldBeSet() { - $this->assertItemLocation($this->items[3], 9); - } + /** @test */ + public function fourthItemLocationShouldBeSet() { + $this->assertItemLocation($this->items[3], 9); + } /** @test */ @@ -1322,36 +1309,36 @@ class NoticeIntegrationMarioCartWiiTest extends NoticeIntegrationTestCase { } - protected function assertItemLocation($item, $location) { - $this->assertEquals($location, $item->getEmplacement(), - json_encode($item->getRawAttributes())); - } + protected function assertItemLocation($item, $location) { + $this->assertEquals($location, $item->getEmplacement(), + json_encode($item->getRawAttributes())); + } } class NoticeIntegrationNoNoticeTest extends NoticeIntegrationTestCase { - public function tearDown() { - Storm_Model_Loader::defaultToDb(); - parent::tearDown(); - } + public function tearDown() { + Storm_Model_Loader::defaultToDb(); + parent::tearDown(); + } - public function setUp() { - parent::setUp(); - Storm_Model_Loader::defaultToVolatile(); - $this->_notice_integration = new notice_integration(); - } + public function setUp() { + parent::setUp(); + Storm_Model_Loader::defaultToVolatile(); + $this->_notice_integration = new notice_integration(); + } - /** @test */ - public function updateNoticeShouldNotCrash() { - $this->assertEquals(1, $this->_notice_integration->updateNotice(1,5)); - } + /** @test */ + public function updateNoticeShouldNotCrash() { + $this->assertEquals(1, $this->_notice_integration->updateNotice(1,5)); + } - /** @test */ - public function writeItemShouldNotCrash() { - $this->assertNull($this->_notice_integration->ecrireExemplaires(1)); - } + /** @test */ + public function writeItemShouldNotCrash() { + $this->assertNull($this->_notice_integration->ecrireExemplaires(1)); + } } diff --git a/cosmogramme/tests/php/classes/unimarc_cestas_tchaikovsky.txt b/cosmogramme/tests/php/classes/unimarc_cestas_tchaikovsky.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5b8235cb8bcf73147545220f645eb28bb504877 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_cestas_tchaikovsky.txt @@ -0,0 +1 @@ +01762njm0 2200313 450 00100060000001000110000610000450001720000220006221000260008422500320011041000230014246400540016546400610021946401950028060600110047560600220048668600760050868600390058470000310062370200200065470200230067471200670069771200280076480100170079290003240080999300150113399501370114899601630128511785 d41,5 F a20110812u u u0frey50 1 aSuites de ballets cPolydordRééd. 19932 aPanorama classique9id:2999 0tPanorama classique tLe Lac des cygnes:suite extraite du ballet op. 20 tLa belle au bois dormant:suite extraite du ballet op. 66 tCasse-noisette:suite extraite du ballet op. 71/ Piotr Ilyich Tchaïkovski, Witold Rowicki, dir., Ferdinand Leitner, dir., Orchestre Symphonique de la Philharmonie Nationale de Varsovie, Berl 1aballet amusique classique a3tMusique classique (Musique savante de tradition occidentale)2Cestas aAdultestAdultes2Code stat Cestas 1aTchaïkovskibPiotr Ilyich 1aRowickibWitold 1aLeitnerbFerdinand02aOrchestre Symphonique de la Philharmonie Nationale de Varsovie 1aBerliner Philharmoniker 2aFrc20190726 aLe Lac des cygnes:suite extraite du ballet op. 20 ; La belle au bois dormant:suite extraite du ballet op. 66 ; Casse-noisette:suite extraite du ballet op. 71/ Piotr Ilyich Tchaïkovski, Witold Rowicki, dir., Ferdinand Leitner, dir., Orchestre Symphonique de la Philharmonie Nationale de Varsovie, BerllContientntracks 41a0-4 ans aMédiathèque de Cestasf35025224k3 TCH 28m20190726qdrjeopv12[DISPO][Disponible][0][1][En rayon][0][0][0][0]50641758191 f35025224k3 TCH 28m00000000n00000000aFonds propreb2vMédiathèque MunicipalexCompact disques adulteeCompact disque adulterCD1Document en bon état31 \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/unimarc_minsoc_ia.txt b/cosmogramme/tests/php/classes/unimarc_minsoc_ia.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad68dbe65ebc5d246ceaf1795676174237c45381 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_minsoc_ia.txt @@ -0,0 +1 @@ +03378cam a2200397 4500001000700000010002300007090001100030099011600041100004100157101000800198102000700206200040200213210002800615215004200643225005600685300003800741330083500779410005901614609003801673609003201711609002301743712003701766801004801803856020601851856022902057003004702286020001702333105001802350106000602368606012502374606013602499676001902635686006602654930011702720930014302837440414 a9782111526341bbr. a440414 tOUVRAGEyADMINISTRATIONySANTESOCIALyTRAVAILEMPLOIaBeÌatrice LEROYbBeÌatrice LEROYc2019-08-13d2019-08-13 a20190228d2019 m h0frey50 ba0 afre aFR1 aIntelligence artificiellebOUVRAGEbDocument eÌlectroniquebRapporteeÌtat de l'art et perspectives pour la Franceerapport finalfPIPAME, PoÌ‚le interministeÌriel de prospective et d'anticipation des mutations eÌconomiques ; DGE, Direction geÌneÌrale des entreprises ; CGET, Commissariat geÌneÌral aÌ€ l'eÌgaliteÌ des territoires... [et al.]g[rapport reÌaliseÌ par ATAWAO Consulting] e53-MayennegImpr. Jouve a1 vol. (311 p.)cill. en coul.d30 cm aProspectiveeeÌtudes eÌconomiquesfDGEx2491-0058 aBibliogr. et webliogr. p. 306-309 aApreÌ€s un eÌtat de l’art des diffeÌrentes technologies du domaine, l’eÌtude propose une meÌthode de classification des secteurs potentiellement les plus transformeÌs par l’essor de l’intelligence artificielle et eÌtablit une analyse macroscopique de son adoption par ceux-ci. Elle approfondit ensuite cette analyse pour quatre secteurs : EÌnergie et environnement, Transport et logistique, SanteÌ et Industrie. Pour chacun de ces quatre secteurs, un bilan des opportuniteÌs geÌneÌreÌes par l’IA est eÌtabli et une strateÌgie cible aÌ€ adopter est proposeÌe. Dans sa dernieÌ€re partie, l’eÌtude dessine une feuille de route ainsi que des recommandations sectorielles et transverses qui permettront aÌ€ la France et aÌ€ ses entreprises de relever les deÌfis en matieÌ€re d’intelligence artificielle. 044481451tEtudes eÌconomiquesx2491-0058d2019947552 9209229aIntelligence artificielle 939035aSecteur eÌconomique 937657aProspective 317815993aAtawao consulting4710 0aFRbFR-751131015c20190228gAFNOR2intermrc 2Rapportuhttps://www.entreprises.gouv.fr/files/files/directions_services/etudes-et-statistiques/prospective/Intelligence_artificielle/2019-02-intelligence-artificielle-etat-de-l-art-et-perspectives.pdf 2SyntheÌ€se du rapportuhttps://www.entreprises.gouv.fr/files/files/directions_services/etudes-et-statistiques/prospective/Intelligence_artificielle/2019-02-intelligence-artificielle-etat-de-l-art-et-perspectives-synthese.pdfhttp://catalogue.bnf.fr/ark:/12148/cb45679700r aFRb01927606 a||||z 00|y| ar 311932084aIntelligence artificielle311975935xApplications industrielles311931476yFrance312432924z1990-....2rameau 311932084aIntelligence artificielle311939593xInnovations technologiques311931476yFrance311950184xEÌtudes de marcheÌ2rameau a006.309 44v23 2Cadre de classement de la Bibliographie nationale française 5FR-751131009:45679700001001a2019-44342b759999999cTolbiac - Rez de Jardin - Sciences et technique - MagasindO 5FR-751131008:45679700002001a084.05 DGE ib759999999cTolbiac - Haut de Jardin - Droit, eÌconomie, politique - Salle D - Libre acceÌ€sdN \ No newline at end of file diff --git a/library/Class/CodifThesaurus.php b/library/Class/CodifThesaurus.php index 94aedac74675f326c36be3f5790a4122a9abd5aa..9488d3245abeb91ce85582b3db5fa9430c8234f5 100644 --- a/library/Class/CodifThesaurus.php +++ b/library/Class/CodifThesaurus.php @@ -278,11 +278,9 @@ class CodifThesaurusLoader extends Storm_Model_Loader { * @param int * $return Class_CodifThesaurus */ - public function findByIdOrigineAndCode($id_origine,$code_thesaurus) { - if ($thesaurus = Class_CodifThesaurus::findFirstBy(['id_origine' => $id_origine, - 'code' => $code_thesaurus ])) - return $thesaurus; - return Class_CodifThesaurus::findFirstBy(['id_origine' => $id_origine]); + public function findByIdOrigineAndCode($id_origine, $code_thesaurus) { + return Class_CodifThesaurus::findFirstBy(['id_origine' => $id_origine, + 'code' => $code_thesaurus ]); } diff --git a/library/Class/CodifThesaurus/Rules.php b/library/Class/CodifThesaurus/Rules.php index f9b054539d6759c8e292636dda420a663ce13d21..98ae173f5694a3b40e36cfacc80c5541229d05b9 100644 --- a/library/Class/CodifThesaurus/Rules.php +++ b/library/Class/CodifThesaurus/Rules.php @@ -87,7 +87,6 @@ class Class_CodifThesaurus_Rules extends Class_Entity { } - /** * @param $reader cosmogramme notice_unimarc */ @@ -118,27 +117,46 @@ class Class_CodifThesaurus_Rules extends Class_Entity { * @param $reader cosmogramme notice_unimarc */ public function extractIdAndFields($reader) { + $label_field = trim($this->getLabelField()); $id_field = trim($this->getIdField()); - $id_labels = array_map(function($fields) use ($label_field, $id_field) - { - if (!isset($fields[$label_field])) - return null; - - $label = $this->truncateLabel($fields[$label_field]); - if (!$this->isValidLabel($label)) - return null; - - $id = (isset($fields[$id_field]) ? $fields[$id_field] : null); - return ['id' => strtoupper($this->isValidLabel($id) ? $id : $label), - 'label' => $label]; - }, - $this->_getZonesToParse($reader)); - return array_filter($id_labels); - } + if (!$label_field) + return []; + + $filter_field = $this->getFilterField(); + + $filter_subfield_in = function($block) { + + $label = $this->truncateLabel($block->get('label')); + if (!$this->isValidLabel($label)) + return false; + $filter_zone = $this->getZone(); + $filter_field = $this->getFilterField(); + $filter_value = $this->getFilterValue(); + if (!$filter_zone || (null === $filter_field) | !$filter_value) + return true; + return ($block->get('filter') == $filter_value); + + }; + + $fields = $reader->cutBlockBySubfields($this->getZonePadded(), + [$label_field =>'label', + $id_field =>'id', + $filter_field => 'filter'], $filter_subfield_in); + + return array_filter(array_map([$this,'buildAuthorityStructure'],$fields)); + } + + public function buildAuthorityStructure($block){ + $label = $this->truncateLabel($block->get('label')); + return ['id' => $block->get('id') + ? strtoupper($block->get('id')) + : strtoupper($label), + 'label' => $label]; + } public function truncateLabels($labels) { return array_filter( diff --git a/library/Class/Mail.php b/library/Class/Mail.php index fb3b43e08f606adae3fba5bf505623c51b59e9b3..3fdf7a80af82f1ebf206d2c0febb21fc5ac8e024 100644 --- a/library/Class/Mail.php +++ b/library/Class/Mail.php @@ -76,17 +76,7 @@ class Class_Mail { if (!$this->isMailValid($destinataire)) return $this->_("L'adresse e-mail du destinataire est incorrecte."); - - // Fusion - if($data) - { - foreach($data as $var => $valeur) - { - $var="{".$var."}"; - $body=str_replace($var,$valeur,$body); - } - } - $body = wordwrap($body, 60); + $body = $this->_injectDatasInto($data, $body); $statut = $this->mail($destinataire, $sujet, $body); @@ -96,6 +86,17 @@ class Class_Mail { } + protected function _injectDatasInto($data, $body) { + if (!$data) + return $body; + + foreach ($data as $name => $value) + $body = str_replace('{' . $name . '}', $value, $body); + + return $body; + } + + public function isMailValid($mail) { $validator = new Zend_Validate_EmailAddress(); return $validator->isValid($mail); @@ -105,4 +106,4 @@ class Class_Mail { public function getMailFrom() { return $this->mail_from; } -} \ No newline at end of file +} diff --git a/library/Class/NoticeUnimarc.php b/library/Class/NoticeUnimarc.php index a1e25d6a7da4a5bd2e2df48f7335c1f1f047ec12..6fdbb3b724ebb39f1b271bec1c702b4ccdb5c2af 100644 --- a/library/Class/NoticeUnimarc.php +++ b/library/Class/NoticeUnimarc.php @@ -40,6 +40,7 @@ class Class_NoticeUnimarc { protected $rgx_field_end; protected $subfield_begin; protected $rgx_subfield_begin; + protected $blocks = []; public function __construct() { $this->tracer_accents = isset(self::$_tracer_accents_iso) @@ -177,6 +178,70 @@ class Class_NoticeUnimarc { } + /** + @data $subfields_mapping = [ 'y' => 'label', '4'=> 'id' ] + + @return [ Class_Entity ('id' => 'valeur', + 'label' => 'label' + ),... + ] + */ + public function cutBlockBySubfields($zone, $subfields_mapping, $closure_valid) { + + $this->blocks=[]; + + foreach ($this->get_subfield($zone) as $line) { + $this->_cutLineBySubfields($line, $subfields_mapping,$closure_valid); + } + return $this->blocks; + } + + + protected function _cutLineBySubfields($line, $subfields_mapping, $closure_valid) { + $block = $this->_newBlock(); + + $fields = $this->_bloc_to_array($line); + + $bloc_values = array_values($subfields_mapping); + + foreach($fields as $field) { + $code = substr($field, 0, 1); + $value = trim(substr($field, 1)); + if (!in_array($code,array_keys($subfields_mapping))) + continue; + + if ($block->get($subfields_mapping[$code])) { + $block = $this->_addBlock($block,$closure_valid); + } + + $block->set($subfields_mapping[$code], $value); + + } + + $this->_addBlock($block,$closure_valid); + + return $this; + } + + + protected function _newBlock() { + return new Class_Entity(); + } + + + protected function _addBlock($block, $closure_valid) { + if (call_user_func($closure_valid,$block)) + $this->blocks[] = $block; + return $this->_newBlock(); + } + + + protected function _bloc_to_array($bloc) { + $bloc = substr($bloc, 3); + return explode($this->subfield_begin, $bloc); + } + + public function decoupe_bloc_champ($bloc,$num=false) { $sc = []; $bloc = substr($bloc, 3); @@ -185,44 +250,10 @@ class Class_NoticeUnimarc { $sc[] = $num == true ? [substr($field, 0, 1), trim(substr($field, 1))] : ['code' => substr($field, 0, 1), 'valeur' => trim(substr($field, 1))]; - return (0 == count($sc)) ? null : $sc; } - - /** - * ex: $unimarc->parseZone(686) - * - * answers: - * [ - * [ 'a' => 'A12+' - * 't' => 'A12+' - * '2' => 'Ludo - Age'], - * - * [ 'a' => '3-5J' - * 't' => '3-5 JOUEURS' - * '2' => 'Ludo - Nb joueurs'] - * ] - */ - public function parseZone($zone) { - return array_map(function($bloc) - { - return $this->parseZoneFields($bloc); - }, - $this->get_subfield($this->getZonePadded())); - } - - - /** @see parseZone */ - public function parseZoneFields($marc) { - $fields = []; - foreach(explode($this->subfield_begin, substr($marc,3)) as $field) - $fields[substr($field, 0, 1)] = trim(substr($field, 1)); - return $fields; - } - - public function reset_notice() { $this->full_record = ''; $this->guide = ''; diff --git a/library/Class/NoticeUnimarc/Fluent.php b/library/Class/NoticeUnimarc/Fluent.php index a60d7bac7bbd4cc1f81e2c8bb79dea74592c8347..4fbfdd00bc0375a864d807fdf2b44a6e06a41566 100644 --- a/library/Class/NoticeUnimarc/Fluent.php +++ b/library/Class/NoticeUnimarc/Fluent.php @@ -25,6 +25,13 @@ class Class_NoticeUnimarc_Fluent { $_label, $_zones; + /** @param $reader Class_NoticeUnimarc */ + public static function fromLegacy($reader) { + return (new Class_NoticeUnimarc_LegacyVisitor()) + ->legacyToFluent($reader); + } + + public function __construct() { $this->_label = new Class_NoticeUnimarc_BibliographicLabel(); $this->_zones = new Storm_Collection(); @@ -65,20 +72,26 @@ class Class_NoticeUnimarc_Fluent { } + public function zonesCollect($callback) { + return $this->_zones->collect($callback); + } + + public function render() { $address = 0; $directory = ''; - $zones = implode($this->_zones - ->collect( - function($zone) use(&$address, &$directory) { - $marc = $zone->render(); - $length = strlen($marc); - $directory .= $zone->directoryWith($length, $address); - $address += $length; - return $marc; - }) - ->getArrayCopy()); + $zones = $this + ->zonesCollect(function($zone) use(&$address, &$directory) + { + $marc = $zone->render(); + $length = strlen($marc); + $directory .= $zone->directoryWith($length, $address); + $address += $length; + return $marc; + }); + + $zones = implode($zones->getArrayCopy()); $zones .= chr(0x1d); $directory .= chr(0x1e); @@ -183,6 +196,11 @@ class Class_NoticeUnimarc_Zone { } + public function isLabel($label) { + return $label == $this->_label; + } + + public function content($content) { $this->_content = $content; $this->_sub_zones = new Storm_Collection(); @@ -192,9 +210,17 @@ class Class_NoticeUnimarc_Zone { public function children($children) { foreach($children as $code => $value) - $this->_sub_zones->append((new Class_NoticeUnimarc_SubZone)->code($code)->value($value)); - $this->_content = null; + $this->addChild($code, $value); + + return $this; + } + + public function addChild($code, $value) { + $this->_sub_zones + ->append((new Class_NoticeUnimarc_SubZone)->code($code)->value($value)); + + $this->_content = null; return $this; } @@ -205,6 +231,19 @@ class Class_NoticeUnimarc_Zone { } + public function detectFieldByCode($code) { + return $this->detectField(function($field) use($code) + { + return $field->isCode($code); + }); + } + + + public function detectField($callback) { + return $this->_sub_zones->detect($callback); + } + + public function render() { $content = $this->_content ? $this->_content @@ -234,13 +273,60 @@ class Class_NoticeUnimarc_SubZone { } + public function isCode($code) { + return $code == $this->_code; + } + + public function value($value) { $this->_value = $value; return $this; } + public function getValue() { + return $this->_value; + } + + public function render() { return chr(0x1f) . $this->_code . $this->_value; } +} + + + + +class Class_NoticeUnimarc_LegacyVisitor { + protected $_fluent; + + public function __call($name, $args) { + if ('visit' === substr($name, 0, 5)) + return $this; + + throw new RuntimeException('Call to undefine method Class_NoticeUnimarc_LegacyVisitor::' . $name); + } + + + public function legacyToFluent($reader) { + $this->_fluent = new Class_NoticeUnimarc_Fluent; + $reader->acceptVisitor($this); + + return $this->_fluent; + } + + + public function visitZone($label, $definition) { + $zone = $this->_fluent->newZone()->label($label); + $fields = $definition['champs']; + if (1 == count($fields) && '' === $fields[0]['code']) { + $zone->content($fields[0]['valeur']); + return $this; + } + + foreach($fields as $field) + $zone->addChild(substr($field['code'], 1, 1), $field['valeur']); + + return $this; + } } \ No newline at end of file diff --git a/library/Class/User/LostPass.php b/library/Class/User/LostPass.php index 8ea5047aec07c92031f1fe14c787cdd549330194..1225309f77a03acc4354b479e61e174de4610399 100644 --- a/library/Class/User/LostPass.php +++ b/library/Class/User/LostPass.php @@ -24,7 +24,7 @@ class Class_User_LostPass { use Trait_TimeSource, Trait_Translator; - const MAX_MINUTES = 30; + const MAX_HOURS = 24; const TOKEN_SEPARATOR = '@'; const TOKEN_DATE_FORMAT = 'YmdHis'; @@ -56,7 +56,7 @@ class Class_User_LostPass { public function tokenHasExpiredFrom($date) { $from = DateTime::createFromFormat(static::TOKEN_DATE_FORMAT, $date); $now = new DateTime($this->getCurrentDateTime()); - $from->add(new DateInterval('PT' . static::MAX_MINUTES . 'M')); + $from->add(new DateInterval('PT' . static::MAX_HOURS . 'H')); return $from < $now; } @@ -141,9 +141,9 @@ class Class_User_LostPassResetLink extends Class_User_LostPassSender{ 'id' => $user->getId(), 'token' => $token, 'created' => $created_at_part], null, true)) - . $this->_("ATTENTION : ce lien créé à %s est valide pendant %s minutes\n", + . $this->_("ATTENTION : ce lien créé à %s est valide pendant %s heures\n", date('H:i', $created_at), - Class_User_LostPass::MAX_MINUTES) + Class_User_LostPass::MAX_HOURS) . sprintf("%s\n\n", $this->_('Bonne navigation sur le portail')); } diff --git a/library/Class/WebService/BibNumerique/CiteDeLaMusique.php b/library/Class/WebService/BibNumerique/CiteDeLaMusique.php index 42c80339fb9d3895c925bdc09674d95f47a44df4..400228a2d3a5bbea76aad2b1cf727580417f371e 100644 --- a/library/Class/WebService/BibNumerique/CiteDeLaMusique.php +++ b/library/Class/WebService/BibNumerique/CiteDeLaMusique.php @@ -30,7 +30,7 @@ class Class_WebService_BibNumerique_CiteDeLaMusique public function __construct() { $this->_ermes_parser = new Class_WebService_OAI_ErmesParser(); $this->_oaiws = (new Class_WebService_OAI()) - ->setMetadataPrefix('Ermes') + ->setMetadataPrefix('ermes') ->setParser($this->_ermes_parser) ->setOAIHandler($this->getUrlOrigine()) ->setNumericResourceClass('Class_WebService_BibNumerique_CiteDeLaMusique_Album'); diff --git a/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php b/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php index 92313530da48edab5c85065e462b181578378985..078bfdbdf0c42d0fff6f87ff9ded79c038fb4882 100644 --- a/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php +++ b/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php @@ -22,6 +22,8 @@ class Class_WebService_SIGB_Orphee_GetLstDmtResponseReader extends Class_WebService_SIGB_AbstractXMLNoticeReader { const CODE_SITUTATION_SORTI = 2; const CODE_SITUTATION_RESERVE = 3; + const CODE_SITUTATION_PERDU = 5; + const CODE_SITUTATION_EN_RESERVE = 10; const CODE_SITUTATION_ARCHIVAGE = 14; const CODE_SITUTATION_CATALOGAGE = 17; @@ -71,8 +73,12 @@ class Class_WebService_SIGB_Orphee_GetLstDmtResponseReader extends Class_WebServ public function endSit($data) { - $reservable = ($data==self::CODE_SITUTATION_SORTI || $data==self::CODE_SITUTATION_RESERVE); + $reservable = in_array($data, [self::CODE_SITUTATION_SORTI, + self::CODE_SITUTATION_RESERVE, + self::CODE_SITUTATION_EN_RESERVE]); + $this->_current_exemplaire->setReservable($reservable); + $visible = ($data!=self::CODE_SITUTATION_ARCHIVAGE && $data!=self::CODE_SITUTATION_CATALOGAGE); $this->_current_exemplaire->setVisibleOPAC($visible); } diff --git a/library/ZendAfi/View/Helper/ModeleFusion/Template/Loans.php b/library/ZendAfi/View/Helper/ModeleFusion/Template/Loans.php index e801960ccc64d43a0097a06ec254d7143dd25221..655beeb126a783fd14cc4decefc230907f109272 100644 --- a/library/ZendAfi/View/Helper/ModeleFusion/Template/Loans.php +++ b/library/ZendAfi/View/Helper/ModeleFusion/Template/Loans.php @@ -28,19 +28,19 @@ class ZendAfi_View_Helper_ModeleFusion_Template_Loans extends ZendAfi_View_Helpe protected function _getRow() { $html = [$this->_tag('h1', - $this->_('Titre : {getTitle}')), + $this->_('Titre : {title}')), - $this->_tag('span', '{getThumbnail}'), + $this->_tag('span', '{thumbnail}'), - $this->_tag('span', $this->_('emprunté par : {getLoanedBy}')), + $this->_tag('span', $this->_('Emprunté par : {loaned_by}')), - $this->_tag('span', $this->_('code barre : {getBarCode}')), + $this->_tag('span', $this->_('Code-barre : {bar_code}')), - $this->_tag('span', $this->_('Auteur : {getAuthor}')), + $this->_tag('span', $this->_('Auteur : {author}')), - $this->_tag('span', $this->_('date de prêt : {getIssueDate}')), + $this->_tag('span', $this->_('Date de prêt : {issue_date}')), - $this->_tag('span', $this->_('dates de retour prévu : {getReturnDate}')), + $this->_tag('span', $this->_('Date de retour prévue : {return_date}')), ]; return $this->_getRowWrapper(implode(BR, $html)); diff --git a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php index 29afa75929066d772190d96017fd4312cc39cb22..63be51b750b03d0d4fbd2d3abc34ba67bc52f1c8 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php @@ -162,13 +162,16 @@ abstract class AbonneControllerPretsListThreePretsTestCase extends AbstractAbonn 'notice' => $this->fixture('Class_Notice', ['id' => 827, 'titre_principal' => 'Alice', - 'unimarc' => '01175cam0 22002771 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrèfleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la forêt aux portes, Alice tombe nez à nez avec Ace. Devenue malgré elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assisté à la scène, intervient, la rencontre tourne à l\'affrontement. b9782355926358 1tAlice au royaume de Trèfle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR'])])); + 'unimarc' => '01175cam0 22002771 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrèfleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la forêt aux portes, Alice tombe nez à nez avec Ace. Devenue malgré elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assisté à la scène, intervient, la rencontre tourne à l\'affrontement. b9782355926358 1tAlice au royaume de Trèfle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR', + 'url_image' => 'Alice.jpg', + ])])); $alice->parseExtraAttributes(['Dateretourprevue' => '21/10/2010', 'Section' => 'Espace jeunesse', 'Auteur' => 'Lewis Caroll', 'Bibliotheque' => 'Almont', 'N° de notice' => '5678']); + $alice->setIssueDate('10/10/2010'); $this->fixture('Class_Exemplaire', ['id' => 918, @@ -1155,28 +1158,44 @@ class AbonneControllerBarcodesExportThreePretsTest extends AbonneControllerPrets class AbonneControllerPrintActionPretsTest extends AbonneControllerPretsListThreePretsTestCase { public function setUp() { parent::setUp(); + $helper = new ZendAfi_View_Helper_ModeleFusion_Template_Loans(); + $helper->setView(new ZendAfi_Controller_Action_Helper_View()); + $this->fixture('Class_ModeleFusion', ['id' => 9, 'type' => 'Loans_List', 'nom' => 'loans', - 'contenu' => '<div style="page-break-inside:auto">{loans.each[ -<div style="page-break-inside:avoid; page-break-after:auto;overflow:hidden;float:left;clear:both;padding: 0.5em;margin: 0.5em 0;border: 1px solid black;width:190mm;box-shadow: 0px 0px 5px;"> -<h1>Titre : {title}</h1> -<br /> -<span>{thumbnail}</span><br /> -<span>emprunté par : {loaned_by}</span><br /> -<span>code barre : {bar_code}</span><br /> -<span>Auteur : {author}</span><br /> -<span>date de prêt : {issue_date}</span><br /> -<span>dates de retour prévu : {return_date}</span></div> -]}</div>']); + 'contenu' => $helper->ModeleFusion_Template_Loans()]); $this->dispatch('abonne/print/ids/reload/strategy/Loans_List/modele_fusion/9', true); } /** @test */ - public function responseShouldContainsSomethings() { - $this->assertXPathContentContains('//div', 'Titre : Alice au royaume de '); + public function h1ShouldContainsAliceAuRoyaume() { + $this->assertXPathContentContains('//h1', 'Titre : Alice au royaume de '); + } + + /** @test */ + public function spanShouldContainsThumbnailAliceDotJpg() { + $this->assertXPath('//span//img[contains(@src, "Alice.jpg")]'); + } + + /** @test */ + public function spanShouldContainsCodeBarre124() { + $this->assertXPathContentContains('//span', 'Code-barre : 124'); + } + + + /** @test */ + public function spanShouldContainsDateRetour21102010() { + $this->assertXPathContentContains('//span', utf8_encode('Date de retour prévue : 21/10/2010'), + $this->_response->getBody()); + } + + + /** @test */ + public function spanShouldContainsDateDePret10102010() { + $this->assertXPathContentContains('//span', utf8_encode('Date de prêt : 10/10/2010')); } } diff --git a/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php b/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php index 481509f9164e32c1d101525e4a747694fbd4a4f8..e9fa77ea2aa2523979b63ff3de3ad4581285da89 100644 --- a/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerLostPasswordTest.php @@ -96,7 +96,7 @@ class AuthControllerLostPasswordActionTest extends AuthControllerLostPasswordTes class AuthControllerLostPasswordValidPostTest extends AuthControllerLostPasswordTestCase { - protected $_mail_transport; + protected $_mail_transport, $_mail; public function setUp() { parent::setUp(); @@ -124,19 +124,27 @@ class AuthControllerLostPasswordValidPostTest extends AuthControllerLostPassword $user->beAbonneSIGB()->assertSave(); $this->postDispatch('/opac/auth/lostpass', ['lost_username' => 'Chambelle']); + $this->_mail = $this->_mail_transport->sent_mail; } /** @test */ public function mailShouldBeSent() { - $this->assertNotNull($this->_mail_transport->sent_mail); + $this->assertNotNull($this->_mail); } /** @test */ public function mailShouldContainsVousAvezFaitUneDemande() { $this->assertContains('Vous avez fait une demande', - $this->_mail_transport->sent_mail->getBodyText(true)); + $this->_mail->getBodyText(true)); + } + + + /** @test */ + public function mailShouldContainsExpirationIn24H() { + $this->assertContains('est valide pendant 24 heures', + $this->_mail->getBodyText(true)); } } diff --git a/tests/library/Class/WebService/LastfmTest.php b/tests/library/Class/WebService/LastfmTest.php index 09b96a4afb5c8713c0995c3556b8e281a9a6b235..52cf4ea7de3339e4d3edd056d66d96fd20d2fe9a 100644 --- a/tests/library/Class/WebService/LastfmTest.php +++ b/tests/library/Class/WebService/LastfmTest.php @@ -154,7 +154,7 @@ class LastfmGetMorceauxNoTracksIntegrationTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->_last_fm = new Class_WebService_Lastfm(); - $this->_album = $this->_last_fm->getMorceaux('Les années de pélerinage', 'Franz Liszt'); + $this->_album = $this->_last_fm->getMorceaux('uiaunesrttt', 'auierst'); } @@ -162,9 +162,4 @@ class LastfmGetMorceauxNoTracksIntegrationTest extends ModelTestCase { public function nbResultsShouldBeZero() { $this->assertEquals(0, $this->_album['nb_resultats']); } - } - - - -?> diff --git a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php index abaffd96125425ddd25d1f19588ce3c3735f9fee..f5f2f310f08417221111acc679cc5147c728b5c9 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php +++ b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php @@ -366,6 +366,48 @@ class OrpheeFixtures { <titre><![CDATA[[Millenium (Larsson, Stieg (1954-2004))]]></titre> <date_edi><![CDATA[2010]]></date_edi> <can_rsv>0</can_rsv> + </document> + + <document> + <no><![CDATA[9876123]]></no> + <ntc><![CDATA[1301700727]]></ntc> + <carte><![CDATA[9876123]]></carte> + <sit><![CDATA[10]]></sit> + <lib_sit><![CDATA[ en reserve]]></lib_sit> + <loc><![CDATA[2]]></loc> + <lib_loc><![CDATA[ Salle bleue]]></lib_loc> + <loc_ori><![CDATA[2]]></loc_ori> + <lib_loc_ori><![CDATA[ Salle bleue]]></lib_loc_ori> + <cote><![CDATA[952.05 SCO]]></cote> + <anx_ori><![CDATA[1]]></anx_ori> + <lib_anx_ori><![CDATA[ Bibliothèque]]></lib_anx_ori> + <anx_cur><![CDATA[1]]></anx_cur> + <lib_anx_cur><![CDATA[ Bibliothèque]]></lib_anx_cur> + <anx_nxt><![CDATA[1]]></anx_nxt> + <lib_anx_nxt><![CDATA[ Bibliothèque]]></lib_anx_nxt> + <no_coll><![CDATA[0]]></no_coll> + <site><![CDATA[20]]></site> + <lib_site><![CDATA[ Saint Cloud]]></lib_site> + <sup><![CDATA[108]]></sup> + <lib_sup><![CDATA[ Livre]]></lib_sup> + <sec><![CDATA[2]]></sec> + <lib_sec><![CDATA[ Adultes]]></lib_sec> + <uti><![CDATA[2]]></uti> + <lib_uti><![CDATA[ Prêt normal]]></lib_uti> + <sta1><![CDATA[98]]></sta1> + <lib_sta1><![CDATA[ Docum Adulte]]></lib_sta1> + <sta2><![CDATA[57]]></sta2> + <lib_sta2><![CDATA[ Histoire]]></lib_sta2> + <sta3><![CDATA[0]]></sta3> + <lib_sta3 /> + <date_last_pret><![CDATA[03/05/2018]]></date_last_pret> + <date_last_retour><![CDATA[31/08/2018]]></date_last_retour> + <droit_resa><![CDATA[0]]></droit_resa> + <lib_droit_resa /> + <titre><![CDATA[[Millenium (Larsson, Stieg (1954-2004))]]></titre> + <date_edi><![CDATA[2010]]></date_edi> + </document> + </documents> </datas>'; } diff --git a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php index 253eafa78867fa72f3d6bcbb4a8818d307b82971..e8e44eb4da475ed36f3f04c74cc38b8d225b1686 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php +++ b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php @@ -349,7 +349,12 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { $this->fixture('Class_Exemplaire', ['id' => 6, 'code_barres' => '200014900', - 'id_origine' => 'frOr1301200059']) + 'id_origine' => 'frOr1301200059']), + + $this->fixture('Class_Exemplaire', + ['id' => 7, + 'code_barres' => '9876123', + 'id_origine' => 'frOr1301700727']) ] ]); @@ -504,6 +509,14 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { $this->assertNotEmpty($exemplaire); $this->assertFalse($exemplaire->isReservable()); } + + + /** @test */ + public function exemplaireByCodeBarre9876123ShouldBeReservable() { + $exemplaire = $this->_orphee->getExemplaire('frOr1301700727', '9876123'); + $this->assertTrue($exemplaire->isReservable()); + } + } diff --git a/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php b/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php index 8b1ef762286f30c42cba55acd61376d772dbcbc0..bf1b5fa72ff9fce28d8931d0a047b256518ffa66 100644 --- a/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php +++ b/tests/scenarios/CiteDeLaMusique/CiteDeLaMusiqueTest.php @@ -242,7 +242,7 @@ class CiteDeLaMusiqueParserTest extends ModelTestCase { $this->_http_client = $this->mock(); $this->_http_client ->whenCalled('open_url') - ->with('https://pad.philharmoniedeparis.fr/EXPLOITATION/oaiserver.ashx?verb=ListRecords&metadataPrefix=Ermes&set=videos-concerts-docu-entiers') + ->with('https://pad.philharmoniedeparis.fr/EXPLOITATION/oaiserver.ashx?verb=ListRecords&metadataPrefix=ermes&set=videos-concerts-docu-entiers') ->answers(CiteDeLaMusiqueFixtures::getFixtureContent('cite_de_la_musique_oai.xml')) ->whenCalled('open_url') @@ -250,7 +250,7 @@ class CiteDeLaMusiqueParserTest extends ModelTestCase { ->answers(CiteDeLaMusiqueFixtures::getFixtureContent('cite_de_la_musique_oai_end.xml')) ->whenCalled('open_url') - ->with('https://pad.philharmoniedeparis.fr/EXPLOITATION/oaiserver.ashx?verb=ListRecords&metadataPrefix=Ermes&set=audios-concerts-entiers') + ->with('https://pad.philharmoniedeparis.fr/EXPLOITATION/oaiserver.ashx?verb=ListRecords&metadataPrefix=ermes&set=audios-concerts-entiers') ->answers(CiteDeLaMusiqueFixtures::getFixtureContent('cite_de_la_musique_oai_audios.xml')) ->whenCalled('open_url') @@ -466,7 +466,7 @@ class CiteDeLaMusiqueOAIHarvestTest extends ModelTestCase { $http_client = $this->mock(); $http_client ->whenCalled('open_url') - ->with('https://pad.philharmoniedeparis.fr/EXPLOITATION/oaiserver.ashx?verb=ListRecords&metadataPrefix=Ermes&set=videos-concerts-docu-entiers&from=2017-10-11') + ->with('https://pad.philharmoniedeparis.fr/EXPLOITATION/oaiserver.ashx?verb=ListRecords&metadataPrefix=ermes&set=videos-concerts-docu-entiers&from=2017-10-11') ->answers(CiteDeLaMusiqueFixtures::getFixtureContent('cite_de_la_musique_oai.xml')) ->whenCalled('open_url')