diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index ecd2072..c22cbad 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -25,6 +25,7 @@ use phpOMS\Application\ApplicationAbstract; use phpOMS\DataStorage\Session\HttpSession; use phpOMS\Dispatcher\Dispatcher; use phpOMS\Event\EventManager; +use phpOMS\Localization\L11nManager; use phpOMS\Module\ModuleAbstract; use phpOMS\Module\ModuleManager; use phpOMS\Router\WebRouter; @@ -63,6 +64,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase $this->app->eventManager = new EventManager($this->app->dispatcher); $this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php'); $this->app->sessionManager = new HttpSession(36000); + $this->app->l11nManager = new L11nManager(); $account = new Account(); TestUtils::setMember($account, 'id', 1); diff --git a/tests/Models/NullSupplierAttributeTest.php b/tests/Models/NullSupplierAttributeTest.php deleted file mode 100755 index b2431e9..0000000 --- a/tests/Models/NullSupplierAttributeTest.php +++ /dev/null @@ -1,42 +0,0 @@ -getId()); - } -} diff --git a/tests/Models/NullSupplierAttributeTypeTest.php b/tests/Models/NullSupplierAttributeTypeTest.php deleted file mode 100755 index 904e275..0000000 --- a/tests/Models/NullSupplierAttributeTypeTest.php +++ /dev/null @@ -1,42 +0,0 @@ -getId()); - } -} diff --git a/tests/Models/NullSupplierAttributeValueTest.php b/tests/Models/NullSupplierAttributeValueTest.php deleted file mode 100755 index a28cb7c..0000000 --- a/tests/Models/NullSupplierAttributeValueTest.php +++ /dev/null @@ -1,42 +0,0 @@ -getId()); - } -} diff --git a/tests/Models/SupplierAttributeTest.php b/tests/Models/SupplierAttributeTest.php deleted file mode 100755 index e6c2783..0000000 --- a/tests/Models/SupplierAttributeTest.php +++ /dev/null @@ -1,63 +0,0 @@ -attribute = new SupplierAttribute(); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttribute - * @group module - */ - public function testDefault() : void - { - self::assertEquals(0, $this->attribute->getId()); - self::assertInstanceOf('\Modules\SupplierManagement\Models\SupplierAttributeType', $this->attribute->type); - self::assertInstanceOf('\Modules\SupplierManagement\Models\SupplierAttributeValue', $this->attribute->value); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttribute - * @group module - */ - public function testSerialize() : void - { - $serialized = $this->attribute->jsonSerialize(); - - self::assertEquals( - [ - 'id', - 'supplier', - 'type', - 'value', - ], - \array_keys($serialized) - ); - } -} diff --git a/tests/Models/SupplierAttributeTypeTest.php b/tests/Models/SupplierAttributeTypeTest.php deleted file mode 100755 index 738eb65..0000000 --- a/tests/Models/SupplierAttributeTypeTest.php +++ /dev/null @@ -1,82 +0,0 @@ -type = new SupplierAttributeType(); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeType - * @group module - */ - public function testDefault() : void - { - self::assertEquals(0, $this->type->getId()); - self::assertEquals('', $this->type->getL11n()); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeType - * @group module - */ - public function testL11nInputOutput() : void - { - $this->type->setL11n('Test'); - self::assertEquals('Test', $this->type->getL11n()); - - $this->type->setL11n(new BaseStringL11n('NewTest')); - self::assertEquals('NewTest', $this->type->getL11n()); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeType - * @group module - */ - public function testSerialize() : void - { - $this->type->name = 'Title'; - $this->type->fields = 2; - $this->type->custom = true; - $this->type->validationPattern = '\d*'; - $this->type->isRequired = true; - - self::assertEquals( - [ - 'id' => 0, - 'name' => 'Title', - 'fields' => 2, - 'custom' => true, - 'validationPattern' => '\d*', - 'isRequired' => true, - ], - $this->type->jsonSerialize() - ); - } -} diff --git a/tests/Models/SupplierAttributeValueTest.php b/tests/Models/SupplierAttributeValueTest.php deleted file mode 100755 index a015d10..0000000 --- a/tests/Models/SupplierAttributeValueTest.php +++ /dev/null @@ -1,107 +0,0 @@ -value = new SupplierAttributeValue(); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeValue - * @group module - */ - public function testDefault() : void - { - self::assertEquals(0, $this->value->getId()); - self::assertNull($this->value->getValue()); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeValue - * @group module - */ - public function testValueIntInputOutput() : void - { - $this->value->setValue(1, AttributeValueType::_INT); - self::assertEquals(1, $this->value->getValue()); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeValue - * @group module - */ - public function testValueFloatInputOutput() : void - { - $this->value->setValue(1.1, AttributeValueType::_FLOAT); - self::assertEquals(1.1, $this->value->getValue()); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeValue - * @group module - */ - public function testValueStringInputOutput() : void - { - $this->value->setValue('test', AttributeValueType::_STRING); - self::assertEquals('test', $this->value->getValue()); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeValue - * @group module - */ - public function testValueDateInputOutput() : void - { - $dat = new \DateTime('now'); - $this->value->setValue('now', AttributeValueType::_DATETIME); - self::assertEquals($dat->format('Y-m-d'), $this->value->getValue()->format('Y-m-d')); - } - - /** - * @covers Modules\SupplierManagement\Models\SupplierAttributeValue - * @group module - */ - public function testSerialize() : void - { - $this->value->setValue('test', AttributeValueType::_STRING); - $this->value->isDefault = true; - - self::assertEquals( - [ - 'id' => 0, - 'valueInt' => null, - 'valueStr' => 'test', - 'valueDec' => null, - 'valueDat' => null, - 'isDefault' => true, - ], - $this->value->jsonSerialize() - ); - } -} diff --git a/tests/Models/SupplierTest.php b/tests/Models/SupplierTest.php index 54e7bcd..386c2f9 100755 --- a/tests/Models/SupplierTest.php +++ b/tests/Models/SupplierTest.php @@ -52,7 +52,7 @@ final class SupplierTest extends \PHPUnit\Framework\TestCase self::assertEquals([], $this->supplier->getAddresses()); self::assertEquals([], $this->supplier->getContactElements()); self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->supplier->createdAt->format('Y-m-d')); - self::assertInstanceOf('\Modules\Profile\Models\Profile', $this->supplier->profile); + self::assertInstanceOf('\Modules\Admin\Models\Account', $this->supplier->account); self::assertInstanceOf('\Modules\Admin\Models\Address', $this->supplier->mainAddress); self::assertInstanceOf('\Modules\Profile\Models\NullContactElement', $this->supplier->getMainContactElement(0)); }