diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 342fa61..cfe42f6 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -32,11 +32,11 @@ use Modules\ClientManagement\Models\NullClientAttributeValue; use Modules\Media\Models\PathSettings; use Modules\Profile\Models\ContactElementMapper; use Modules\Profile\Models\Profile; +use phpOMS\Localization\ISO639x1Enum; use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Message\NotificationLevel; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; -use phpOMS\Localization\ISO639x1Enum; use phpOMS\Model\Message\FormValidation; /** @@ -271,7 +271,7 @@ final class ApiController extends Controller */ private function createClientAttributeTypeL11nFromRequest(RequestAbstract $request) : ClientAttributeTypeL11n { - $attrL11n = new ClientAttributeTypeL11n(); + $attrL11n = new ClientAttributeTypeL11n(); $attrL11n->type = (int) ($request->getData('type') ?? 0); $attrL11n->setLanguage((string) ( $request->getData('language') ?? $request->getLanguage() @@ -489,7 +489,8 @@ final class ApiController extends Controller } $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( - [$request->getData('name') ?? ''], + $request->getDataList('names') ?? [], + $request->getDataList('filenames') ?? [], $uploadedFiles, $request->header->account, __DIR__ . '/../../../Modules/Media/Files/Modules/ClientManagement/' . ($request->getData('client') ?? '0'), diff --git a/Models/Client.php b/Models/Client.php index 544567a..456d41c 100755 --- a/Models/Client.php +++ b/Models/Client.php @@ -18,7 +18,6 @@ use Modules\Admin\Models\Address; use Modules\Admin\Models\NullAddress; use Modules\Editor\Models\EditorDoc; use Modules\Media\Models\Media; -use Modules\Media\Models\NullMedia; use Modules\Profile\Models\ContactElement; use Modules\Profile\Models\NullContactElement; use Modules\Profile\Models\Profile; @@ -315,12 +314,12 @@ class Client public function toArray() : array { return [ - 'id' => $this->id, - 'number' => $this->number, + 'id' => $this->id, + 'number' => $this->number, 'numberReverse' => $this->numberReverse, - 'status' => $this->status, - 'type' => $this->type, - 'info' => $this->info, + 'status' => $this->status, + 'type' => $this->type, + 'info' => $this->info, ]; } diff --git a/Models/ClientAttribute.php b/Models/ClientAttribute.php index 379a17f..921fae8 100755 --- a/Models/ClientAttribute.php +++ b/Models/ClientAttribute.php @@ -65,7 +65,7 @@ class ClientAttribute implements \JsonSerializable, ArrayableInterface */ public function __construct() { - $this->type = new ClientAttributeType(); + $this->type = new ClientAttributeType(); $this->value = new ClientAttributeValue(); } @@ -87,8 +87,8 @@ class ClientAttribute implements \JsonSerializable, ArrayableInterface public function toArray() : array { return [ - 'id' => $this->id, - 'type' => $this->type, + 'id' => $this->id, + 'type' => $this->type, 'value' => $this->value, ]; } diff --git a/Models/ClientAttributeType.php b/Models/ClientAttributeType.php index e85e668..8a25f46 100755 --- a/Models/ClientAttributeType.php +++ b/Models/ClientAttributeType.php @@ -141,12 +141,12 @@ class ClientAttributeType implements \JsonSerializable, ArrayableInterface public function toArray() : array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'fields' => $this->fields, - 'custom' => $this->custom, + 'id' => $this->id, + 'name' => $this->name, + 'fields' => $this->fields, + 'custom' => $this->custom, 'validationPattern' => $this->validationPattern, - 'isRequired' => $this->isRequired, + 'isRequired' => $this->isRequired, ]; } diff --git a/Models/ClientAttributeTypeL11n.php b/Models/ClientAttributeTypeL11n.php index 0bd873b..6c77bdf 100755 --- a/Models/ClientAttributeTypeL11n.php +++ b/Models/ClientAttributeTypeL11n.php @@ -119,9 +119,9 @@ class ClientAttributeTypeL11n implements \JsonSerializable, ArrayableInterface public function toArray() : array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'type' => $this->type, + 'id' => $this->id, + 'title' => $this->title, + 'type' => $this->type, 'language' => $this->language, ]; } diff --git a/Models/ClientAttributeValue.php b/Models/ClientAttributeValue.php index c569782..f9b6b7e 100755 --- a/Models/ClientAttributeValue.php +++ b/Models/ClientAttributeValue.php @@ -233,15 +233,15 @@ class ClientAttributeValue implements \JsonSerializable, ArrayableInterface public function toArray() : array { return [ - 'id' => $this->id, - 'type' => $this->type, - 'valueInt' => $this->valueInt, - 'valueStr' => $this->valueStr, - 'valueDec' => $this->valueDec, - 'valueDat' => $this->valueDat, + 'id' => $this->id, + 'type' => $this->type, + 'valueInt' => $this->valueInt, + 'valueStr' => $this->valueStr, + 'valueDec' => $this->valueDec, + 'valueDat' => $this->valueDat, 'isDefault' => $this->isDefault, - 'language' => $this->language, - 'country' => $this->country, + 'language' => $this->language, + 'country' => $this->country, ]; } diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 051ac7e..f5fc99c 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -392,4 +392,4 @@ function phpServe() : void }); } -phpServe(); +\phpServe(); diff --git a/tests/Controller/Api/ApiControllerAttributeTrait.php b/tests/Controller/Api/ApiControllerAttributeTrait.php index c4d1569..166ba3f 100644 --- a/tests/Controller/Api/ApiControllerAttributeTrait.php +++ b/tests/Controller/Api/ApiControllerAttributeTrait.php @@ -14,21 +14,17 @@ declare(strict_types=1); namespace Modules\ClientManagement\tests\Controller\Api; +use Modules\ClientManagement\Models\AttributeValueType; +use phpOMS\Localization\ISO3166TwoEnum; +use phpOMS\Localization\ISO639x1Enum; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Uri\HttpUri; -use Modules\ClientManagement\Models\AttributeValueType; -use Modules\Profile\Models\ContactType; -use phpOMS\Localization\ISO3166TwoEnum; -use phpOMS\Localization\ISO639x1Enum; -use phpOMS\Stdlib\Base\AddressType; -use phpOMS\System\MimeType; -use phpOMS\Utils\TestUtils; trait ApiControllerAttributeTrait { - /** + /** * @covers Modules\ClientManagement\Controller\ApiController * @group module */ @@ -141,7 +137,7 @@ trait ApiControllerAttributeTrait self::assertGreaterThan(0, $response->get('')['response']->getId()); } - /** + /** * @covers Modules\ClientManagement\Controller\ApiController * @group module */ @@ -159,7 +155,7 @@ trait ApiControllerAttributeTrait self::assertGreaterThan(0, $response->get('')['response']->getId()); } - /** + /** * @covers Modules\ClientManagement\Controller\ApiController * @group module */ diff --git a/tests/Controller/Api/ApiControllerClientTrait.php b/tests/Controller/Api/ApiControllerClientTrait.php index e6bc300..9c9ed98 100644 --- a/tests/Controller/Api/ApiControllerClientTrait.php +++ b/tests/Controller/Api/ApiControllerClientTrait.php @@ -14,16 +14,13 @@ declare(strict_types=1); namespace Modules\ClientManagement\tests\Controller\Api; +use Modules\Profile\Models\ContactType; +use phpOMS\Localization\ISO3166TwoEnum; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\RequestStatusCode; -use phpOMS\Uri\HttpUri; -use Modules\ClientManagement\Models\AttributeValueType; -use Modules\Profile\Models\ContactType; -use phpOMS\Localization\ISO3166TwoEnum; -use phpOMS\Localization\ISO639x1Enum; -use phpOMS\Stdlib\Base\AddressType; use phpOMS\System\MimeType; +use phpOMS\Uri\HttpUri; use phpOMS\Utils\TestUtils; trait ApiControllerClientTrait @@ -31,11 +28,11 @@ trait ApiControllerClientTrait public static function tearDownAfterClass() : void { if (\is_file(__DIR__ . '/m_icon_tmp.png')) { - unlink(__DIR__ . '/m_icon_tmp.png'); + \unlink(__DIR__ . '/m_icon_tmp.png'); } if (\is_file(__DIR__ . '/Test file_tmp.txt')) { - unlink(__DIR__ . '/Test file_tmp.txt'); + \unlink(__DIR__ . '/Test file_tmp.txt'); } } diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index a191403..80bc76c 100644 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -16,13 +16,13 @@ namespace Modules\ClientManagement\tests\Controller; use Model\CoreSettings; use Modules\Admin\Models\AccountPermission; -use Modules\ClientManagement\tests\Controller\Api\ApiControllerClientTrait; use Modules\ClientManagement\tests\Controller\Api\ApiControllerAttributeTrait; -use phpOMS\DataStorage\Session\HttpSession; +use Modules\ClientManagement\tests\Controller\Api\ApiControllerClientTrait; use phpOMS\Account\Account; use phpOMS\Account\AccountManager; use phpOMS\Account\PermissionType; use phpOMS\Application\ApplicationAbstract; +use phpOMS\DataStorage\Session\HttpSession; use phpOMS\Dispatcher\Dispatcher; use phpOMS\Event\EventManager; use phpOMS\Module\ModuleAbstract; diff --git a/tests/Models/ClientAttributeTypeL11nTest.php b/tests/Models/ClientAttributeTypeL11nTest.php index 36b8f58..8310d44 100644 --- a/tests/Models/ClientAttributeTypeL11nTest.php +++ b/tests/Models/ClientAttributeTypeL11nTest.php @@ -70,16 +70,16 @@ final class ClientAttributeTypeL11nTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->l11n->title = 'Title'; + $this->l11n->title = 'Title'; $this->l11n->type = 2; $this->l11n->setLanguage(ISO639x1Enum::_DE); self::assertEquals( [ - 'id' => 0, - 'title' => 'Title', + 'id' => 0, + 'title' => 'Title', 'type' => 2, - 'language' => ISO639x1Enum::_DE, + 'language' => ISO639x1Enum::_DE, ], $this->l11n->jsonSerialize() ); diff --git a/tests/Models/ClientAttributeTypeTest.php b/tests/Models/ClientAttributeTypeTest.php index cec90c0..94397ae 100644 --- a/tests/Models/ClientAttributeTypeTest.php +++ b/tests/Models/ClientAttributeTypeTest.php @@ -16,7 +16,6 @@ namespace Modules\ClientManagement\tests\Models; use Modules\ClientManagement\Models\ClientAttributeType; use Modules\ClientManagement\Models\ClientAttributeTypeL11n; -use phpOMS\Localization\ISO639x1Enum; /** * @internal @@ -62,20 +61,20 @@ final class ClientAttributeTypeTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->type->name = 'Title'; - $this->type->fields = 2; - $this->type->custom = true; + $this->type->name = 'Title'; + $this->type->fields = 2; + $this->type->custom = true; $this->type->validationPattern = '\d*'; - $this->type->isRequired = true; + $this->type->isRequired = true; self::assertEquals( [ - 'id' => 0, - 'name' => 'Title', - 'fields' => 2, - 'custom' => true, + 'id' => 0, + 'name' => 'Title', + 'fields' => 2, + 'custom' => true, 'validationPattern' => '\d*', - 'isRequired' => true, + 'isRequired' => true, ], $this->type->jsonSerialize() ); diff --git a/tests/Models/ClientAttributeValueTest.php b/tests/Models/ClientAttributeValueTest.php index 1692b3e..f99e724 100644 --- a/tests/Models/ClientAttributeValueTest.php +++ b/tests/Models/ClientAttributeValueTest.php @@ -40,7 +40,7 @@ final class ClientAttributeValueTest extends \PHPUnit\Framework\TestCase public function testDefault() : void { self::assertEquals(0, $this->value->getId()); - self::assertEquals(null, $this->value->getValue()); + self::assertNull($this->value->getValue()); } /** @@ -117,15 +117,15 @@ final class ClientAttributeValueTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ - 'id' => 0, - 'type' => 1, - 'valueInt' => null, - 'valueStr' => 'test', - 'valueDec' => null, - 'valueDat' => null, + 'id' => 0, + 'type' => 1, + 'valueInt' => null, + 'valueStr' => 'test', + 'valueDec' => null, + 'valueDat' => null, 'isDefault' => true, - 'language' => ISO639x1Enum::_DE, - 'country' => ISO3166TwoEnum::_DEU, + 'language' => ISO639x1Enum::_DE, + 'country' => ISO3166TwoEnum::_DEU, ], $this->value->jsonSerialize() ); diff --git a/tests/Models/ClientTest.php b/tests/Models/ClientTest.php index 111359a..aeda9f0 100755 --- a/tests/Models/ClientTest.php +++ b/tests/Models/ClientTest.php @@ -14,13 +14,11 @@ declare(strict_types=1); namespace Modules\ClientManagement\tests\Models; -use Modules\Media\Models\Media; -use Modules\Editor\Models\EditorDoc; -use Modules\Profile\Models\ContactElement; -use Modules\Admin\Models\Account; -use Modules\Admin\Models\NullAccount; use Modules\ClientManagement\Models\Client; use Modules\ClientManagement\Models\ClientStatus; +use Modules\Editor\Models\EditorDoc; +use Modules\Media\Models\Media; +use Modules\Profile\Models\ContactElement; /** * @internal @@ -118,7 +116,7 @@ final class ClientTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->client->number = '123456'; + $this->client->number = '123456'; $this->client->numberReverse = '654321'; $this->client->setStatus(ClientStatus::INACTIVE); $this->client->setType(2); @@ -126,12 +124,12 @@ final class ClientTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ - 'id' => 0, - 'number' => '123456', + 'id' => 0, + 'number' => '123456', 'numberReverse' => '654321', - 'status' => ClientStatus::INACTIVE, - 'type' => 2, - 'info' => 'Test info', + 'status' => ClientStatus::INACTIVE, + 'type' => 2, + 'info' => 'Test info', ], $this->client->jsonSerialize() ); diff --git a/tests/Models/NullClientAttributeTypeL11nTest.php b/tests/Models/NullClientAttributeTypeL11nTest.php index eb67e67..5f75421 100644 --- a/tests/Models/NullClientAttributeTypeL11nTest.php +++ b/tests/Models/NullClientAttributeTypeL11nTest.php @@ -30,7 +30,6 @@ final class NullClientAttributeTypeL11nTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\Modules\ClientManagement\Models\ClientAttributeTypeL11n', new NullClientAttributeTypeL11n()); } - /** * @covers Modules\ClientManagement\Models\NullClientAttributeTypeL11n * @group framework