mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-11 15:28:40 +00:00
autofixes
This commit is contained in:
parent
d82537a0c1
commit
8b0a9b18e6
|
|
@ -317,13 +317,13 @@ final class ApiController extends Controller
|
|||
public function createAddressFromRequest(RequestAbstract $request) : Address
|
||||
{
|
||||
/** @var Address $element */
|
||||
$element = new Address();
|
||||
$element->name = (string) ($request->getData('name') ?? '');
|
||||
$element = new Address();
|
||||
$element->name = (string) ($request->getData('name') ?? '');
|
||||
$element->addition = (string) ($request->getData('addition') ?? '');
|
||||
$element->postal = (string) ($request->getData('postal') ?? '');
|
||||
$element->city = (string) ($request->getData('city') ?? '');
|
||||
$element->address = (string) ($request->getData('address') ?? '');
|
||||
$element->state = (string) ($request->getData('state') ?? '');
|
||||
$element->postal = (string) ($request->getData('postal') ?? '');
|
||||
$element->city = (string) ($request->getData('city') ?? '');
|
||||
$element->address = (string) ($request->getData('address') ?? '');
|
||||
$element->state = (string) ($request->getData('state') ?? '');
|
||||
$element->setCountry((string) ($request->getData('country') ?? ''));
|
||||
$element->setType((int) ($request->getData('type') ?? 0));
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Profile\Controller;
|
||||
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use Modules\Profile\Models\ProfileMapper;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
|
|
@ -128,7 +129,8 @@ final class BackendController extends Controller
|
|||
$accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app->l11nManager, $request, $response);
|
||||
$view->addData('accGrpSelector', $accGrpSelector);
|
||||
|
||||
$view->setData('media', MediaMapper::getFor((int) $profile->account->getId(), 'createdBy'));
|
||||
$media = MediaMapper::getFor((int) $profile->account->getId(), 'createdBy');
|
||||
$view->setData('media', $media instanceof NullMedia ? [] : $media);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$request->header->account = 1;
|
||||
|
||||
$profile = new Profile(new \Modules\Admin\Models\Account());
|
||||
$profile = new Profile(new \Modules\Admin\Models\Account());
|
||||
$profile->account->login = 'ProfileCreateDb';
|
||||
$profile->account->setEmail('profile_create_db@email.com');
|
||||
|
||||
|
|
|
|||
|
|
@ -31,26 +31,26 @@ class ProfileMapperTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testCRUD() : void
|
||||
{
|
||||
$media = new Media();
|
||||
$media->createdBy = new NullAccount(1);
|
||||
$media = new Media();
|
||||
$media->createdBy = new NullAccount(1);
|
||||
$media->description = 'desc';
|
||||
$media->setPath('Web/Backend/img/default-user.jpg');
|
||||
$media->size = 11;
|
||||
$media->size = 11;
|
||||
$media->extension = 'png';
|
||||
$media->name = 'Image';
|
||||
$media->name = 'Image';
|
||||
|
||||
if (($profile = ProfileMapper::getFor(1, 'account'))->getId() === 0) {
|
||||
$profile = new Profile();
|
||||
|
||||
$profile->account = AccountMapper::get(1);
|
||||
$profile->image = $media;
|
||||
$profile->account = AccountMapper::get(1);
|
||||
$profile->image = $media;
|
||||
$profile->birthday = new \DateTime('now');
|
||||
|
||||
$id = ProfileMapper::create($profile);
|
||||
self::assertGreaterThan(0, $profile->getId());
|
||||
self::assertEquals($id, $profile->getId());
|
||||
} else {
|
||||
$profile->image = $media;
|
||||
$profile->image = $media;
|
||||
$profile->birthday = new \DateTime('now');
|
||||
|
||||
ProfileMapper::update($profile);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ProfileTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([], $this->profile->getContactElements());
|
||||
self::assertInstanceOf('\Modules\Media\Models\Media', $this->profile->image);
|
||||
self::assertInstanceOf('\Modules\Admin\Models\Account', $this->profile->account);
|
||||
self::assertEquals(null, $this->profile->birthday);
|
||||
self::assertNull($this->profile->birthday);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -154,8 +154,8 @@ class ProfileTest extends \PHPUnit\Framework\TestCase
|
|||
$this->profile->setGender(GenderType::FEMALE);
|
||||
$this->profile->setSex(SexType::FEMALE);
|
||||
$this->profile->birthday = ($date = new \DateTime('now'));
|
||||
$this->profile->account = ($a = new NullAccount(1));
|
||||
$this->profile->image = ($i = new NullMedia(1));
|
||||
$this->profile->account = ($a = new NullAccount(1));
|
||||
$this->profile->image = ($i = new NullMedia(1));
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user