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/NanookRecordsIntegrationTest.php b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php index 44c24977976bfec71c78bca49999fd7d3db83f71..e01efcc4068a5b93acc4eca3442ab562504288ee 100644 --- a/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php @@ -23,147 +23,147 @@ require_once('NoticeIntegrationTest.php'); abstract class NanookRecordsIntegrationTestCase extends NoticeIntegrationTestCase { - public function getProfilDonnees() { - $profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110); - return $profil->getRawAttributes(); + public function getProfilDonnees() { + $profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110); + return $profil->getRawAttributes(); } } /** @see http://forge.afi-sa.fr/issues/13769 */ class NanookRecordsIntegrationAvailabilityFacetTest extends NanookRecordsIntegrationTestCase { - public function getProfilDonnees() { - return Class_IntProfilDonnees::forNanook() - ->setIdProfil(110) - ->setAvailabilityField('v') - ->getRawAttributes(); - } - - - public function setUp() { - parent::setUp(); + public function getProfilDonnees() { + return Class_IntProfilDonnees::forNanook() + ->setIdProfil(110) + ->setAvailabilityField('v') + ->getRawAttributes(); + } - /* - * cf class_unimarc: [[file:../../../php/classes/classe_unimarc.php::$notice%5B"sections"%5D%5B%5D%20%3D%20$exemplaire%5B"section"%5D%3B][item data to record]] , - * [[file:../../../php/classes/classe_unimarc.php::if%20($champ_availability%20and%20$champ%5B'code'%5D%20%3D%3D%20$champ_availability)%20{][item parse unimarc]] - */ - $writer = new Class_NoticeUnimarc_Writer(); - $writer->setNotice(file_get_contents(dirname(__FILE__)."/unimarc_symphonie.txt")); - $writer->add_field('995', - ' ', - [ - ['f', '12345'], - ['v', '1'] - ]); - $writer->add_field('995', - ' ', - [ - ['f', '12346'], - ['v', 'ordered'] - ]); - $writer->update(); + public function setUp() { + parent::setUp(); - $this->loadNoticeFromString($writer->getFullRecord()); - Class_Notice::find(1)->updateFacetsFromExemplaires(); + /* + * cf class_unimarc: [[file:../../../php/classes/classe_unimarc.php::$notice%5B"sections"%5D%5B%5D%20%3D%20$exemplaire%5B"section"%5D%3B][item data to record]] , + * [[file:../../../php/classes/classe_unimarc.php::if%20($champ_availability%20and%20$champ%5B'code'%5D%20%3D%3D%20$champ_availability)%20{][item parse unimarc]] + */ + $writer = new Class_NoticeUnimarc_Writer(); + $writer->setNotice(file_get_contents(dirname(__FILE__)."/unimarc_symphonie.txt")); + $writer->add_field('995', + ' ', + [ + ['f', '12345'], + ['v', '1'] + ]); + $writer->add_field('995', + ' ', + [ + ['f', '12346'], + ['v', 'ordered'] + ]); + + $writer->update(); + + $this->loadNoticeFromString($writer->getFullRecord()); + Class_Notice::find(1)->updateFacetsFromExemplaires(); - } + } - /** @test */ - public function firstItemShouldNotBeAvailable() { - $this->assertFalse(Class_Exemplaire::find(1)->isDisponible(true)); - } + /** @test */ + public function firstItemShouldNotBeAvailable() { + $this->assertFalse(Class_Exemplaire::find(1)->isDisponible(true)); + } - /** @test */ - public function secondItemShouldBeAvailable() { - $this->assertTrue(Class_Exemplaire::find(2)->isDisponible(true)); - } + /** @test */ + public function secondItemShouldBeAvailable() { + $this->assertTrue(Class_Exemplaire::find(2)->isDisponible(true)); + } - /** @test */ - public function thirdItemShouldNotBeAvailable() { - $this->assertFalse(Class_Exemplaire::find(3)->isDisponible(true)); - } + /** @test */ + public function thirdItemShouldNotBeAvailable() { + $this->assertFalse(Class_Exemplaire::find(3)->isDisponible(true)); + } /** @test */ - public function noticeShouldContainsFacetV1() { - $this->assertContains('V1', Class_Notice::find(1)->getFacettes()); - } + public function noticeShouldContainsFacetV1() { + $this->assertContains('V1', Class_Notice::find(1)->getFacettes()); + } } /** @see http://forge.afi-sa.fr/issues/16358 */ class NanookRecordsIntegrationSymphonieTest extends NanookRecordsIntegrationTestCase { - public function getProfilDonnees() { - return Class_IntProfilDonnees::forNanook() + public function getProfilDonnees() { + return Class_IntProfilDonnees::forNanook() ->setItemField(Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE, ['zone' => '001', 'champ' => 'zz']) ->setIdProfil(110) ->getRawAttributes(); - } - - - public function setUp() { - parent::setUp(); - - $symphonie = $this->fixture('Class_Notice', - ['id' => 1, - 'type_doc' => 3, - 'alpha_titre' => 'SYMPHONIES 38 PRAGUE 41 JUPITER', - 'alpha_auteur' => 'MOZART WOLFGANG AMADEUS', - 'titres' => 'SYMPHONIES SINFONI 38 PRAGUE PRAG 41 JUPITER JUPIT', - 'auteurs' => 'MOZART MOZAR WOLFGANG OLFGANG AMADEUS AMAD JACOBS JAKOB RENE RAN FREIBURGER FREIBURJ BAROCKORCHESTER BAROKORKEST', - 'editeur' => 'Harmonia Mundi', - 'collection' => '', - 'matieres' => 'MUSIQUE MUSIK 18E SIECLE SIEKL AUTRICHE OTRICH', - 'dewey' => '', - 'facettes' => ' A1 A2 A3 M1 T3 B1', - 'cote' => '3 MOZ 24', - 'isbn' => '', - 'ean' => '3149020195840', - 'id_commerciale' => 'HARMONIAMUNDI2901958SYMPHONIES38PRAGUE41', - 'id_bnf' => '', - 'clef_alpha' => 'SYMPHONIES38PRAGUE41JUPITER--MOZARTW--HARMONIAMUNDI-2012-3', - 'clef_oeuvre' => 'SYMPHONIES38PRAGUE41JUPITER--MOZARTW-', - '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' => "02135njm0 2200409 450 001000700000010001100007071002800018073001800046100004500064126004500109200013500154210002500289215002800314300002800342345002200370464006700392464005900459464006600518464006600584464006900650464007800719464006500797610003600862686004700898700005800945702005201003702005701055801002201112856006701134856005901201856006601260856006601326856006901392856007801461856006501539992012101604196508 d8,05 E01a2901958bHarmonia Mundi a3149020195840 a20140613d2007 m y0frea0103 ba aax hx cd 1 aSymphonies 38 \"Prague\" & 41 \"Jupiter\"bCDfWolfgang Amadeus Mozart, compos.gRené Jacobs, dir.gFreiburger Barockorchester, orch. 1cHarmonia Mundid2012 1a1 CD (68 min)e1 livret aEnregistrement de 2007. b3149020195840cCD tSymphonii nع38 en ré majeur, k504 'prague' : adagio, allegro tSymphonie nع38 en ré majeur, k504 'prague' : andante tSymphonie n°38 en ré majeur, k504 'prague' : finale, presto tSymphonie n°41 en ut majeur, k551 'jupiter' : allegro vivace tSymphonie n°41 en ut majeur, k551 'jupiter' : andante cantabile tSymphonie n°41 en ut majeur, k551 'jupiter' : menuetto, allegretto, trio tSymphonie n°41 en ut majeur, k551 'jupiter' : molto allegro aMusique - 18e siècleyAutriche a3.24tSymphonie, poème symphonique2PCDM4 1aMozartbWolfgang Amadeusf1756-179142306Compositeur 1aJacobsbRenéf1946-....4qco6chef d'orchestre 1aFreiburger Barockorchester4ost6orchestre à cordes 1aFRbCVSc201406134 zSymphonie nع38 en ré majeur, k504 'prague' : adagio, allegro4 zSymphonie nع38 en ré majeur, k504 'prague' : andante4 zSymphonie nع38 en ré majeur, k504 'prague' : finale, presto4 zSymphonie nع41 en ut majeur, k551 'jupiter' : allegro vivace4 zSymphonie nع41 en ut majeur, k551 'jupiter' : andante cantabile4 zSymphonie nع41 en ut majeur, k551 'jupiter' : menuetto, allegretto, trio4 zSymphonie nع41 en ut majeur, k551 'jupiter' : molto allegro uhttp://ecx.images-amazon.com/images/I/51nXuj1YJPL._SL160_.jpgvhttp://ecx.images-amazon.com/images/I/51nXuj1YJPL.jpg", - 'z3950_retry' => 0, - 'nb_visu' => 0, - 'nb_resa' => 0, - 'url_vignette' => '', - 'url_image' => '']); - - $this->_mock_sql - ->whenCalled('fetchEnreg') - ->with('select * from int_bib where id_bib=1') - ->answers(['id' => 1, - 'qualite' => 5]); - - - $this->_mock_sql - ->whenCalled('fetchEnreg') - ->with('select qualite,unimarc,facettes from notices where id_notice=1') - ->answers($symphonie->toArray()); + } + + + public function setUp() { + parent::setUp(); + + $symphonie = $this->fixture('Class_Notice', + ['id' => 1, + 'type_doc' => 3, + 'alpha_titre' => 'SYMPHONIES 38 PRAGUE 41 JUPITER', + 'alpha_auteur' => 'MOZART WOLFGANG AMADEUS', + 'titres' => 'SYMPHONIES SINFONI 38 PRAGUE PRAG 41 JUPITER JUPIT', + 'auteurs' => 'MOZART MOZAR WOLFGANG OLFGANG AMADEUS AMAD JACOBS JAKOB RENE RAN FREIBURGER FREIBURJ BAROCKORCHESTER BAROKORKEST', + 'editeur' => 'Harmonia Mundi', + 'collection' => '', + 'matieres' => 'MUSIQUE MUSIK 18E SIECLE SIEKL AUTRICHE OTRICH', + 'dewey' => '', + 'facettes' => ' A1 A2 A3 M1 T3 B1', + 'cote' => '3 MOZ 24', + 'isbn' => '', + 'ean' => '3149020195840', + 'id_commerciale' => 'HARMONIAMUNDI2901958SYMPHONIES38PRAGUE41', + 'id_bnf' => '', + 'clef_alpha' => 'SYMPHONIES38PRAGUE41JUPITER--MOZARTW--HARMONIAMUNDI-2012-3', + 'clef_oeuvre' => 'SYMPHONIES38PRAGUE41JUPITER--MOZARTW-', + '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' => "02135njm0 2200409 450 001000700000010001100007071002800018073001800046100004500064126004500109200013500154210002500289215002800314300002800342345002200370464006700392464005900459464006600518464006600584464006900650464007800719464006500797610003600862686004700898700005800945702005201003702005701055801002201112856006701134856005901201856006601260856006601326856006901392856007801461856006501539992012101604196508 d8,05 E01a2901958bHarmonia Mundi a3149020195840 a20140613d2007 m y0frea0103 ba aax hx cd 1 aSymphonies 38 \"Prague\" & 41 \"Jupiter\"bCDfWolfgang Amadeus Mozart, compos.gRené Jacobs, dir.gFreiburger Barockorchester, orch. 1cHarmonia Mundid2012 1a1 CD (68 min)e1 livret aEnregistrement de 2007. b3149020195840cCD tSymphonii nع38 en ré majeur, k504 'prague' : adagio, allegro tSymphonie nع38 en ré majeur, k504 'prague' : andante tSymphonie n°38 en ré majeur, k504 'prague' : finale, presto tSymphonie n°41 en ut majeur, k551 'jupiter' : allegro vivace tSymphonie n°41 en ut majeur, k551 'jupiter' : andante cantabile tSymphonie n°41 en ut majeur, k551 'jupiter' : menuetto, allegretto, trio tSymphonie n°41 en ut majeur, k551 'jupiter' : molto allegro aMusique - 18e siècleyAutriche a3.24tSymphonie, poème symphonique2PCDM4 1aMozartbWolfgang Amadeusf1756-179142306Compositeur 1aJacobsbRenéf1946-....4qco6chef d'orchestre 1aFreiburger Barockorchester4ost6orchestre à cordes 1aFRbCVSc201406134 zSymphonie nع38 en ré majeur, k504 'prague' : adagio, allegro4 zSymphonie nع38 en ré majeur, k504 'prague' : andante4 zSymphonie nع38 en ré majeur, k504 'prague' : finale, presto4 zSymphonie nع41 en ut majeur, k551 'jupiter' : allegro vivace4 zSymphonie nع41 en ut majeur, k551 'jupiter' : andante cantabile4 zSymphonie nع41 en ut majeur, k551 'jupiter' : menuetto, allegretto, trio4 zSymphonie nع41 en ut majeur, k551 'jupiter' : molto allegro uhttp://ecx.images-amazon.com/images/I/51nXuj1YJPL._SL160_.jpgvhttp://ecx.images-amazon.com/images/I/51nXuj1YJPL.jpg", + 'z3950_retry' => 0, + 'nb_visu' => 0, + 'nb_resa' => 0, + 'url_vignette' => '', + 'url_image' => '']); + + $this->_mock_sql + ->whenCalled('fetchEnreg') + ->with('select * from int_bib where id_bib=1') + ->answers(['id' => 1, + 'qualite' => 5]); + + + $this->_mock_sql + ->whenCalled('fetchEnreg') + ->with('select qualite,unimarc,facettes from notices where id_notice=1') + ->answers($symphonie->toArray()); $this->loadNotice('unimarc_symphonie'); - } + } - /** @test */ - public function degreeShouldStayUTF8Degree() { - $this->assertContains('n°', Class_Notice::find(1)->get_subfield(464, 't')[0]); - } + /** @test */ + public function degreeShouldStayUTF8Degree() { + $this->assertContains('n°', Class_Notice::find(1)->get_subfield(464, 't')[0]); + } /** @test */ @@ -179,62 +179,62 @@ class NanookRecordsIntegrationSymphonieTest extends NanookRecordsIntegrationTest class NanookRecordsIntegrationInterestEsperluetteTest extends NanookRecordsIntegrationTestCase { protected $_storm_default_to_volatile = true; - public function setUp() { - parent::setUp(); - - $this->_mock_sql - ->whenCalled('fetchEnreg') - ->with('select * from int_bib where id_bib=1') - ->answers(['id' => 1, - 'qualite' => 5, - 'sigb' => 13]); - $this->loadNotice('unimarc_esperluette_2014'); - $this->loadNotice('unimarc_esperluette_2014'); - $this->notice = Class_Notice::find(1); - } - - - /** @test */ - public function deweyShouldContainsEsperluette() { - $this->assertEquals('80993352 ESPERLUETTE ESPERLUET 2014', $this->notice->getDewey()); - } + public function setUp() { + parent::setUp(); + + $this->_mock_sql + ->whenCalled('fetchEnreg') + ->with('select * from int_bib where id_bib=1') + ->answers(['id' => 1, + 'qualite' => 5, + 'sigb' => 13]); + $this->loadNotice('unimarc_esperluette_2014'); + $this->loadNotice('unimarc_esperluette_2014'); + $this->notice = Class_Notice::find(1); + } + + + /** @test */ + public function deweyShouldContainsEsperluette() { + $this->assertEquals('80993352 ESPERLUETTE ESPERLUET 2014', $this->notice->getDewey()); + } } class NanookRecordsIntegrationAuxAnimauxLaGuerreTest extends NanookRecordsIntegrationTestCase { - public function setUp() { - parent::setUp(); - $this->loadNotice('unimarc_aux_animaux_la_guerre'); - $this->loadNotice('unimarc_aux_animaux_la_guerre'); - } - - - /** @test */ - public function noticeAuxAnimauxLaGuerreCallNumberShouldNotBeEmpty() { - $notice = Class_Notice::find(1); - $this->assertEquals('RP MATH', $notice->getCote()); - } + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_aux_animaux_la_guerre'); + $this->loadNotice('unimarc_aux_animaux_la_guerre'); + } + + + /** @test */ + public function noticeAuxAnimauxLaGuerreCallNumberShouldNotBeEmpty() { + $notice = Class_Notice::find(1); + $this->assertEquals('RP MATH', $notice->getCote()); + } } class NanookRecordsIntegrationUpdateNoticeTest extends NoticeIntegrationTestCase { - protected $_profil_donnees = ['id_profil' => 150, - 'id' => 150, - 'libelle' => 'Unimarc Nanook plop', - 'accents' => '0', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '1', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:26:{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:0:"";s:8:"zone_995";s:2:"jz";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:4:"g;gm";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:0:"";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:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:2:"xz";}i:10;a:3:{s:4:"code";s:2:"12";s:5:"label";s:0:"";s:8:"zone_995";s:2:"kk";}i:11;a:3:{s:4:"code";s:2:"13";s:5:"label";s:0:"";s:8:"zone_995";s:2:"me";}i:12;a:3:{s:4:"code";s:2:"14";s:5:"label";s:0:"";s:8:"zone_995";s:2:"iz";}i:13;a:3:{s:4:"code";s:2:"15";s:5:"label";s:0:"";s:8:"zone_995";s:2:"mz";}i:14;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:19;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:20;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:21;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:22;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:23;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:24;a:3:{s:4:"code";s:3:"111";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:25;a:3:{s:4:"code";s:3:"110";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:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:1:"7";s:13:"champ_section";s:1:"9";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:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:22:{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:7:"_IDABON";s:0:"";s:10:"_ORDREABON";s:0:"";s:4:"_NOM";s:0:"";s:7:"_PRENOM";s:0:"";s:10:"_NAISSANCE";s:0:"";s:9:"_PASSWORD";s:0:"";s:5:"_MAIL";s:0:"";s:11:"_DATE_DEBUT";s:0:"";s:9:"_DATE_FIN";s:0:"";s:8:"_ID_SIGB";s:0:"";s:10:"_NUM_CARTE";s:0:"";s:5:"_NULL";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:0:"";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}' - ]; - - public function setUp() { - parent::setUp(); - - $profil_donnees_1 = $this->fixture('Class_IntProfilDonnees', [ + protected $_profil_donnees = ['id_profil' => 150, + 'id' => 150, + 'libelle' => 'Unimarc Nanook plop', + 'accents' => '0', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '1', + 'type_fichier' => '0', + 'format' => '0', + 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:26:{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:0:"";s:8:"zone_995";s:2:"jz";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:4:"g;gm";s:8:"zone_995";s:0:"";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:0:"";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:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:2:"xz";}i:10;a:3:{s:4:"code";s:2:"12";s:5:"label";s:0:"";s:8:"zone_995";s:2:"kk";}i:11;a:3:{s:4:"code";s:2:"13";s:5:"label";s:0:"";s:8:"zone_995";s:2:"me";}i:12;a:3:{s:4:"code";s:2:"14";s:5:"label";s:0:"";s:8:"zone_995";s:2:"iz";}i:13;a:3:{s:4:"code";s:2:"15";s:5:"label";s:0:"";s:8:"zone_995";s:2:"mz";}i:14;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:19;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:20;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:21;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:22;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:23;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:24;a:3:{s:4:"code";s:3:"111";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:25;a:3:{s:4:"code";s:3:"110";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:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:1:"7";s:13:"champ_section";s:1:"9";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:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:22:{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:7:"_IDABON";s:0:"";s:10:"_ORDREABON";s:0:"";s:4:"_NOM";s:0:"";s:7:"_PRENOM";s:0:"";s:10:"_NAISSANCE";s:0:"";s:9:"_PASSWORD";s:0:"";s:5:"_MAIL";s:0:"";s:11:"_DATE_DEBUT";s:0:"";s:9:"_DATE_FIN";s:0:"";s:8:"_ID_SIGB";s:0:"";s:10:"_NUM_CARTE";s:0:"";s:5:"_NULL";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:0:"";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}' + ]; + + public function setUp() { + parent::setUp(); + + $profil_donnees_1 = $this->fixture('Class_IntProfilDonnees', [ 'id_profil' => 1, 'id' => 1, 'libelle' => 'Unimarc Standard', @@ -246,184 +246,184 @@ class NanookRecordsIntegrationUpdateNoticeTest extends NoticeIntegrationTestCase 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:26:{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:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:2:"xz";}i:10;a:3:{s:4:"code";s:2:"12";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:2:"13";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:12;a:3:{s:4:"code";s:2:"14";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:13;a:3:{s:4:"code";s:2:"15";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:14;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:19;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:20;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:21;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:22;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:23;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:24;a:3:{s:4:"code";s:3:"111";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:25;a:3:{s:4:"code";s:3:"110";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:14:"champ_type_doc";s:0:"";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:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:22:{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:7:"_IDABON";s:0:"";s:10:"_ORDREABON";s:0:"";s:4:"_NOM";s:0:"";s:7:"_PRENOM";s:0:"";s:10:"_NAISSANCE";s:0:"";s:9:"_PASSWORD";s:0:"";s:5:"_MAIL";s:0:"";s:11:"_DATE_DEBUT";s:0:"";s:9:"_DATE_FIN";s:0:"";s:8:"_ID_SIGB";s:0:"";s:10:"_NUM_CARTE";s:0:"";s:5:"_NULL";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:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}' ]); - $req_profils = 'select * from profil_donnees where id_profil=1'; - $this->_mock_sql - ->whenCalled('fetchEnreg') - ->with($req_profils) - ->answers($profil_donnees_1->getRawAttributes()) - - ->whenCalled('fetchEnreg') - ->with($req_profils, false) - ->answers($profil_donnees_1->getRawAttributes()); - - Class_CosmoVar::newInstanceWithId('types_docs', - ['liste' => "0:non identifié\r\n1:livres\r\n2:périodiques\r\n3:disques\r\n4:DVD\r\n5:cédéroms\r\n8:articles cms\r\n9:fils rss\r\n10:sites internet\r\n15:Liseuse\r\n100:Livre Numérique\r\n101:Diaporamas\r\n102:Type doc\r\n103:OAI\r\n104:Type doc\r\n105:Formation Vodéclic\r\n106:Livres Numériques\r\n107:Vidéos à la demande\r\n108:Tout apprendre\r\n109:Enregistrement audio\r\n110:Numérique Premium"]); - - Class_CosmoVar::newInstanceWithId('nature_docs', - ['liste' => '1:Collection\r\n2:Dataset\r\n3:Event\r\n4:Image']); - } - - /** @test */ - public function noticeLiseuseCybookOdyssey4shouldhaveTypeDocQuoi() { - $this->loadNotice('unimarc_liseuse_cybook_odyssey_4'); - $notice = Class_Notice::find(1); - $this->assertEquals(15, $notice->getTypeDoc()); - - $this->loadNotice('unimarc_liseuse_cybook_odyssey_4'); - $notice = Class_Notice::find(1); - $this->assertEquals(15, $notice->getTypeDoc()); - } + $req_profils = 'select * from profil_donnees where id_profil=1'; + $this->_mock_sql + ->whenCalled('fetchEnreg') + ->with($req_profils) + ->answers($profil_donnees_1->getRawAttributes()) + + ->whenCalled('fetchEnreg') + ->with($req_profils, false) + ->answers($profil_donnees_1->getRawAttributes()); + + Class_CosmoVar::newInstanceWithId('types_docs', + ['liste' => "0:non identifié\r\n1:livres\r\n2:périodiques\r\n3:disques\r\n4:DVD\r\n5:cédéroms\r\n8:articles cms\r\n9:fils rss\r\n10:sites internet\r\n15:Liseuse\r\n100:Livre Numérique\r\n101:Diaporamas\r\n102:Type doc\r\n103:OAI\r\n104:Type doc\r\n105:Formation Vodéclic\r\n106:Livres Numériques\r\n107:Vidéos à la demande\r\n108:Tout apprendre\r\n109:Enregistrement audio\r\n110:Numérique Premium"]); + + Class_CosmoVar::newInstanceWithId('nature_docs', + ['liste' => '1:Collection\r\n2:Dataset\r\n3:Event\r\n4:Image']); + } + + /** @test */ + public function noticeLiseuseCybookOdyssey4shouldhaveTypeDocQuoi() { + $this->loadNotice('unimarc_liseuse_cybook_odyssey_4'); + $notice = Class_Notice::find(1); + $this->assertEquals(15, $notice->getTypeDoc()); + + $this->loadNotice('unimarc_liseuse_cybook_odyssey_4'); + $notice = Class_Notice::find(1); + $this->assertEquals(15, $notice->getTypeDoc()); + } } class NanookRecordsIntegrationPoorNoticeUpdateTest extends NanookRecordsIntegrationTestCase { - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->loadNotice('unimarc_la_route_sombre_poor'); + $this->loadNotice('unimarc_la_route_sombre_poor'); - $this->_mock_sql - ->whenCalled('fetchOne') - ->with("select id_notice from exemplaires where id_int_bib=1 and code_barres='L-038374'") - ->answers(1); + $this->_mock_sql + ->whenCalled('fetchOne') + ->with("select id_notice from exemplaires where id_int_bib=1 and code_barres='L-038374'") + ->answers(1); - $this->loadNotice('unimarc_la_route_sombre'); - } + $this->loadNotice('unimarc_la_route_sombre'); + } - /** @test */ - public function recordShouldBeUpdatedAndHaveAnISBN() { - $record = Class_Notice::find(1); - $this->assertEquals('978-2-08-130888-6', $record->getIsbn()); - } + /** @test */ + public function recordShouldBeUpdatedAndHaveAnISBN() { + $record = Class_Notice::find(1); + $this->assertEquals('978-2-08-130888-6', $record->getIsbn()); + } } class NanookRecordsIntegrationLeChatonDansLaSouriciereTest extends NanookRecordsIntegrationTestCase { - public function setUp() { - parent::setUp(); - $this->loadNotice('unimarc_un_chaton_dans_la_souriciere'); - $this->_notice = Class_Notice::find(1); - } + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_un_chaton_dans_la_souriciere'); + $this->_notice = Class_Notice::find(1); + } - /** @test */ - public function titleShouldBeChatonDansLaSouriciere() { - $this->assertEquals('Un Chaton dans la souricière - (pastille verte) policier', - $this->_notice->getTitrePrincipal()); - } + /** @test */ + public function titleShouldBeChatonDansLaSouriciere() { + $this->assertEquals('Un Chaton dans la souricière - (pastille verte) policier', + $this->_notice->getTitrePrincipal()); + } - /** @test */ - public function tomeAlphaShouldBeSix() { - $this->assertEquals('6', $this->_notice->getTomeAlpha()); - } + /** @test */ + public function tomeAlphaShouldBeSix() { + $this->assertEquals('6', $this->_notice->getTomeAlpha()); + } - /** @test */ - public function collectionShouldBeMiniSourisNoire() { - $this->assertEquals('Mini souris noire', $this->_notice->getCollections()[0]); - } + /** @test */ + public function collectionShouldBeMiniSourisNoire() { + $this->assertEquals('Mini souris noire', $this->_notice->getCollections()[0]); + } - /** @test */ - public function noticeShouldNotHaveTomes() { - $this->assertEquals([],$this->_notice->getNoticesMemeSeries()); - } + /** @test */ + public function noticeShouldNotHaveTomes() { + $this->assertEquals([],$this->_notice->getNoticesMemeSeries()); + } /** @test */ - public function clefChapeauShouldBeMiniSourisNoire() { - $this->assertEquals('MINI SOURIS NOIRE', $this->_notice->getClefChapeau()); - } + public function clefChapeauShouldBeMiniSourisNoire() { + $this->assertEquals('MINI SOURIS NOIRE', $this->_notice->getClefChapeau()); + } } class NanookRecordsIntegrationOblivionTest extends NanookRecordsIntegrationTestCase { - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->fixture('Class_CodifCentreInteret', - ['id' => 24, - 'code_alpha' => 'SF FANTASTIQUE FANTASY', - 'libelle' => 'SF']); + $this->fixture('Class_CodifCentreInteret', + ['id' => 24, + 'code_alpha' => 'SF FANTASTIQUE FANTASY', + 'libelle' => 'SF']); - $this->fixture('Class_CodifGenre', - ['id' => 96, - 'libelle' => 'Film', - 'regles' => '995$7=15']); + $this->fixture('Class_CodifGenre', + ['id' => 96, + 'libelle' => 'Film', + 'regles' => '995$7=15']); - $this->loadNotice('unimarc_oblivion'); + $this->loadNotice('unimarc_oblivion'); - Class_Notice::find(1) - ->setFacettes('T1 Z3 G23 Z5') - ->save(); + Class_Notice::find(1) + ->setFacettes('T1 Z3 G23 Z5') + ->save(); - $this->loadNotice('unimarc_oblivion'); + $this->loadNotice('unimarc_oblivion'); - $this->_notice = Class_Notice::find(1); - } + $this->_notice = Class_Notice::find(1); + } - /** @test */ - public function titleShouldBeOblivion() { - $this->assertEquals('Oblivion', $this->_notice->getTitrePrincipal()); - } + /** @test */ + public function titleShouldBeOblivion() { + $this->assertEquals('Oblivion', $this->_notice->getTitrePrincipal()); + } - /** @test */ - public function firstInterestShouldBeSF() { - $this->assertEquals('SF / Fantastique / Fantasy', $this->_notice->getCentreInteret()[0]); - } + /** @test */ + public function firstInterestShouldBeSF() { + $this->assertEquals('SF / Fantastique / Fantasy', $this->_notice->getCentreInteret()[0]); + } - /** @test */ - public function secondInterestShouldBeAction() { - $this->assertEquals('Action', $this->_notice->getCentreInteret()[1]); - } + /** @test */ + public function secondInterestShouldBeAction() { + $this->assertEquals('Action', $this->_notice->getCentreInteret()[1]); + } - /** @test */ - public function codifCentreInteretId25LibelleShouldBeAction() { - $this->assertEquals('Action', Class_CodifCentreInteret::find(25)->getLibelle()); - } + /** @test */ + public function codifCentreInteretId25LibelleShouldBeAction() { + $this->assertEquals('Action', Class_CodifCentreInteret::find(25)->getLibelle()); + } - /** @test */ - public function genreShouldBeFilm() { - $genre = $this->_notice->getGenres()[0]; - $this->assertEquals('Film', $genre->getLibelle()); - } + /** @test */ + public function genreShouldBeFilm() { + $genre = $this->_notice->getGenres()[0]; + $this->assertEquals('Film', $genre->getLibelle()); + } - /** @test */ - public function facettesShouldContainsF2andF24() { - $this->assertEquals('T4 A1 F24 F25 Lfre G96', $this->_notice->getFacettes()); - } + /** @test */ + public function facettesShouldContainsF2andF24() { + $this->assertEquals('T4 A1 F24 F25 Lfre G96', $this->_notice->getFacettes()); + } } class NanookRecordsIntegrationSerialTopSanteTest extends NanookRecordsIntegrationTestCase { - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); $this->loadRecordsFromFile("unimarc_top_sante"); - $this->notice = Class_Notice::find(1); - } + $this->notice = Class_Notice::find(1); + } - /** @test */ - public function mainTitleShouldBeTopSante() { - $this->assertContains('Top Santé n° 295 - Avril 2015', $this->notice->getTitrePrincipal()); - } + /** @test */ + public function mainTitleShouldBeTopSante() { + $this->assertContains('Top Santé n° 295 - Avril 2015', $this->notice->getTitrePrincipal()); + } - /** @test */ - public function noticeShouldHaveFiveArticles() { - $this->assertCount(5, $this->notice->getArticlesPeriodique()); - } + /** @test */ + public function noticeShouldHaveFiveArticles() { + $this->assertCount(5, $this->notice->getArticlesPeriodique()); + } } @@ -587,4 +587,144 @@ class NanookRecordsIntegrationMultiClassificationTest extends NanookRecordsInteg 'id_origine' => 'A302', 'libelle' => 'JEU D\'AGENCEMENT'])); } +} + + + +/** @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)); + } } \ No newline at end of file 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/library/Class/CodifThesaurus.php b/library/Class/CodifThesaurus.php index 6d148193a5463d56644699c96a5a12fba334c089..5ae11f6b3c912e06d44b07719005f15ac6dba0b2 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/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/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']); } - } - - - -?>