From 4624d8463a613c1781594501ea9b6905ff025508 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@git-test.afi-sa.fr> Date: Tue, 22 Jan 2013 16:08:57 +0000 Subject: [PATCH] Modification du chemin vers les fichiers images pour import de generation du site --- library/Class/FileWriter.php | 2 +- library/Class/ImportFichierGenerationSite.php | 6 +++--- .../controllers/ImportArboFromTxtFileTest.php | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/library/Class/FileWriter.php b/library/Class/FileWriter.php index 58002e0805f..a38d6643367 100644 --- a/library/Class/FileWriter.php +++ b/library/Class/FileWriter.php @@ -30,7 +30,7 @@ class Class_FileWriter { } public function mkdir($directory_name) { - return mkdir($directory_name,0700,true); + return mkdir($directory_name,0777,true); } } diff --git a/library/Class/ImportFichierGenerationSite.php b/library/Class/ImportFichierGenerationSite.php index 7ed84ce2421..632d53f98c0 100644 --- a/library/Class/ImportFichierGenerationSite.php +++ b/library/Class/ImportFichierGenerationSite.php @@ -117,15 +117,15 @@ class Class_ImportFichierGenerationSite { public function getDefaultPath() { - return USERFILESURL.'image/'; + return USERFILESPATH.'/image/'; } - protected function createDirectory($directory_name) { + public function createDirectory($directory_name) { $file_writer = self::getFileWriter(); $cleaned_name=iconv('UTF-8','ASCII//TRANSLIT',$directory_name); $cleaned_name=str_replace(' ','_',$cleaned_name); - echo $this->getDefaultPath().'/'.$cleaned_name; + echo $this->getDefaultPath().$cleaned_name; $file_writer->mkdir($this->getDefaultPath().$cleaned_name); return $cleaned_name; } diff --git a/tests/application/modules/admin/controllers/ImportArboFromTxtFileTest.php b/tests/application/modules/admin/controllers/ImportArboFromTxtFileTest.php index ee547672cdc..b891e46d684 100644 --- a/tests/application/modules/admin/controllers/ImportArboFromTxtFileTest.php +++ b/tests/application/modules/admin/controllers/ImportArboFromTxtFileTest.php @@ -18,7 +18,7 @@ * 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 */ -require_once('library/Class/ImportTxtFile.php'); +require_once('library/Class/ImportFichierGenerationSite.php'); class ImportArboFormTxtFileReadProfilTest extends PHPUnit_Framework_TestCase { protected $_importTxt; protected $file_writer; @@ -190,13 +190,13 @@ class ImportArboFormTxtFileDirectoryCreationReadProfilTest extends PHPUnit_Frame ->whenCalled('save') ->answers(true); $this->file_writer->whenCalled('mkdir') - ->with('/Nature_et_loisirs/Sport') + ->with($this->_importTxt->getDefaultPath().'Nature_et_loisirs/Sport') ->answers(true) ->whenCalled('mkdir') - ->with('/Nature_et_loisirs/Jeux') + ->with($this->_importTxt->getDefaultPath().'Nature_et_loisirs/Jeux') ->answers(true) ->whenCalled('mkdir') - ->with('/Cinema/Series_tv') + ->with($this->_importTxt->getDefaultPath().'Cinema/Series_tv') ->answers(true) ->beStrict(); /* $this->file_writer->whenCalled('mkdir') @@ -211,8 +211,8 @@ class ImportArboFormTxtFileDirectoryCreationReadProfilTest extends PHPUnit_Frame /** @test */ public function importFileShouldCreateDirectoriesJeuxAndSportForProfilNatureEtLoisirs() { $this->_importTxt->createDirectoriesForProfil($this->profils[0]); - $this->assertTrue($this->file_writer->methodHasBeenCalledWithParams('mkdir',['/Nature_et_loisirs/Jeux'])); - $this->assertTrue($this->file_writer->methodHasBeenCalledWithParams('mkdir',['/Nature_et_loisirs/Sport'])); + $this->assertTrue($this->file_writer->methodHasBeenCalledWithParams('mkdir',[$this->_importTxt->getDefaultPath().'Nature_et_loisirs/Jeux'])); + $this->assertTrue($this->file_writer->methodHasBeenCalledWithParams('mkdir',[$this->_importTxt->getDefaultPath().'Nature_et_loisirs/Sport'])); } @@ -220,7 +220,7 @@ class ImportArboFormTxtFileDirectoryCreationReadProfilTest extends PHPUnit_Frame /** @test */ public function importFileShouldCreateDirectorySeriesTvForProfilCinema() { $this->_importTxt->createDirectoriesForProfil($this->profils[1]); - $this->assertTrue($this->file_writer->methodHasBeenCalledWithParams('mkdir',['/Cinema/Series_tv'])); + $this->assertTrue($this->file_writer->methodHasBeenCalledWithParams('mkdir',[$this->_importTxt->getDefaultPath().'Cinema/Series_tv'])); } -- GitLab