Commit a9dd8271 authored by Laurent's avatar Laurent

hotline #90556 fix domain thumbnail move in file explorer

parent 0c3dee9d
Pipeline #8003 passed with stage
in 35 minutes and 44 seconds
- ticket #90556 : Explorateur de fichiers : correction de la mise à jour du chemin des vignettes des domaines lors du déplacement du fichier
\ No newline at end of file
......@@ -84,9 +84,10 @@ class Class_FileManager_ModelRelation {
protected function _generateValue($model, $previous, $new) {
return $new;
return '/' . $new;
}
public function rename($path, $by) {
foreach($this->findAll($path) as $model) {
call_user_func([$model, 'callSetterByAttributeName'], $this->_field, $this->_generateValue($model, $path, $by));
......@@ -97,6 +98,7 @@ class Class_FileManager_ModelRelation {
class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelation {
protected function _generateValue($model, $previous, $new) {
return str_replace($previous, $new,
......@@ -105,6 +107,8 @@ class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelatio
}
class Class_FileManager_ModelRelationProfil {
protected $_filemanager;
......
......@@ -1678,7 +1678,6 @@ class FileManagerControllerWithImageInDomainTest extends FileManagerControllerTe
class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerControllerTestCase {
protected
$_domain,
$_top_profile,
$_article;
......@@ -1697,11 +1696,20 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC
'header_img' => 'https://bokeh/userfiles/image/white.png']);
$this->_domain = $this->fixture('Class_Catalogue',
['id' => 5,
'libelle' => 'Banner domain',
'indexer' => false,
'url_img' => 'https://bokeh/userfiles/image/white.png']);
$this->fixture('Class_Catalogue',
['id' => 5,
'libelle' => 'Banner domain',
'indexer' => false,
'url_img' => 'https://bokeh/userfiles/image/white.png']);
$this->fixture('Class_Catalogue',
['id' => 6,
'libelle' => 'Other domain',
'indexer' => false,
'url_img' => '/userfiles/image/white.png']);
$disk = Class_FileManager::getFileSystem()
->whenCalled('directoryAt')
......@@ -1744,28 +1752,35 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC
/** @test */
public function articleContentShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true);
$this->assertContains('userfiles/white.png', $this->_article->getContenu());
$this->assertContains('https://bokeh/userfiles/white.png', $this->_article->getContenu());
}
/** @test */
public function domainThumbnailShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true);
$this->assertContains('userfiles/white.png', $this->_domain->getUrlImg());
$this->assertEquals('/userfiles/white.png', Class_Catalogue::find(5)->getUrlImg());
}
/** @test */
public function otherDomainThumbnailShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true);
$this->assertEquals('/userfiles/white.png', Class_Catalogue::find(6)->getUrlImg());
}
/** @test */
public function profileImageShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true);
$this->assertContains('userfiles/white.png', $this->_top_profile->getCfgSiteParam('header_img'));
$this->assertEquals('https://bokeh/userfiles/white.png', $this->_top_profile->getCfgSiteParam('header_img'));
}
/** @test */
public function renameProfileImageShouldHaveBeenUpdated() {
$this->postDispatch('/admin/file-manager/rename?item=userfiles%2Fimage%2Fwhite.png', ['name' => 'yellow.2']);
$this->assertContains('userfiles/image/yellow.2.png', $this->_top_profile->getCfgSiteParam('header_img'));
$this->assertEquals('https://bokeh/userfiles/image/yellow.2.png', $this->_top_profile->getCfgSiteParam('header_img'));
}
......@@ -1773,7 +1788,7 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC
public function renameProfileImageWithDoubleQuotesShouldNotBeenUpdated() {
$this->postDispatch('/admin/file-manager/rename?item=userfiles%2Fimage%2Fwhite.png&name=wrong',
['name' => 'yell"ow.2']);
$this->assertContains('userfiles/image/white.png', $this->_top_profile->getCfgSiteParam('header_img'));
$this->assertEquals('https://bokeh/userfiles/image/white.png', $this->_top_profile->getCfgSiteParam('header_img'));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment