diff --git a/library/Class/NoticeUnimarc/Writer.php b/library/Class/NoticeUnimarc/Writer.php index f46be07ee08d782aafe90195385747bfbc3a0788..e274db7e2f2d5e95171d327c7b15b24024c9cf88 100644 --- a/library/Class/NoticeUnimarc/Writer.php +++ b/library/Class/NoticeUnimarc/Writer.php @@ -18,15 +18,10 @@ * along with AFI-OPAC 2.0; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { - - protected $_pattern_subfield_cache = []; - // --------------------------------------------------- - // Decoupage de l'enregistrement - // --------------------------------------------------- + public function setNotice($string, $type_accents = 0) { $this->reset_notice(); $this->type_accents = $type_accents; @@ -117,14 +112,7 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { $this->update(); } - - - - - // ---------------------------------------------------------------- - // Decoupage d'un champ complet par son indice - // ---------------------------------------------------------------- - + public function decoupe_field($label, $content) { $sc = array('bloc' => preg_replace('/' . $this->rgx_field_end . '/', '', @@ -153,7 +141,6 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { } - public function makeZoneByValeurs($indicateurs, $sous_champ, $valeurs) { $new = $indicateurs; foreach ($valeurs as $valeur) @@ -809,5 +796,5 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { call_user_func_array([$this, 'add_field'], $params); return $this; } - -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/library/startup.php b/library/startup.php index 136124bb3ccb65f636f6eb09e5f618c6ed4bd687..661c1d3219480debcd112482e478ddd36c76f293 100644 --- a/library/startup.php +++ b/library/startup.php @@ -325,5 +325,3 @@ function setupRoutes($front_controller, $cfg) { return $front_controller; } - -?> diff --git a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php index be64047bbcef49a689843e010619e4612da7f76e..d46eccbf2e9af89671ab49a49665a4d1cbd66d97 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php @@ -109,9 +109,16 @@ abstract class AbonneControllerPretsListTwoPretsTestCase extends AbstractAbonneC class AbonneControllerPretsExportTwoPretsTest extends AbonneControllerPretsListTwoPretsTestCase { + protected + $_dl_file, + $unimarc = '01201nam0 22002891 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890995001400897frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrÁefleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la forÃet aux portes, Alice tombe nez Áa nez avec Ace. Devenue malgrÂe elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assistÂe Áa la scÁene, intervient, la rencontre tourne Áa l\'affrontement. b9782355926358 1tAlice au royaume de TrÁefle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR 1aAliceItem00604nam0 22001931 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388995001500395frOr1314913787 a9781408812792 a20140320 0103 aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothÁeque de l\'agglomÂeration de Saint-Omer apm 1aPotterItem'; + + public function setUp() { parent::setUp(); $this->dispatch('/opac/abonne/loan-export'); + $this->_dl_file = tempnam('/tmp', 'UNIMARC'); + file_put_contents($this->_dl_file, $this->_response->getBody()); } @@ -137,8 +144,13 @@ class AbonneControllerPretsExportTwoPretsTest extends AbonneControllerPretsListT /** @test */ public function bodyShouldContainsUnimarcs() { - $this->assertSame('01201nam0 22002891 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890995001400897frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrÁefleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la forÃet aux portes, Alice tombe nez Áa nez avec Ace. Devenue malgrÂe elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assistÂe Áa la scÁene, intervient, la rencontre tourne Áa l\'affrontement. b9782355926358 1tAlice au royaume de TrÁefle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR 1aAliceItem00604nam0 22001931 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388995001500395frOr1314913787 a9781408812792 a20140320 0103 aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothÁeque de l\'agglomÂeration de Saint-Omer apm 1aPotterItem', - $this->_response->getBody()); + $this->assertSame($this->unimarc, $this->_response->getBody()); + } + + + /** @test */ + public function dlFileShouldContainsUnimarc() { + $this->assertEquals($this->unimarc, file_get_contents($this->_dl_file)); } } @@ -391,9 +403,5 @@ class AbonneControllerPretsListReservationTest extends AbstractAbonneControllerP $this->assertXPathContentContains('//tbody/tr[2]//td//a', 'Dobby', $this->_response->getBody()); } - - } - - ?> \ No newline at end of file