From bf9001c248393a123a20aa821905511420b3a46b Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.pergame.net>
Date: Wed, 2 Sep 2015 16:52:20 +0200
Subject: [PATCH] #26993 fix serials merge integration

---
 .../php/classes/classe_notice_integration.php |  24 +-
 .../classes/NanookRecordsIntegrationTest.php  | 484 ++++++++++++++++++
 .../php/classes/NoticeIntegrationTest.php     | 441 +---------------
 .../php/classes/unimarc_droit_famille.txt     |   1 +
 4 files changed, 510 insertions(+), 440 deletions(-)
 create mode 100644 cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php
 create mode 100644 cosmogramme/tests/php/classes/unimarc_droit_famille.txt

diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php
index cc2dd99cefc..2eab845fcc8 100644
--- a/cosmogramme/php/classes/classe_notice_integration.php
+++ b/cosmogramme/php/classes/classe_notice_integration.php
@@ -948,14 +948,17 @@ class notice_integration {
 			return;
 		}
 
+    $titre_principal = $this->notice['titre_princ'];
+    $clef_titre = hash('crc32b', $titre_principal);
+
 		// constitution enregistrement
 		$enreg["clef_chapeau"]=$clef_chapeau;
 		$enreg["clef_numero"]=$clef_numero;
-		$enreg["clef_article"]=$clef_article;
-		$enreg["clef_unimarc"]=$clef_unimarc;
+		$enreg["clef_unimarc"] = $clef_unimarc ? $clef_unimarc : $clef_titre;
 		$enreg["unimarc"]=$this->notice["unimarc"];
 		$enreg["date_maj"]=dateDuJour(0);
 		$enreg["qualite"]=$this->qualite_bib;
+		$enreg["clef_article"] = $clef_article;
 
 		// cherche la notice
 		if($clef_unimarc)	{
@@ -964,12 +967,17 @@ class notice_integration {
 				$enreg["clef_numero"] = $article->getClefNumero();
 			}
 		}
-		else
-			$article = Class_Notice_SerialArticles::findFirstBy(['clef_chapeau' => $clef_chapeau,
-																													 'clef_numero' => $clef_numero,
-																													 'clef_article' => $clef_article]);
-
-		// ecrire
+		else {
+			if(!$article = Class_Notice_SerialArticles::findFirstBy(['clef_chapeau' => $clef_chapeau,
+                                                               'clef_numero' => $clef_numero,
+                                                               'clef_unimarc' => $clef_titre]))
+        $article = Class_Notice_SerialArticles::findFirstBy(['clef_chapeau' => $clef_chapeau,
+                                                             'clef_numero' => $clef_numero,
+                                                             'clef_article' => $clef_article,
+                                                             'clef_unimarc' => '']);
+    }
+
+    // ecrire
 		if($article)
 		{
 			// remplacer si qualite superieure ou egale
diff --git a/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php
new file mode 100644
index 00000000000..325a27b8c42
--- /dev/null
+++ b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php
@@ -0,0 +1,484 @@
+<?php
+/**
+ * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
+ * the Free Software Foundation.
+ *
+ * There are special exceptions to the terms and conditions of the AGPL as it
+ * is applied to this software (see README file).
+ *
+ * BOKEH is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * along with BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+
+require_once('NoticeIntegrationTest.php');
+
+abstract class NanookRecordsIntegrationTestCase extends NoticeIntegrationTestCase {
+	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();
+
+		/*
+		 * 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 secondItemShouldBeAvailable() {
+		$this->assertTrue(Class_Exemplaire::find(2)->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());
+	}
+}
+
+
+
+/** @see http://forge.afi-sa.fr/issues/16358 */
+class NanookRecordsIntegrationSymphonieTest extends NanookRecordsIntegrationTestCase {
+	public function getProfilDonnees() {
+		$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
+		return $profil->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());
+
+
+    $this->loadNotice('unimarc_symphonie');
+	}
+
+
+	/** @test */
+	public function degreeShouldStayUTF8Degree() {
+		$this->assertContains('n°', Class_Notice::find(1)->get_subfield(464, 't')[0]);
+	}
+}
+
+
+
+/** @see http://forge.afi-sa.fr/issues/16628 */
+class NanookRecordsIntegrationInterestEsperluetteTest extends NanookRecordsIntegrationTestCase {
+	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('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());
+	}
+}
+
+
+
+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', [
+                                                                  'id_profil' => 1,
+                                                                  'id' => 1,
+                                                                  'libelle' => 'Unimarc Standard',
+                                                                  'accents' => '1',
+                                                                  'rejet_periodiques' =>  '1',
+                                                                  'id_article_periodique' => '0',
+                                                                  '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: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());
+	}
+}
+
+
+
+class NanookRecordsIntegrationPoorNoticeUpdateTest extends NanookRecordsIntegrationTestCase {
+	public function setUp() {
+		parent::setUp();
+
+		$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->loadNotice('unimarc_la_route_sombre');
+	}
+
+	/** @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);
+	}
+
+
+	/** @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 collectionShouldBeMiniSourisNoire() {
+		$this->assertEquals('Mini souris noire', $this->_notice->getCollections()[0]);
+	}
+
+
+	/** @test */
+	public function noticeShouldNotHaveTomes() {
+		$this->assertEquals([],$this->_notice->getNoticesMemeSeries());
+	}
+
+  /** @test */
+	public function clefChapeauShouldBeMiniSourisNoire() {
+		$this->assertEquals('MINI SOURIS NOIRE', $this->_notice->getClefChapeau());
+	}
+}
+
+
+
+
+class NanookRecordsIntegrationOblivionTest extends NanookRecordsIntegrationTestCase {
+	public function setUp() {
+		parent::setUp();
+
+		$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->loadNotice('unimarc_oblivion');
+
+		Class_Notice::find(1)
+			->setFacettes('T1 Z3 G23 Z5')
+			->save();
+
+		$this->loadNotice('unimarc_oblivion');
+
+		$this->_notice = Class_Notice::find(1);
+	}
+
+
+	/** @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 secondInterestShouldBeAction() {
+		$this->assertEquals('Action', $this->_notice->getCentreInteret()[1]);
+	}
+
+
+	/** @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 facettesShouldContainsF2andF24() {
+		$this->assertEquals('T4 A1 F24 F25 Lfre G96', $this->_notice->getFacettes());
+	}
+}
+
+
+
+class NanookRecordsIntegrationSerialTopSanteTest extends NanookRecordsIntegrationTestCase {
+	public function setUp() {
+		parent::setUp();
+    $this->loadRecordsFromFile("unimarc_top_sante");
+		$this->notice = Class_Notice::find(1);
+	}
+
+
+	/** @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());
+	}
+}
+
+
+
+class NanookRecordsIntegrationSerialDroitDeVivreEnFamilleTest extends NanookRecordsIntegrationTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    $this->fixture('Class_Notice_SerialArticles',
+                   ['id' => 1,
+                    'clef_chapeau' => 'DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE',
+                    'clef_numero' => '11',
+                    'clef_article' => 'FRANCE   LE POINT DE',
+                    'clef_unimarc' => '']);
+
+    $this->fixture('Class_Notice_SerialArticles',
+                   ['id' => 1,
+                    'clef_chapeau' => 'DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE',
+                    'clef_numero' => '11',
+                    'clef_article' => 'AVANT LA SESSION',
+                    'clef_unimarc' => '3881b668']);
+
+    $this->loadRecordsFromFile("unimarc_droit_famille");
+
+    $this->notice = Class_Notice::find(1);
+  }
+
+
+  public function expectedArticles() {
+    return [
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'INTRODUCTION', 'ed318fdc'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'AVANT LA SESSION', '3881b668'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'DROIT DE VIVRE EN FA', '413fd1a5'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'IL NE FAUT JAMAIS BA', '526a451f'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'S IL TE PLAIT  NE M ', '494a0239'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'FRANCE   LE POINT DE', 'c8fb7aea'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'AIDE SOCIALE A L ENF', 'b9d85f15'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'BELGIQUE   LA COMMUN', 'e1807e46'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'GRANDE BRETAGNE   VE', 'ebfe3c09'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'FRANCE   UN RAPPORT ', '5d86c571'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'GRANDE BRETAGNE   LE', '88f30ace'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'TROIS REQUETES SOUTE', '511ba1fe'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'JUGE A LA COUR EUROP', 'd46508c0'],
+            ['DOSSIERS ET DOCUMENTS DE LA REVUE QUART MONDE', '11', 'DROIT DE VIVRE EN FA', '5119b42f']];
+  }
+
+
+  /** @test */
+  public function recordDroitFamilleShouldContains14Articles() {
+    $this->assertCount(14, $this->notice->getArticlesPeriodique());
+  }
+
+
+  /** @test */
+  public function databaseShouldContainsOnly14Articles() {
+    $this->assertCount(14, Class_Notice_SerialArticles::findAll());
+  }
+
+
+  /**
+   * @test
+   * @dataProvider expectedArticles
+   */
+  public function droitFamilleArticlesShouldBePresent($clef_chapeau, $clef_numero, $clef_article, $clef_unimarc) {
+    $this->assertNotNull(Class_Notice_SerialArticles::findFirstBy(['clef_chapeau' => $clef_chapeau,
+                                                                   'clef_numero' => $clef_numero,
+                                                                   'clef_article' => $clef_article,
+                                                                   'clef_unimarc' => $clef_unimarc]));
+  }
+}
diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php
index e0d2510f376..92eb1b8a2ee 100644
--- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php
+++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php
@@ -144,6 +144,15 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase {
 		$this->notice_integration->traiteFacettes();
 		$this->notice_data = $this->notice_integration->getNotice();
 	}
+
+
+  public function loadRecordsFromFile($filename) {
+    $contents = file_get_contents(dirname(__FILE__) . "/" . $filename . '.txt');
+
+		array_map([$this, 'loadNoticeFromString'],
+							preg_split('/'.chr(30).chr(29).'/', $contents));
+
+  }
 }
 
 
@@ -1556,254 +1565,6 @@ class NoticeIntegrationConcertoSaintSaensTest extends NoticeIntegrationTestCase
 
 
 
-/** @see http://forge.afi-sa.fr/issues/13769 */
-class NoticeIntegrationAvailabilityFacetTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		return Class_IntProfilDonnees::forNanook()
-			->setIdProfil(110)
-			->setAvailabilityField('v')
-			->getRawAttributes();
-	}
-
-
-	public function setUp() {
-		parent::setUp();
-
-		/*
-		 * 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 secondItemShouldBeAvailable() {
-		$this->assertTrue(Class_Exemplaire::find(2)->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());
-	}
-}
-
-
-
-/** @see http://forge.afi-sa.fr/issues/16358 */
-class NoticeIntegrationSymphonieTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
-		return $profil->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());
-
-
-			$this->loadNotice('unimarc_symphonie');
-	}
-
-
-	/** @test */
-	public function degreeShouldStayUTF8Degree() {
-		$this->assertContains('n°', Class_Notice::find(1)->get_subfield(464, 't')[0]);
-	}
-}
-
-
-
-
-/** @see http://forge.afi-sa.fr/issues/16628 */
-class NoticeIntegrationInterestEsperluetteTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
-		return $profil->getRawAttributes();
-	}
-
-
-	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('ESPERLUETTE ESPERLUET 2014', $this->notice->getDewey());
-	}
-}
-
-
-
-class NoticeIntegrationAuxAnimauxLaGuerreTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
-		return $profil->getRawAttributes();
-	}
-
-
-	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 NoticeIntegrationUpdateNoticeTest 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', [
-			'id_profil' => 1,
-			'id' => 1,
-			'libelle' => 'Unimarc Standard',
-			'accents' => '1',
-			'rejet_periodiques' =>  '1',
-			'id_article_periodique' => '0',
-			'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: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());
-	}
-}
-
-
-
 class NoticeIntegration11septembre2001Test extends NoticeIntegrationTestCase {
 	public function getProfilDonnees() {
 		return Class_IntProfilDonnees::forALOES()
@@ -2051,156 +1812,6 @@ class NoticeIntegrationAloesTest extends NoticeIntegrationTestCase {
 
 
 
-
-class NoticeIntegrationPoorNoticeUpdateTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		return Class_IntProfilDonnees::forNanook()
-			->setIdProfil(111)
-			->getRawAttributes();
-	}
-
-	public function setUp() {
-		parent::setUp();
-
-		$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->loadNotice('unimarc_la_route_sombre');
-	}
-
-	/** @test */
-	public function recordShouldBeUpdatedAndHaveAnISBN() {
-		$record = Class_Notice::find(1);
-		$this->assertEquals('978-2-08-130888-6', $record->getIsbn());
-	}
-}
-
-
-
-
-class NoticeIntegrationLeChatonDansLaSouriciereTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
-		return $profil->getRawAttributes();
-	}
-
-
-	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 tomeAlphaShouldBeSix() {
-		$this->assertEquals('6', $this->_notice->getTomeAlpha());
-	}
-
-
-	/** @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 clefChapeauShouldBeMiniSourisNoire() {
-		$this->assertEquals('MINI SOURIS NOIRE', $this->_notice->getClefChapeau());
-	}
-}
-
-
-
-
-class NoticeIntegrationOblivionTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		return Class_IntProfilDonnees::forNanook()
-			->setIdProfil(110)
-			->getRawAttributes();
-	}
-
-
-	public function setUp() {
-		parent::setUp();
-
-		$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->loadNotice('unimarc_oblivion');
-
-		Class_Notice::find(1)
-			->setFacettes('T1 Z3 G23 Z5')
-			->save();
-
-		$this->loadNotice('unimarc_oblivion');
-
-		$this->_notice = Class_Notice::find(1);
-	}
-
-
-	/** @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 secondInterestShouldBeAction() {
-		$this->assertEquals('Action', $this->_notice->getCentreInteret()[1]);
-	}
-
-
-	/** @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 facettesShouldContainsF2andF24() {
-		$this->assertEquals('T4 A1 F24 F25 Lfre G96', $this->_notice->getFacettes());
-	}
-}
-
-
-
-
 class NoticeIntegrationPommeDeReinetteTest extends NoticeIntegrationTestCase {
 	protected $_profil_donnees = ['id_profil' => 111,
 																'id' => 111,
@@ -2279,40 +1890,6 @@ class NoticeIntegrationNoNoticeTest extends NoticeIntegrationTestCase {
 
 
 
-
-class NoticeIntegrationSerialTopSanteTest extends NoticeIntegrationTestCase {
-	public function getProfilDonnees() {
-		$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
-		return $profil->getRawAttributes();
-	}
-
-
-	public function setUp() {
-		parent::setUp();
-
-		$contents = file_get_contents(dirname(__FILE__)."/unimarc_top_sante.txt");
-
-		array_map([$this, 'loadNoticeFromString'],
-							preg_split('/'.chr(30).chr(29).'/', $contents));
-
-		$this->notice = Class_Notice::find(1);
-	}
-
-
-	/** @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());
-	}
-}
-
-
-
 class NoticeIntegrationAloesSerialIndexpressBellesHistoireTest extends NoticeIntegrationTestCase {
 	public function getProfilDonnees() {
 		return Class_IntProfilDonnees::forALOES()
diff --git a/cosmogramme/tests/php/classes/unimarc_droit_famille.txt b/cosmogramme/tests/php/classes/unimarc_droit_famille.txt
new file mode 100644
index 00000000000..acda5722238
--- /dev/null
+++ b/cosmogramme/tests/php/classes/unimarc_droit_famille.txt
@@ -0,0 +1 @@
+03003nas2 2200217   450 0010005000000100018000051000013000232000110000362100041001462150018001873302013002054100057022184610059022757000020023348010017023549320012023719930014023839950150023979950119025479950119026661256  a2-913046-24-X  a201505221 aLe droit de vivre en familleeDialogue entre professionnels et familles en situation de grande pauvreté.  a[Paris]cÉditions Quart Monded2003  d30 cma248 p.  aActes de la session "Justice et Quart Monde", des 4 et 5 mai 2001, organisée à l'initiative du Mouvement ATD Quart Monde, entre professionnels de la protection de l'enfance et des parents en situation de grande pauvreté dont les enfants sont placés.Tous les parents ont les mêmes aspirations, mais les conditions de vie des plus pauvres les empêchent le plus souvent de bâtir le projet familial dont ils rêvent. Beaucoup vivent dans la crainte du placement de leurs enfants. Avec eux, le Mouvement ATD Quart Monde s'efforce de trouver les moyens de rendre effectif le droit de vivre en famille, rejoignant en cela les préoccupations de nombreux professionnels.  " Le placement n'intervient-il que quand toutes les solutions moins traumatisantes ont été recherchées et essayées ? Les solutions existantes sont-elles suffisamment nombreuses et diversifiées pour faire face aux difficultés que rencontrent les familles ? Quand le placement a lieu, tous les efforts sont-ils faits pour y mettre fin ? Comment faire évoluer les procédures pour associer les parents et faire entendre leur point de vue dans les décisions concernant leurs enfants ? Comment la question du droit de vivre en famille est-elle prise en compte en Belgique, en Grande-Bretagne et en France ? Quelle est la contribution de la Cour européenne des droits de l'homme ? "  Telles sont quelques unes des questions ayant nourri les débats qui ont eu lieu les 4 et 5 mai 2001, à l'initiative du Mouvement ATD Quart Monde, entre des professionnels de la protection de l'enfance et des parents en situation de grande pauvreté dont les enfants sont placés. Venant de France, de Belgique, de Grande-Bretagne, de Suisse et du Luxembourg, ils se sont rencontrés à l'Ecole nationale de la magistrature à Paris, pour échanger leur expérience.  Cette démarche exceptionnelle de dialogue et de réflexion commune, et les apports qui en résultent, ne peuvent que susciter un nouveau regard et inspirer des pratiques nouvelles. 0tDossiers et documents de la Revue Quart Monde n° 11  tDossiers et documents de la revue Quart Mondev110830 1aATD Quart Monde 2aFrc20150902  aFamille  43aAdulte  aATD MontreuilfATD1-00821kPc 2003 01Cm20150902qurpzppocv12[CSP][A consulter sur place][0][0][A consulter sur place][0][0][1][0]7108193  aATD MontreuilfATD1-00822kPc 2003 01P1m20150902qurpzppopv12[DIS][Disponible][0][1][][0][0][0][0]7108193  aATD MontreuilfATD1-00823kPc 2003 01P2m20150902qurpzppopv12[DIS][Disponible][0][1][][0][0][0][0]710819300176naa2 2200073   450 00100050000020000170000546100540002270000260007612601 aIntroduction  tDossiers et documents de la revue Quart Mondev11 1aMarie-Cécile Renoux00177naa2 2200073   450 00100050000020000210000546100540002670000230008012621 aAvant la session  tDossiers et documents de la revue Quart Mondev11 1aBrigitte Bourcier00191naa2 2200073   450 00100050000020000330000546100540003870000250009212591 aLe droit de vivre en famille  tDossiers et documents de la revue Quart Mondev11 1aGeorges De Kerchove00194naa2 2200073   450 00100050000020000390000546100540004470000220009812611 aIl ne faut jamais baisser les bras  tDossiers et documents de la revue Quart Mondev11 1aPauline Mulligan00182naa2 2200073   450 00100050000020000340000546100540003970000150009312651 aS'il te plaît, ne m'aide pas  tDossiers et documents de la revue Quart Mondev11 1aGuy Hardy00208naa2 2200073   450 00100050000020000530000546100540005870000220011212641 aFrance : le point de vue d’un juge des enfants  tDossiers et documents de la revue Quart Mondev11 1aMarcel Klajnberg00232naa2 2200073   450 00100050000020000690000546100540007470000300012812691 aAide sociale à l’enfance : une charte éthique à la Réunion  tDossiers et documents de la revue Quart Mondev11 1aGisèle Contrain Etrayen00223naa2 2200073   450 00100050000020000590000546100540006470000310011812581 aBelgique : La Communauté française et les placements  tDossiers et documents de la revue Quart Mondev11 1aDanièle Delatte Gévaert00217naa2 2200073   450 00100050000020000640000546100540006970000200012312571 aGrande Bretagne : vers une réelle implication des familles  tDossiers et documents de la revue Quart Mondev11 1aRob Hutchinson00212naa2 2200073   450 00100050000020000420000546100540004770000370010112631 aFrance : un rapport interministériel  tDossiers et documents de la revue Quart Mondev11 1aPierre Naves Et Bruno Cathala00261naa2 2200073   450 00100050000020001110000546100540011670000170017012701 aGrande Bretagne : le combat d’un père de famille jusqu’à la Cour européenne des droits de l’homme  tDossiers et documents de la revue Quart Mondev11 1aDerek Asker00242naa2 2200073   450 00100050000020000910000546100540009670000180015012671 aTrois requêtes soutenues par ATD Quart Monde devant la Cour européenne de Strasbourg  tDossiers et documents de la revue Quart Mondev11 1aHenri Bossan00204naa2 2200073   450 00100050000020000470000546100540005270000240010612681 aUn juge à la Cour européenne s’exprime  tDossiers et documents de la revue Quart Mondev11 1aFrançoise Tulkens00231naa2 2200073   450 00100050000020000810000546100540008670000170014012661 aLe droit de vivre en famille c'est le droit de vivre en dignitéeConclusion  tDossiers et documents de la revue Quart Mondev11 1aPaul Bouchet
\ No newline at end of file
-- 
GitLab