Skip to content
Snippets Groups Projects
Commit f81ed355 authored by efalcy's avatar efalcy Committed by Laurent
Browse files

hotline#113981 : fix error when profile user image not found

parent 0a25b5e2
Branches
Tags
2 merge requests!3589Hotline,!3583hotline#113981 : fix error when profile user image not found
Pipeline #10698 passed with stage
in 46 minutes and 14 seconds
- ticket #113981 : Magasin de thèmes : correction de la modification d'une image de profil lorsque celle ci a été supprimée du serveur
\ No newline at end of file
......@@ -321,9 +321,11 @@ class Class_User_Settings {
public function getProfileImage() {
$path = ($path = $this->get(self::PROFILE_IMAGE))
? $path
: $this->_initDefaultProfileImage();
if (! $path = $this->get(self::PROFILE_IMAGE))
$path = $this->_initDefaultProfileImage();
if (!Class_FileManager::find($path))
$path = $this->_initDefaultProfileImage();
$this->setProfileImage($path);
......
......@@ -3444,6 +3444,41 @@ class TemplatesDispatchIntonationChangeIconAccountTest extends TemplatesIntonati
class TemplatesDispatchIntonationChangeIconAccountWithWrongFilePathTest extends TemplatesIntonationTestCase {
public function setUp() {
parent::setUp();
Class_FileManager::setFileSystem(null);
$settings = (new Class_User_Settings(Class_Users::getIdentity()));
$settings
->setProfileImage('unknownpath')
->save();
}
/** @test */
public function currentImageReadBlackShouldBeSelected() {
$this->dispatch('/opac/abonne/change-image/id_profil/72');
$this->assertXPath('//div[contains(@class, "selected")]//a//img[contains(@src, "/read_black")]');
}
/** @test */
public function pickReadBlueShouldSaveItInUserConfig() {
$this->dispatch('/opac/abonne/pick-image/id_profil/72?id=public/opac/images/abonnes/read_blue.png');
$this->assertRedirect();
$current_image = (new Intonation_Library_View_Wrapper_User)
->setModel(Class_Users::getIdentity())
->getPicture();
$this->assertContains('read_blue.png', $current_image);
}
}
class TemplatesDispatchAbonneInformationsTest extends TemplatesIntonationAccountTestCase {
/** @test */
public function shouldDisplayPaulInDD() {
......
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