make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...

This commit is contained in:
Dennis Eichhorn 2023-05-06 11:42:06 +00:00
parent c6d276ba4a
commit 249f1c5091
17 changed files with 58 additions and 113 deletions

View File

@ -84,7 +84,7 @@ final class ApiController extends Controller
*/ */
public function apiProfileCreateDbEntry(Profile $profile, RequestAbstract $request) : bool public function apiProfileCreateDbEntry(Profile $profile, RequestAbstract $request) : bool
{ {
if ($profile->getId() !== 0) { if ($profile->id !== 0) {
return false; return false;
} }
@ -144,7 +144,7 @@ final class ApiController extends Controller
/** @var Profile $isInDb */ /** @var Profile $isInDb */
$isInDb = ProfileMapper::get()->where('account', $account)->execute(); $isInDb = ProfileMapper::get()->where('account', $account)->execute();
if ($isInDb->getId() !== 0) { if ($isInDb->id !== 0) {
$profiles[] = $isInDb; $profiles[] = $isInDb;
continue; continue;
} }
@ -190,8 +190,8 @@ final class ApiController extends Controller
fileNames: $request->getDataList('filenames'), fileNames: $request->getDataList('filenames'),
files: $uploadedFiles, files: $uploadedFiles,
account: $request->header->account, account: $request->header->account,
basePath: __DIR__ . '/../../../Modules/Media/Files/Accounts/' . $profile->account->getId(), basePath: __DIR__ . '/../../../Modules/Media/Files/Accounts/' . $profile->account->id,
virtualPath: '/Accounts/' . $profile->account->getId() . ' ' . $profile->account->login, virtualPath: '/Accounts/' . $profile->account->id . ' ' . $profile->account->login,
pathSettings: PathSettings::FILE_PATH pathSettings: PathSettings::FILE_PATH
); );
@ -199,7 +199,7 @@ final class ApiController extends Controller
foreach ($uploaded as $file) { foreach ($uploaded as $file) {
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
$file->getId(), $file->id,
$request->getDataInt('type'), $request->getDataInt('type'),
MediaMapper::class, MediaMapper::class,
'types', 'types',
@ -210,7 +210,7 @@ final class ApiController extends Controller
} }
$profile->image = !empty($uploaded) ? \reset($uploaded) : new NullMedia(); $profile->image = !empty($uploaded) ? \reset($uploaded) : new NullMedia();
if (!($profile->image instanceof NullMedia)) { if ($profile->image->id > 0) {
$profile->image = $this->app->moduleManager->get('Media')->resizeImage($profile->image, 100, 100, false); $profile->image = $this->app->moduleManager->get('Media')->resizeImage($profile->image, 100, 100, false);
} }
@ -249,13 +249,13 @@ final class ApiController extends Controller
->where('account', $request->getDataInt('account') ?? 0) ->where('account', $request->getDataInt('account') ?? 0)
->execute(); ->execute();
$profile = $profileObj->getId(); $profile = $profileObj->id;
} }
$contactElement = $this->createContactElementFromRequest($request); $contactElement = $this->createContactElementFromRequest($request);
$this->createModel($request->header->account, $contactElement, ContactElementMapper::class, 'profile-contactElement', $request->getOrigin()); $this->createModel($request->header->account, $contactElement, ContactElementMapper::class, 'profile-contactElement', $request->getOrigin());
$this->createModelRelation($request->header->account, $profile, $contactElement->getId(), ProfileMapper::class, 'contactElements', '', $request->getOrigin()); $this->createModelRelation($request->header->account, $profile, $contactElement->id, ProfileMapper::class, 'contactElements', '', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Contact Element', 'Contact element successfully created', $contactElement); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Contact Element', 'Contact element successfully created', $contactElement);
} }
@ -334,13 +334,13 @@ final class ApiController extends Controller
->where('account', $request->getDataInt('account') ?? 0) ->where('account', $request->getDataInt('account') ?? 0)
->execute(); ->execute();
$profile = $profileObj->getId(); $profile = $profileObj->id;
} }
$address = $this->createAddressFromRequest($request); $address = $this->createAddressFromRequest($request);
$this->createModel($request->header->account, $address, AddressMapper::class, 'profile-address', $request->getOrigin()); $this->createModel($request->header->account, $address, AddressMapper::class, 'profile-address', $request->getOrigin());
$this->createModelRelation($request->header->account, $profile, $address->getId(), ProfileMapper::class, 'location', '', $request->getOrigin()); $this->createModelRelation($request->header->account, $profile, $address->id, ProfileMapper::class, 'location', '', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Address', 'Address successfully created', $address); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Address', 'Address successfully created', $address);
} }

View File

@ -153,9 +153,9 @@ final class BackendController extends Controller
$view->setData('account', $profile); $view->setData('account', $profile);
$l11n = null; $l11n = null;
if ($profile->account->getId() === $request->header->account) { if ($profile->account->id === $request->header->account) {
/** @var \phpOMS\Localization\Localization $l11n */ /** @var \phpOMS\Localization\Localization $l11n */
$l11n = LocalizationMapper::get()->where('id', $profile->account->l11n->getId())->execute(); $l11n = LocalizationMapper::get()->where('id', $profile->account->l11n->id)->execute();
} }
$view->setData('l11n', $l11n ?? new NullLocalization()); $view->setData('l11n', $l11n ?? new NullLocalization());
@ -166,7 +166,7 @@ final class BackendController extends Controller
/** @var \Modules\Media\Models\Media[] $media */ /** @var \Modules\Media\Models\Media[] $media */
$media = MediaMapper::getAll() $media = MediaMapper::getAll()
->with('createdBy') ->with('createdBy')
->where('createdBy', (int) $profile->account->getId()) ->where('createdBy', (int) $profile->account->id)
->limit(25) ->limit(25)
->execute(); ->execute();

View File

@ -34,7 +34,7 @@ class Contact
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
/** /**
* Name1 * Name1
@ -134,58 +134,6 @@ class Contact
$this->image = new NullMedia(); $this->image = new NullMedia();
} }
/**
* Get account locations.
*
* @return Location[]
*
* @since 1.0.0
*/
public function getLocations() : array
{
return $this->locations;
}
/**
* Add location.
*
* @param Location $location Location
*
* @return void
*
* @since 1.0.0
*/
public function addLocation(Location $location) : void
{
$this->locations[] = $location;
}
/**
* Get account contact element.
*
* @return Contact[]
*
* @since 1.0.0
*/
public function getContacts() : array
{
return $this->contacts;
}
/**
* Add contact element.
*
* @param Contact $contact Contact Element
*
* @return void
*
* @since 1.0.0
*/
public function addContact(Contact $contact) : void
{
$this->contacts[] = $contact;
}
/** /**
* Get id. * Get id.
* *

View File

@ -32,7 +32,7 @@ class ContactElement
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
/** /**
* Contact element type. * Contact element type.
@ -40,7 +40,7 @@ class ContactElement
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
private int $type = 0; public int $type = 0;
/** /**
* Contact element subtype. * Contact element subtype.

View File

@ -19,7 +19,6 @@ use Modules\Admin\Models\NullAccount;
use Modules\Media\Models\Media; use Modules\Media\Models\Media;
use Modules\Media\Models\NullMedia; use Modules\Media\Models\NullMedia;
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue; use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
use phpOMS\Stdlib\Base\Location;
/** /**
* Profile class. * Profile class.
@ -37,7 +36,7 @@ class Profile implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
/** /**
* Profile image. * Profile image.

View File

@ -44,7 +44,7 @@ class BaseView extends View
* @var bool * @var bool
* @since 1.0.0 * @since 1.0.0
*/ */
private bool $isRequired = false; public bool $isRequired = false;
/** /**
* Dom name * Dom name

View File

@ -2,10 +2,10 @@
<div class="ipt-wrap wf-100"> <div class="ipt-wrap wf-100">
<div class="ipt-first"> <div class="ipt-first">
<span class="input"> <span class="input">
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[ <button type="button" id="<?= $this->id; ?>-book-button" data-action='[
{ {
"key": 1, "listener": "click", "action": [ "key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"}, {"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->id; ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}, {"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
@ -13,12 +13,12 @@
] ]
} }
]' formaction=""><i class="fa fa-book"></i></button> ]' formaction=""><i class="fa fa-book"></i></button>
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>"> <div class="advancedInput wf-100" id="<?= $this->id; ?>">
<input autocomplete="off" spellcheck="false" class="input" type="text" id="i<?= $this->getId(); ?>" placeholder="&#xf007; Guest" <input autocomplete="off" spellcheck="false" class="input" type="text" id="i<?= $this->id; ?>" placeholder="&#xf007; Guest"
data-emptyAfter="true" data-emptyAfter="true"
data-autocomplete="off" data-autocomplete="off"
data-src="api/admin/find/accgrp?search={!#i<?= $this->getId(); ?>}"> data-src="api/admin/find/accgrp?search={!#i<?= $this->id; ?>}">
<div id="<?= $this->getId(); ?>-popup" class="popup" data-active="true"> <div id="<?= $this->id; ?>-popup" class="popup" data-active="true">
<table class="default"> <table class="default">
<thead> <thead>
<tr> <tr>
@ -27,7 +27,7 @@
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i> <td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td>Email<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i> <td>Email<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody> <tbody>
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate"> <template id="<?= $this->id; ?>-rowElement" class="rowTemplate">
<tr tabindex="-1"> <tr tabindex="-1">
<td data-tpl-text="/type_name" data-tpl-value="/type_prefix" data-value=""> <td data-tpl-text="/type_name" data-tpl-value="/type_prefix" data-value="">
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td> <td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
@ -43,8 +43,8 @@
</div> </div>
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div> <div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
</div> </div>
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true"> <div class="box" id="<?= $this->id; ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->getId(); ?>-tagTemplate"> <template id="<?= $this->id; ?>-tagTemplate">
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>"> <span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
<i class="fa fa-times close"></i> <i class="fa fa-times close"></i>
<span style="display: none;" data-name="type_prefix" data-tpl-value="/type_prefix" data-value=""></span> <span style="display: none;" data-name="type_prefix" data-tpl-value="/type_prefix" data-value=""></span>

View File

@ -21,8 +21,8 @@ use phpOMS\Uri\UriFactory;
*/ */
$accounts = $this->getData('accounts') ?? []; $accounts = $this->getData('accounts') ?? [];
$previous = empty($accounts) ? '{/base}profile/list' : '{/base}/profile/list?{?}&id=' . \reset($accounts)->getId() . '&ptype=p'; $previous = empty($accounts) ? '{/base}profile/list' : '{/base}/profile/list?{?}&id=' . \reset($accounts)->id . '&ptype=p';
$next = empty($accounts) ? '{/base}profile/list' : '{/base}/profile/list?{?}&id=' . \end($accounts)->getId() . '&ptype=n'; $next = empty($accounts) ? '{/base}profile/list' : '{/base}/profile/list?{?}&id=' . \end($accounts)->id . '&ptype=n';
?> ?>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
@ -60,14 +60,13 @@ $next = empty($accounts) ? '{/base}profile/list' : '{/base}/profile/list?{?}
<tbody> <tbody>
<?php $count = 0; <?php $count = 0;
foreach ($accounts as $key => $account) : ++$count; foreach ($accounts as $key => $account) : ++$count;
$url = UriFactory::build('{/base}/profile/single?{?}&id=' . $account->getId()); $url = UriFactory::build('{/base}/profile/single?{?}&id=' . $account->id);
?> ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_user'); ?>" width="30" loading="lazy" class="profile-image" <td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_user'); ?>" width="30" loading="lazy" class="profile-image"
src="<?= src="<?= $account->image->id === 0
$account->image instanceof NullMedia ? UriFactory::build($this->getData('defaultImage')->getPath())
? UriFactory::build($this->getData('defaultImage')->getPath()) : UriFactory::build($account->image->getPath()); ?>"></a>
: UriFactory::build($account->image->getPath()); ?>"></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($account->account->name3 . ' ' . $account->account->name2 . ' ' . $account->account->name1); ?></a> <td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($account->account->name3 . ' ' . $account->account->name2 . ' ' . $account->account->name1); ?></a>
<td data-label="<?= $this->getHtml('Activity'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($account->account->getLastActive()->format('Y-m-d')); ?></a> <td data-label="<?= $this->getHtml('Activity'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($account->account->getLastActive()->format('Y-m-d')); ?></a>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -45,7 +45,7 @@ echo $this->getData('nav')->render();
<div class="box wf-100 col-xs-12"> <div class="box wf-100 col-xs-12">
<ul class="tab-links"> <ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li> <li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
<?php if ($this->request->header->account === $account->getId()) : ?> <?php if ($this->request->header->account === $account->id) : ?>
<li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li> <li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li>
<li><label for="c-tab-3"><?= $this->getHtml('Password'); ?></label></li> <li><label for="c-tab-3"><?= $this->getHtml('Password'); ?></label></li>
<?php endif; ?> <?php endif; ?>
@ -71,12 +71,11 @@ echo $this->getData('nav')->render();
<div><img id="preview-profileImage" class="m-profile rf" <div><img id="preview-profileImage" class="m-profile rf"
alt="<?= $this->getHtml('ProfileImage'); ?>" alt="<?= $this->getHtml('ProfileImage'); ?>"
itemprop="logo" loading="lazy" itemprop="logo" loading="lazy"
src="<?= src="<?= $profile->image->id === 0
$profile->image instanceof NullMedia
? UriFactory::build($this->getData('defaultImage')->getPath()) ? UriFactory::build($this->getData('defaultImage')->getPath())
: UriFactory::build($profile->image->getPath()); ?>" : UriFactory::build($profile->image->getPath()); ?>"
width="100px"></div> width="100px"></div>
<?php if ($this->request->header->account === $account->getId()) : ?> <?php if ($this->request->header->account === $account->id) : ?>
<div><a id="iProfileUploadButton" href="#upload" data-action='[ <div><a id="iProfileUploadButton" href="#upload" data-action='[
{"listener": "click", "key": 1, "action": [ {"listener": "click", "key": 1, "action": [
{"key": 1, "type": "event.prevent"}, {"key": 1, "type": "event.prevent"},
@ -101,7 +100,7 @@ echo $this->getData('nav')->render();
<th><?= $this->getHtml('Address'); ?> <th><?= $this->getHtml('Address'); ?>
<td> <td>
<?php <?php
$locations = $profile->account->getLocations(); $locations = $profile->account->locations;
if (empty($locations)) : if (empty($locations)) :
?> ?>
<tr> <tr>
@ -125,7 +124,7 @@ echo $this->getData('nav')->render();
<th><?= $this->getHtml('Contact'); ?> <th><?= $this->getHtml('Contact'); ?>
<td> <td>
<?php <?php
$contacts = $profile->account->getContacts(); $contacts = $profile->account->contacts;
if (empty($contacts)) : if (empty($contacts)) :
?> ?>
<tr> <tr>
@ -149,7 +148,7 @@ echo $this->getData('nav')->render();
<td><span class="tag green"><?= $this->getHtml(':s' . $account->getStatus(), 'Admin'); ?></span> <td><span class="tag green"><?= $this->getHtml(':s' . $account->getStatus(), 'Admin'); ?></span>
</table> </table>
</div> </div>
<?php if ($this->request->header->account === $account->getId()) : ?> <?php if ($this->request->header->account === $account->id) : ?>
<div class="portlet-foot"><button class="update"><?= $this->getHtml('Edit', '0', '0'); ?></button></div> <div class="portlet-foot"><button class="update"><?= $this->getHtml('Edit', '0', '0'); ?></button></div>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -168,7 +167,7 @@ echo $this->getData('nav')->render();
</div> </div>
<?php <?php
if ($this->request->header->account === $account->getId()) : if ($this->request->header->account === $account->id) :
$countryCodes = ISO3166TwoEnum::getConstants(); $countryCodes = ISO3166TwoEnum::getConstants();
$countries = ISO3166NameEnum::getConstants(); $countries = ISO3166NameEnum::getConstants();
$timezones = TimeZoneEnumArray::getConstants(); $timezones = TimeZoneEnumArray::getConstants();
@ -230,7 +229,7 @@ echo $this->getData('nav')->render();
</table> </table>
</div> </div>
<div class="portlet-foot"> <div class="portlet-foot">
<input type="hidden" name="account_id" value="<?= $account->getId(); ?>"> <input type="hidden" name="account_id" value="<?= $account->id; ?>">
<input id="iSubmitLocalization" name="submitLocalization" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>"> <input id="iSubmitLocalization" name="submitLocalization" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
</div> </div>
</form> </form>

View File

@ -108,7 +108,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiProfileCreate($request, $response); $this->module->apiProfileCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response'][0]->getId()); self::assertGreaterThan(0, $response->get('')['response'][0]->id);
} }
/** /**
@ -169,7 +169,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
]); ]);
$this->module->apiSettingsAccountImageSet($request, $response); $this->module->apiSettingsAccountImageSet($request, $response);
$image = ProfileMapper::get()->with('image')->where('id', $response->get('')['response']->getId())->execute()->image; $image = ProfileMapper::get()->with('image')->where('id', $response->get('')['response']->id)->execute()->image;
self::assertEquals('Profile Logo', $image->name); self::assertEquals('Profile Logo', $image->name);
} }
@ -203,7 +203,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('contact', '1'); $request->setData('contact', '1');
$this->module->apiContactElementCreate($request, $response); $this->module->apiContactElementCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId()); self::assertGreaterThan(0, $response->get('')['response']->id);
} }
*/ */
@ -242,7 +242,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('Country', ISO3166TwoEnum::_USA); $request->setData('Country', ISO3166TwoEnum::_USA);
$this->module->apiAddressCreate($request, $response); $this->module->apiAddressCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId()); self::assertGreaterThan(0, $response->get('')['response']->id);
} }
/** /**

View File

@ -37,7 +37,7 @@ final class ContactElementTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->contact->getId()); self::assertEquals(0, $this->contact->id);
self::assertEquals('', $this->contact->content); self::assertEquals('', $this->contact->content);
self::assertEquals(0, $this->contact->order); self::assertEquals(0, $this->contact->order);
} }

View File

@ -37,7 +37,7 @@ final class ContactTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->contact->getId()); self::assertEquals(0, $this->contact->id);
self::assertEquals('', $this->contact->name1); self::assertEquals('', $this->contact->name1);
self::assertEquals('', $this->contact->name2); self::assertEquals('', $this->contact->name2);
self::assertEquals('', $this->contact->name3); self::assertEquals('', $this->contact->name3);

View File

@ -37,6 +37,6 @@ final class NullContactElementTest extends \PHPUnit\Framework\TestCase
public function testId() : void public function testId() : void
{ {
$null = new NullContactElement(2); $null = new NullContactElement(2);
self::assertEquals(2, $null->getId()); self::assertEquals(2, $null->id);
} }
} }

View File

@ -37,6 +37,6 @@ final class NullContactTest extends \PHPUnit\Framework\TestCase
public function testId() : void public function testId() : void
{ {
$null = new NullContact(2); $null = new NullContact(2);
self::assertEquals(2, $null->getId()); self::assertEquals(2, $null->id);
} }
} }

View File

@ -37,6 +37,6 @@ final class NullProfileTest extends \PHPUnit\Framework\TestCase
public function testId() : void public function testId() : void
{ {
$null = new NullProfile(2); $null = new NullProfile(2);
self::assertEquals(2, $null->getId()); self::assertEquals(2, $null->id);
} }
} }

View File

@ -39,7 +39,7 @@ final class ProfileMapperTest extends \PHPUnit\Framework\TestCase
$media->extension = 'png'; $media->extension = 'png';
$media->name = 'Image'; $media->name = 'Image';
if (($profile = ProfileMapper::get()->where('account', 1)->execute())->getId() === 0) { if (($profile = ProfileMapper::get()->where('account', 1)->execute())->id === 0) {
$profile = new Profile(); $profile = new Profile();
$profile->account = AccountMapper::get()->where('id', 1)->execute(); $profile->account = AccountMapper::get()->where('id', 1)->execute();
@ -47,8 +47,8 @@ final class ProfileMapperTest extends \PHPUnit\Framework\TestCase
$profile->birthday = new \DateTime('now'); $profile->birthday = new \DateTime('now');
$id = ProfileMapper::create()->execute($profile); $id = ProfileMapper::create()->execute($profile);
self::assertGreaterThan(0, $profile->getId()); self::assertGreaterThan(0, $profile->id);
self::assertEquals($id, $profile->getId()); self::assertEquals($id, $profile->id);
} else { } else {
$profile->image = $media; $profile->image = $media;
$profile->birthday = new \DateTime('now'); $profile->birthday = new \DateTime('now');
@ -56,7 +56,7 @@ final class ProfileMapperTest extends \PHPUnit\Framework\TestCase
ProfileMapper::update()->with('image')->execute($profile); ProfileMapper::update()->with('image')->execute($profile);
} }
$profileR = ProfileMapper::get()->with('image')->with('account')->where('id', $profile->getId())->execute(); $profileR = ProfileMapper::get()->with('image')->with('account')->where('id', $profile->id)->execute();
self::assertEquals($profile->birthday->format('Y-m-d'), $profileR->birthday->format('Y-m-d')); self::assertEquals($profile->birthday->format('Y-m-d'), $profileR->birthday->format('Y-m-d'));
self::assertEquals($profile->image->name, $profileR->image->name); self::assertEquals($profile->image->name, $profileR->image->name);
} }

View File

@ -43,7 +43,7 @@ final class ProfileTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->profile->getId()); self::assertEquals(0, $this->profile->id);
self::assertEquals(GenderType::OTHER, $this->profile->getGender()); self::assertEquals(GenderType::OTHER, $this->profile->getGender());
self::assertEquals(SexType::OTHER, $this->profile->getSex()); self::assertEquals(SexType::OTHER, $this->profile->getSex());
self::assertInstanceOf('\Modules\Media\Models\Media', $this->profile->image); self::assertInstanceOf('\Modules\Media\Models\Media', $this->profile->image);
@ -110,7 +110,7 @@ final class ProfileTest extends \PHPUnit\Framework\TestCase
public function testImageInputOutput() : void public function testImageInputOutput() : void
{ {
$this->profile->image = new NullMedia(1); $this->profile->image = new NullMedia(1);
self::assertEquals(1, $this->profile->image->getId()); self::assertEquals(1, $this->profile->image->id);
} }
/** /**
@ -120,10 +120,10 @@ final class ProfileTest extends \PHPUnit\Framework\TestCase
public function testAccountInputOutput() : void public function testAccountInputOutput() : void
{ {
$this->profile->account = new NullAccount(1); $this->profile->account = new NullAccount(1);
self::assertEquals(1, $this->profile->account->getId()); self::assertEquals(1, $this->profile->account->id);
$profile = new Profile(new NullAccount(1)); $profile = new Profile(new NullAccount(1));
self::assertEquals(1, $profile->account->getId()); self::assertEquals(1, $profile->account->id);
} }
/** /**