diff --git a/library/Class/Migration/ScriptPatchs.php b/library/Class/Migration/ScriptPatchs.php index da5685ea0f758012cbd9cc3f79e7078f4faaf95e..81a534a7d7802e479ac34b454c818fd71232b186 100644 --- a/library/Class/Migration/ScriptPatchs.php +++ b/library/Class/Migration/ScriptPatchs.php @@ -21,6 +21,7 @@ class Class_Migration_ScriptPatchs { + use Trait_EchoError; use Trait_Translator; protected $force=false; @@ -32,23 +33,23 @@ class Class_Migration_ScriptPatchs { } public function visitPhpError($exception) { - echo("Code : ".$exception->getCode()."\n"); - echo("Erreur :".$exception->getMessage()); + $this->echoError("Code : ".$exception->getCode()."\n"); + $this->echoError("Erreur :".$exception->getMessage()); } public function visitHeader($patch_level) { } public function visitDisplayInstruction($instruction) { - echo($instruction."\n"); + $this->echoError($instruction."\n"); } public function visitSqlSkip($num_instruction) { return false; } public function visitSqlException($e,$num_instruction) { - echo("Code : ".$e->getCode()."\n"); - echo("Erreur :".$e->getMessage()); + $this->echoError("Code : ".$e->getCode()."\n"); + $this->echoError("Erreur :".$e->getMessage()); } public function visitIsForceUpgrade() { @@ -56,12 +57,12 @@ class Class_Migration_ScriptPatchs { } public function visitDisplayDone() { - echo($this->_('Mise à niveau de la base effectuée avec succès')); + $this->echoError($this->_('Mise à niveau de la base effectuée avec succès')); } public function visitDisplayPatchLevel($num_patch) { - echo('Execution patch n° ' . $num_patch."\n"); + $this->echoError('Execution patch n° ' . $num_patch."\n"); } diff --git a/library/Trait/EchoError.php b/library/Trait/EchoError.php new file mode 100644 index 0000000000000000000000000000000000000000..c8ab45c88de953a0d88a542dbac62da0e032bc4b --- /dev/null +++ b/library/Trait/EchoError.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +trait Trait_EchoError { + protected static $_echo; + + public function echoError($error) { + return call_user_func(function($args) { + if(!self::$_echo) + echo $args; + return $args; + },$error); + } + + + public static function setEcho($echo) { + self::$_echo = $echo; + } +} +?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/OpdsControllerTest.php b/tests/application/modules/admin/controllers/OpdsControllerTest.php index a063ac74bae38f739bde2ed99a1e8b66f2c52127..d95bc5ef717b02cd5590fe5e377e4a4b54e635d0 100644 --- a/tests/application/modules/admin/controllers/OpdsControllerTest.php +++ b/tests/application/modules/admin/controllers/OpdsControllerTest.php @@ -648,8 +648,7 @@ class OPDSFeedFromFeedbooksFixtures { <opds:indirectAcquisition type="application/epub+zip"/> </opds:indirectAcquisition> </link> -<link type="application/atom+xml;type=entry;profile=opds-catalog" href="http://www.feedbooks.com/item/4141.atom" rel="alternate" title="Full entry"/> -</entry> +<link type="application/atom+xml;type=entry;profile=opds-catalog" href="http://www.feedbooks.com/item/4141.atom" rel="alternate" title="Full entry"></link> <entry> <title>Always a Bridesmaid</title> <id>http://www.feedbooks.com/item/429288</id> diff --git a/tests/library/Class/MigrationTest.php b/tests/library/Class/MigrationTest.php index efc72e96a96de95e76ec8d8d683508297314c508..5d8a0bb8b35c85f97e959b587a188dc5a1ce3b99 100644 --- a/tests/library/Class/MigrationTest.php +++ b/tests/library/Class/MigrationTest.php @@ -24,6 +24,9 @@ abstract class MigrationTestCase extends Storm_Test_ModelTestCase { public function setUp() { parent::setUp(); + + Class_Migration_ScriptPatchs::setEcho('none'); + $this->fixture('Class_CosmoVar', ['id' => 'patch_level', 'valeur' => 10 ] ); $this->_old_sql = Zend_Registry::get('sql'); diff --git a/tests/library/Class/WebService/SIGB/NanookFixtures.php b/tests/library/Class/WebService/SIGB/NanookFixtures.php index f08f043607ccc3a4ca968f693aba4ad2ff40d42e..77b3765fcb67c0fe9db410b7d950c7c4c6d02597 100644 --- a/tests/library/Class/WebService/SIGB/NanookFixtures.php +++ b/tests/library/Class/WebService/SIGB/NanookFixtures.php @@ -377,10 +377,10 @@ class NanookFixtures { </head> <body> <h1>Etat HTTP 404 - </h1> - <HR size="1" noshade="noshade"> + <HR size="1" noshade="noshade"/> <p><b>type</b> Rapport d\'état</p><p><b>message</b> <u></u></p> <p><b>description</b> <u>La ressource demandée () n\'est pas disponible.</u></p> - <HR size="1" noshade="noshade"> + <HR size="1" noshade="noshade"/> <h3>Apache Tomcat/6.0.32</h3> </body> </html>';