mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-05 10:48: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
|
||||
|
||||
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.
|
||||
|
||||
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]`.
|
||||
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.
|
||||
|
||||
### Code Style
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\Profile\Models;
|
|||
*/
|
||||
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}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
|
@ -252,4 +252,12 @@ class Profile implements \JsonSerializable
|
|||
'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) : ?>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('cType' . $contact->getType()); ?>
|
||||
<td><?= $contact->getType() === ContactType::WEBSITE ? '<a href="' . $contact->getContent() . '">' : ''; ?>
|
||||
<?= $contact->getContent(); ?>
|
||||
<td><?= $contact->getType() === ContactType::WEBSITE ? '<a href="' . $contact->content . '">' : ''; ?>
|
||||
<?= $contact->content; ?>
|
||||
<?= $contact->getType() === ContactType::WEBSITE ? '</a>' : ''; ?>
|
||||
<?php endforeach; endif; ?>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\ISO3166TwoEnum;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Stdlib\Base\AddressType;
|
||||
use phpOMS\System\MimeType;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Stdlib\Base\AddressType;
|
||||
use phpOMS\Localization\ISO3166TwoEnum;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -240,6 +240,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$this->module->apiAddressCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Profile\Controller\ApiController
|
||||
* @group module
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ final class ContactTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $this->contact->description);
|
||||
self::assertEquals('', $this->contact->company);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
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