diff --git a/cosmogramme/tests/php/classes/CarthameIntegrationTest.php b/cosmogramme/tests/php/classes/CarthameIntegrationTest.php index 6e41201b134b4de421e5024d088c5020e3488fdb..87791e647dd26aa51cd895ccc94b9346c04cfef9 100644 --- a/cosmogramme/tests/php/classes/CarthameIntegrationTest.php +++ b/cosmogramme/tests/php/classes/CarthameIntegrationTest.php @@ -22,75 +22,75 @@ require_once 'NoticeIntegrationTest.php'; abstract class CarthameIntegrationTestCase extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - $vars = ['filtrer_fulltext' => 1, - 'homogene_code_qualite' => 10, - 'homogene' => 0, - 'mode_doublon'=> 0, - 'tracer_accents_iso'=> 1, - 'non_exportable'=> 'electre;decitre;gam;zebris', - 'controle_codes_barres'=> 0, - 'unimarc_zone_titre' => '200$a;461$t', - 'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY, - 'champs_sup' => '', - 'ean_345' => '']; - foreach($vars as $key => $value) - Class_CosmoVar::newInstanceWithId($key, ['valeur' => $value]); - } - - - public function getProfilDonnees() { - return - ['id_profil' => 106, - 'libelle' => 'Carthame', - 'accents' => Class_IntProfilDonnees::ENCODING_ISO2709, - 'rejet_periodiques' => '1', - 'id_article_periodique' => Class_IntProfilDonnees::SERIAL_FORMAT_NONE, - 'type_fichier' => Class_IntProfilDonnees::FT_RECORDS, - 'format' => Class_IntProfilDonnees::FORMAT_UNIMARC, - 'attributs' => serialize( - [ [ - 'type_doc' => [ - [ 'code' => '0', 'label' => '', 'zone_995' => '' ], - [ 'code' => '1', 'label' => 'am;na', 'zone_995' => 'au;ku' ], - [ 'code' => '2', 'label' => '', 'zone_995' => ''], - [ 'code' => '3', 'label' => 'i;j', 'zone_995' => 'je;jd'], - [ 'code' => '4', 'label' => 'g','zone_995' => 'g'], - [ 'code' => '5', 'label' => 'l;m', 'zone_995' => 'le'], - [ 'code' => '6', 'label' => 'f;k', 'zone_995' => 'f;k'], - [ 'code' => '10', 'label' => '', 'zone_995' => 'uu'], - ], - 'champ_code_barres' => 'f', - 'champ_cote' => 'k', - 'champ_type_doc' => '', - 'champ_genre' => '', - 'champ_section' => '', - 'champ_emplacement' => '', - 'champ_annexe' => '' - ], - - [ 'champs' => ''], - [ 'champs' => ''], - [ 'champs' => ''], - [ 'champs' => ''], - [ 'zone' => '995', 'champ' => '', 'format' => '', 'jours' => '', 'valeurs' => ''] - ])]; - } + public function setUp() { + parent::setUp(); + $vars = ['filtrer_fulltext' => 1, + 'homogene_code_qualite' => 10, + 'homogene' => 0, + 'mode_doublon'=> 0, + 'tracer_accents_iso'=> 1, + 'non_exportable'=> 'electre;decitre;gam;zebris', + 'controle_codes_barres'=> 0, + 'unimarc_zone_titre' => '200$a;461$t', + 'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY, + 'champs_sup' => '', + 'ean_345' => '']; + foreach($vars as $key => $value) + Class_CosmoVar::newInstanceWithId($key, ['valeur' => $value]); + } + + + public function getProfilDonnees() { + return + ['id_profil' => 106, + 'libelle' => 'Carthame', + 'accents' => Class_IntProfilDonnees::ENCODING_ISO2709, + 'rejet_periodiques' => '1', + 'id_article_periodique' => Class_IntProfilDonnees::SERIAL_FORMAT_NONE, + 'type_fichier' => Class_IntProfilDonnees::FT_RECORDS, + 'format' => Class_IntProfilDonnees::FORMAT_UNIMARC, + 'attributs' => serialize( + [ [ + 'type_doc' => [ + [ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;na', 'zone_995' => 'au;ku' ], + [ 'code' => '2', 'label' => '', 'zone_995' => ''], + [ 'code' => '3', 'label' => 'i;j', 'zone_995' => 'je;jd'], + [ 'code' => '4', 'label' => 'g','zone_995' => 'g'], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => 'le'], + [ 'code' => '6', 'label' => 'f;k', 'zone_995' => 'f;k'], + [ 'code' => '10', 'label' => '', 'zone_995' => 'uu'], + ], + 'champ_code_barres' => 'f', + 'champ_cote' => 'k', + 'champ_type_doc' => '', + 'champ_genre' => '', + 'champ_section' => '', + 'champ_emplacement' => '', + 'champ_annexe' => '' + ], + + [ 'champs' => ''], + [ 'champs' => ''], + [ 'champs' => ''], + [ 'champs' => ''], + [ 'zone' => '995', 'champ' => '', 'format' => '', 'jours' => '', 'valeurs' => ''] + ])]; + } } class TangoMangoCarthameIntegrationTest extends CarthameIntegrationTestCase { - protected $_notice; + protected $_notice; - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); Class_CosmoVar::setValueOf('url_services', 'https://websvc.afi-sa.net/afi_opac_services/main.php'); - $this->fixture(Class_Notice::class, + $this->fixture(Class_Notice::class, ['id' => 7939934, 'type_doc' => 1, 'facettes' => 'Lfre G3 T1 B7 B2 V2 2015-09', @@ -103,38 +103,55 @@ class TangoMangoCarthameIntegrationTest extends CarthameIntegrationTestCase { 'date_creation' => '2015-09-08 00:00:00', 'date_maj' => '2015-03-13 02:00:12', 'unimarc' => '01041cam0 2200289 450 001002100000003004700021010003900068020001700107021002700124073001800151100004100169101000800210102000700218105001800225106000600243200000500249210000100254215000100255225000100256300000100257330048800258461000100746686000100747700000100748801000100749930000100750FRBNF437016350000001http://catalogue.bnf.fr/ark:/12148/cb43701635n a978-2-35910-416-5brel.d12,90 EUR aFRb01364260 aFRbDLE-20131029-62048 0a9782359104165 a20131029d2013 m y0frey50 ba0 afre aFR a||||t 00|a| ar1 aaaAn 982, alors qu\' Elaine et Encre Noire continuent de réparer leur bateau, un évènement inattendu bouleverse les Eaux Tièdes : le retour de la Gazette du Pirate !aLa Gazette du pirate annonce le retour du grand tournoi, le rendez-vous incontournable des écumeurs des mers. Encre Noire et Elaine décident de voler des trésors et d\'amasser de l\'argent pour acheter un nouveau gouvernail afin de mettre toutes les chances de leur côté pour remporter l\'épreuve. ÂElectre 2015']); - } + } - /** @test */ - public function importFromFileShouldNotCreateAnOtherRecord() { - $this->loadNotice('unimarc_tangomango'); - $notice = Class_Notice::find(7939934); - $this->assertCount(1, Class_Notice::findAll()); - return $notice; - } + /** @test */ + public function importFromFileShouldNotCreateAnOtherRecord() { + $this->loadNotice('unimarc_tangomango'); + $notice = Class_Notice::find(7939934); + $this->assertCount(1, Class_Notice::findAll()); + return $notice; + } - /** - * @depends importFromFileShouldNotCreateAnOtherRecord - * @test - * */ - public function importFromFileShouldUpdateNotice($notice) { - $this->assertEquals('TangoMango n° 2<br />La Gazette du pirate', $notice->getTitrePrincipal()); - } + /** + * @depends importFromFileShouldNotCreateAnOtherRecord + * @test + * */ + public function importFromFileShouldUpdateNotice($notice) { + $this->assertEquals('TangoMango n° 2<br />La Gazette du pirate', $notice->getTitrePrincipal()); + } - /** + /** * @test * @group real_network_call */ - public function homogenizeShouldUpdateNotice() { - $notice = Class_Notice::find(7939934); - $notice_integration = new notice_integration(); - $notice_integration->traiteHomogene($notice); - - Class_Notice::clearCache(); - $notice = Class_Notice::find(7939934); - $this->assertEquals('Tangomango n° 2<br />La gazette du pirate', $notice->getTitrePrincipal()); - } + public function homogenizeShouldUpdateNotice() { + $notice = Class_Notice::find(7939934); + $notice_integration = new notice_integration(); + $notice_integration->traiteHomogene($notice); + + Class_Notice::clearCache(); + $notice = Class_Notice::find(7939934); + $this->assertEquals('Tangomango n° 2<br />La gazette du pirate', $notice->getTitrePrincipal()); + } +} + + + + +class CarthameIntegrationPelleasMelissandeWithMultiple200DollarATest extends CarthameIntegrationTestCase { + public function setUp() { + parent::setUp(); + $this->loadRecordsFromFile("unimarc_pelleas"); + } + + + /** @test */ + public function alphaKeyShouldBePELLEASETMELISANDEMELODIESPELLEASETMELISANDEEXTRAIT__DEBUSSYC__EMI_1942_3() { + $this->assertEquals('PELLEASETMELISANDEMELODIESPELLEASETMELISANDEEXTRAIT--DEBUSSYC--EMI-1942-3', + Class_Notice::find(1)->getClefAlpha()); + } } diff --git a/cosmogramme/tests/php/classes/unimarc_pelleas.txt b/cosmogramme/tests/php/classes/unimarc_pelleas.txt new file mode 100644 index 0000000000000000000000000000000000000000..b775840e446507ae7535a0758e7338b4ee235924 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_pelleas.txt @@ -0,0 +1,3 @@ +01303cjm0 22003132 450 001000700000005001700007073001700024100004100041200031800082210001900400215001600419300005100435686001600486690001100502701005700513701003200570701003200602701003400634701003300668711004100701701003500742701002900777701005700806801002100863801002300884801002300907951001600930995004300946I1689720140212153723.0 a077776103822 a19970117d1942 u0frey0103 ba11aPellÂeas et MÂelisandeaMÂelodiesaPellÂeas et MÂelisande, extraitfcomposÂe par Claude DebussygIrÁene Joachim , sopranogJacques Jansen et Henri Etcheverry , barytongGermaine Cernay , mezzo-sopranogChoeurs Yvonne GouvernÂe , choeurgdirigÂe par Roger DesormiÁeregMary Garden , sopranogClaude Debussy , piano 3271cEMId1942 a3 cd.e3 cd adisc 1 : 57'31 +disc 2 : 69'42 +disc 3 : 68'21 3114860a3.3 3341a3 3124390aDebussybClaudecCompositeurf1862-19184230 316647aJoachimbIrÁene4590 316646aJansenbJacques4590 318310aEtcheverrybHenri4590 318311aCernaybGermaine459002318312aChoeurs Yvonne GouvernÂe4590 318314aDesormiÁerebRoger4300 318316aGardenbMary4590 3124390aDebussybClaudecCompositeurf1862-19184590 1bOrigine inconnue 2aFRbCCTCc20140212 3aFRbCCTCc20140820 aDKb ** c1 aCCTCf012771k335 DEBopqurjuyThann \ No newline at end of file