From 2fe8c6237e6a791345dce0ab7c73668a5533c3c1 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Thu, 12 Apr 2018 14:21:35 +0200 Subject: [PATCH] dev #73871 remove temp file when succeed --- library/Class/Notice/Xsl.php | 5 +++++ library/ZendAfi/View/Helper/Notice/Xsl.php | 2 ++ tests/scenarios/Xsl/XslTest.php | 3 +++ 3 files changed, 10 insertions(+) diff --git a/library/Class/Notice/Xsl.php b/library/Class/Notice/Xsl.php index 4d490e31581..d2f93527c3e 100644 --- a/library/Class/Notice/Xsl.php +++ b/library/Class/Notice/Xsl.php @@ -73,6 +73,11 @@ class Class_Notice_Xsl { } + public function unlink($filename) { + static::getPhpCommand()->unlink($filename); + } + + protected function _getXslFileFromProfile() { $settings = $this->_profile->getCfgModulesPreferences('recherche', 'viewnotice', $this->_record->getTypeDoc()); if(!$settings) diff --git a/library/ZendAfi/View/Helper/Notice/Xsl.php b/library/ZendAfi/View/Helper/Notice/Xsl.php index 23d6f00483b..ba8e02b2455 100644 --- a/library/ZendAfi/View/Helper/Notice/Xsl.php +++ b/library/ZendAfi/View/Helper/Notice/Xsl.php @@ -46,6 +46,8 @@ class ZendAfi_View_Helper_Notice_Xsl extends ZendAfi_View_Helper_BaseHelper { $this->_('xsl'), ['target' => 'blank'])), ['class' => 'error']); + + $xsl->unlink($marc_xml); return $response; } } \ No newline at end of file diff --git a/tests/scenarios/Xsl/XslTest.php b/tests/scenarios/Xsl/XslTest.php index f8de2ad572d..91228869214 100644 --- a/tests/scenarios/Xsl/XslTest.php +++ b/tests/scenarios/Xsl/XslTest.php @@ -118,6 +118,9 @@ class XslNoticeajaxDetailDispatchTest extends AbstractControllerTestCase { $php_command = $this->mock() ->whenCalled('extension_loaded') + ->answers(true) + + ->whenCalled('unlink') ->answers(true); Class_Notice_Xsl::setPhpCommand($php_command); -- GitLab