Skip to content
Snippets Groups Projects
Commit c4f319b9 authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

Merge branch...

Merge branch 'hotline#90556_visuels_explorateur_de_fichiers_et_liens_vers_les_articles_ou_domaines' into 'hotline'

hotline #90556 fix domain thumbnail move in file explorer

See merge request !3198
parents ef34e712 a9dd8271
Branches
Tags
4 merge requests!3297WIP: Master,!3203Master,!3202Hotline,!3198hotline #90556 fix domain thumbnail move in file explorer
Pipeline #8011 passed with stage
in 37 minutes and 39 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 { ...@@ -84,9 +84,10 @@ class Class_FileManager_ModelRelation {
protected function _generateValue($model, $previous, $new) { protected function _generateValue($model, $previous, $new) {
return $new; return '/' . $new;
} }
public function rename($path, $by) { public function rename($path, $by) {
foreach($this->findAll($path) as $model) { foreach($this->findAll($path) as $model) {
call_user_func([$model, 'callSetterByAttributeName'], $this->_field, $this->_generateValue($model, $path, $by)); call_user_func([$model, 'callSetterByAttributeName'], $this->_field, $this->_generateValue($model, $path, $by));
...@@ -97,6 +98,7 @@ class Class_FileManager_ModelRelation { ...@@ -97,6 +98,7 @@ class Class_FileManager_ModelRelation {
class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelation { class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelation {
protected function _generateValue($model, $previous, $new) { protected function _generateValue($model, $previous, $new) {
return str_replace($previous, $new, return str_replace($previous, $new,
...@@ -105,6 +107,8 @@ class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelatio ...@@ -105,6 +107,8 @@ class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelatio
} }
class Class_FileManager_ModelRelationProfil { class Class_FileManager_ModelRelationProfil {
protected $_filemanager; protected $_filemanager;
......
...@@ -1678,7 +1678,6 @@ class FileManagerControllerWithImageInDomainTest extends FileManagerControllerTe ...@@ -1678,7 +1678,6 @@ class FileManagerControllerWithImageInDomainTest extends FileManagerControllerTe
class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerControllerTestCase { class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerControllerTestCase {
protected protected
$_domain,
$_top_profile, $_top_profile,
$_article; $_article;
...@@ -1697,11 +1696,20 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC ...@@ -1697,11 +1696,20 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC
'header_img' => 'https://bokeh/userfiles/image/white.png']); 'header_img' => 'https://bokeh/userfiles/image/white.png']);
$this->_domain = $this->fixture('Class_Catalogue', $this->fixture('Class_Catalogue',
['id' => 5, ['id' => 5,
'libelle' => 'Banner domain', 'libelle' => 'Banner domain',
'indexer' => false, 'indexer' => false,
'url_img' => 'https://bokeh/userfiles/image/white.png']); '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() $disk = Class_FileManager::getFileSystem()
->whenCalled('directoryAt') ->whenCalled('directoryAt')
...@@ -1744,28 +1752,35 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC ...@@ -1744,28 +1752,35 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC
/** @test */ /** @test */
public function articleContentShouldHaveBeenUpdated() { public function articleContentShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true); $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 */ /** @test */
public function domainThumbnailShouldHaveBeenUpdated() { public function domainThumbnailShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true); $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 */ /** @test */
public function profileImageShouldHaveBeenUpdated() { public function profileImageShouldHaveBeenUpdated() {
$this->dispatch('/admin/file-manager/move?item=userfiles%2Fimage%2Fwhite.png&into=userfiles', true); $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 */ /** @test */
public function renameProfileImageShouldHaveBeenUpdated() { public function renameProfileImageShouldHaveBeenUpdated() {
$this->postDispatch('/admin/file-manager/rename?item=userfiles%2Fimage%2Fwhite.png', ['name' => 'yellow.2']); $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 ...@@ -1773,7 +1788,7 @@ class FileManagerControllerMoveActionWithLinkedDataIbDBTest extends FileManagerC
public function renameProfileImageWithDoubleQuotesShouldNotBeenUpdated() { public function renameProfileImageWithDoubleQuotesShouldNotBeenUpdated() {
$this->postDispatch('/admin/file-manager/rename?item=userfiles%2Fimage%2Fwhite.png&name=wrong', $this->postDispatch('/admin/file-manager/rename?item=userfiles%2Fimage%2Fwhite.png&name=wrong',
['name' => 'yell"ow.2']); ['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'));
} }
} }
......
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