mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-16 15:28:41 +00:00
cs fixes, bug fixes, code coverage
This commit is contained in:
parent
fc1d2762c6
commit
e284ef4f24
|
|
@ -12,9 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all
|
||||||
|
|
||||||
### Issues
|
### Issues
|
||||||
|
|
||||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository.
|
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code marked with `@todo` or in the [PROJECT.md](https://github.com/Orange-Management/Docs/blob/master/Project/PROJECT.md) file.
|
||||||
|
|
||||||
The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`.
|
|
||||||
|
|
||||||
### Code Style
|
### Code Style
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,15 @@ namespace Modules\Profile\Models;
|
||||||
*/
|
*/
|
||||||
final class NullContactElement extends ContactElement
|
final class NullContactElement extends ContactElement
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param int $id Model id
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function __construct(int $id = 0)
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ class Profile implements \JsonSerializable
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function jsonSerialize()
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
|
|
@ -252,4 +252,12 @@ class Profile implements \JsonSerializable
|
||||||
'contactelements' => $this->contactElements,
|
'contactelements' => $this->contactElements,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,8 @@ echo $this->getData('nav')->render();
|
||||||
<?php else: foreach($contacts as $contact) : ?>
|
<?php else: foreach($contacts as $contact) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->getHtml('cType' . $contact->getType()); ?>
|
<th><?= $this->getHtml('cType' . $contact->getType()); ?>
|
||||||
<td><?= $contact->getType() === ContactType::WEBSITE ? '<a href="' . $contact->getContent() . '">' : ''; ?>
|
<td><?= $contact->getType() === ContactType::WEBSITE ? '<a href="' . $contact->content . '">' : ''; ?>
|
||||||
<?= $contact->getContent(); ?>
|
<?= $contact->content; ?>
|
||||||
<?= $contact->getType() === ContactType::WEBSITE ? '</a>' : ''; ?>
|
<?= $contact->getType() === ContactType::WEBSITE ? '</a>' : ''; ?>
|
||||||
<?php endforeach; endif; ?>
|
<?php endforeach; endif; ?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,17 @@ use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
use phpOMS\Dispatcher\Dispatcher;
|
use phpOMS\Dispatcher\Dispatcher;
|
||||||
use phpOMS\Event\EventManager;
|
use phpOMS\Event\EventManager;
|
||||||
|
use phpOMS\Localization\ISO3166TwoEnum;
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
|
use phpOMS\Module\ModuleAbstract;
|
||||||
use phpOMS\Module\ModuleManager;
|
use phpOMS\Module\ModuleManager;
|
||||||
use phpOMS\Router\WebRouter;
|
use phpOMS\Router\WebRouter;
|
||||||
|
use phpOMS\Stdlib\Base\AddressType;
|
||||||
use phpOMS\System\MimeType;
|
use phpOMS\System\MimeType;
|
||||||
use phpOMS\Uri\HttpUri;
|
use phpOMS\Uri\HttpUri;
|
||||||
use phpOMS\Utils\TestUtils;
|
use phpOMS\Utils\TestUtils;
|
||||||
use phpOMS\Module\ModuleAbstract;
|
|
||||||
use phpOMS\Stdlib\Base\AddressType;
|
|
||||||
use phpOMS\Localization\ISO3166TwoEnum;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
|
@ -240,6 +240,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiAddressCreate($request, $response);
|
$this->module->apiAddressCreate($request, $response);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Modules\Profile\Controller\ApiController
|
* @covers Modules\Profile\Controller\ApiController
|
||||||
* @group module
|
* @group module
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ final class ContactTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals('', $this->contact->description);
|
self::assertEquals('', $this->contact->description);
|
||||||
self::assertEquals('', $this->contact->company);
|
self::assertEquals('', $this->contact->company);
|
||||||
self::assertEquals('', $this->contact->job);
|
self::assertEquals('', $this->contact->job);
|
||||||
self::assertEquals(null, $this->contact->birthday);
|
self::assertNull($this->contact->birthday);
|
||||||
self::assertInstanceOf('\Modules\Media\Models\Media', $this->contact->image);
|
self::assertInstanceOf('\Modules\Media\Models\Media', $this->contact->image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
tests/Models/NullContactElementTest.php
Normal file
42
tests/Models/NullContactElementTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 8.0
|
||||||
|
*
|
||||||
|
* @package tests
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Profile\tests\Models;
|
||||||
|
|
||||||
|
use Modules\Profile\Models\NullContactElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class NullContactElementTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers Modules\Profile\Models\NullContactElement
|
||||||
|
* @group framework
|
||||||
|
*/
|
||||||
|
public function testNull() : void
|
||||||
|
{
|
||||||
|
self::assertInstanceOf('\Modules\Profile\Models\ContactElement', new NullContactElement());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Profile\Models\NullContactElement
|
||||||
|
* @group framework
|
||||||
|
*/
|
||||||
|
public function testId() : void
|
||||||
|
{
|
||||||
|
$null = new NullContactElement(2);
|
||||||
|
self::assertEquals(2, $null->getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user