mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-17 07:48:41 +00:00
test fixes and added more tests
This commit is contained in:
parent
90dbd6d8b6
commit
0996ca4692
|
|
@ -45,6 +45,6 @@ class Media
|
||||||
$defaultProfileImage = \reset($media['upload'][0]);
|
$defaultProfileImage = \reset($media['upload'][0]);
|
||||||
|
|
||||||
$setting = new Setting();
|
$setting = new Setting();
|
||||||
SettingMapper::create($setting->with(0, 'default_profile_image', (string) $defaultProfileImage->getId(), '\\d+', 'Profile'));
|
SettingMapper::create($setting->with(0, 'default_profile_image', (string) $defaultProfileImage->getId(), '\\d+', null, 'Profile'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 8.0
|
|
||||||
*
|
|
||||||
* @package Modules\Profile\Admin\Install
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://orange-management.org
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\Profile\Admin\Install;
|
|
||||||
|
|
||||||
use Model\Setting;
|
|
||||||
use Model\SettingMapper;
|
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Media class.
|
|
||||||
*
|
|
||||||
* @package Modules\Profile\Admin\Install
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @link https://orange-management.org
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
class Media
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Install media providing
|
|
||||||
*
|
|
||||||
* @param string $path Module path
|
|
||||||
* @param ApplicationAbstract $app Application
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public static function install(string $path, ApplicationAbstract $app) : void
|
|
||||||
{
|
|
||||||
$media = \Modules\Media\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Media.install.json']);
|
|
||||||
|
|
||||||
$defaultProfileImage = \reset($media['upload'][0]);
|
|
||||||
|
|
||||||
$setting = new Setting();
|
|
||||||
SettingMapper::create($setting->with(0, 'default_profile_image', (string) $defaultProfileImage->getId(), '\\d+', 'Profile'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -78,7 +78,7 @@ final class BackendController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$profileImage = $this->app->appSettings->get(null, 'default_profile_image', null, 'Profile');
|
$profileImage = $this->app->appSettings->get(null, 'default_profile_image', null, 'Profile');
|
||||||
$image = MediaMapper::get((int) $profileImage['content']);
|
$image = MediaMapper::get((int) $profileImage->content);
|
||||||
|
|
||||||
$view->setData('defaultImage', $image);
|
$view->setData('defaultImage', $image);
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ final class BackendController extends Controller
|
||||||
$view->setData('media', $media instanceof NullMedia ? [] : (!\is_array($media) ? [$media] : $media));
|
$view->setData('media', $media instanceof NullMedia ? [] : (!\is_array($media) ? [$media] : $media));
|
||||||
|
|
||||||
$profileImage = $this->app->appSettings->get(null, 'default_profile_image', null, 'Profile');
|
$profileImage = $this->app->appSettings->get(null, 'default_profile_image', null, 'Profile');
|
||||||
$image = MediaMapper::get((int) $profileImage['content']);
|
$image = MediaMapper::get((int) $profileImage->content);
|
||||||
|
|
||||||
$view->setData('defaultImage', $image);
|
$view->setData('defaultImage', $image);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user