mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-01-26 00:28:40 +00:00
test fixes
This commit is contained in:
parent
02fbb6f1ef
commit
11a65af910
|
|
@ -24,6 +24,7 @@ use phpOMS\DataStorage\Session\HttpSession;
|
|||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
|
|
@ -66,6 +67,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);
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests\Models;
|
||||
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class ContractTypeL11nTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private ContractTypeL11n $l11n;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() : void
|
||||
{
|
||||
$this->l11n = new ContractTypeL11n();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Models\ContractTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->l11n->getId());
|
||||
self::assertEquals('', $this->l11n->title);
|
||||
self::assertEquals(0, $this->l11n->type);
|
||||
self::assertEquals(ISO639x1Enum::_EN, $this->l11n->getLanguage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Models\ContractTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testNameInputOutput() : void
|
||||
{
|
||||
$this->l11n->title = 'TestName';
|
||||
self::assertEquals('TestName', $this->l11n->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Models\ContractTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testLanguageInputOutput() : void
|
||||
{
|
||||
$this->l11n->setLanguage(ISO639x1Enum::_DE);
|
||||
self::assertEquals(ISO639x1Enum::_DE, $this->l11n->getLanguage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Models\ContractTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->l11n->title = 'Title';
|
||||
$this->l11n->type = 2;
|
||||
$this->l11n->setLanguage(ISO639x1Enum::_DE);
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'title' => 'Title',
|
||||
'type' => 2,
|
||||
'language' => ISO639x1Enum::_DE,
|
||||
],
|
||||
$this->l11n->jsonSerialize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ namespace Modules\ContractManagement\tests\Models;
|
|||
|
||||
use Modules\ContractManagement\Models\ContractType;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -51,7 +52,7 @@ final class ContractTypeTest extends \PHPUnit\Framework\TestCase
|
|||
$this->type->setL11n('Test');
|
||||
self::assertEquals('Test', $this->type->getL11n());
|
||||
|
||||
$this->type->setL11n(new ContractTypeL11n(0, 'NewTest'));
|
||||
$this->type->setL11n(new BaseStringL11n('NewTest'));
|
||||
self::assertEquals('NewTest', $this->type->getL11n());
|
||||
}
|
||||
|
||||
|
|
@ -61,12 +62,10 @@ final class ContractTypeTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->type->type = 1;
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'l11n' => new ContractTypeL11n(),
|
||||
'l11n' => new BaseStringL11n(),
|
||||
],
|
||||
$this->type->jsonSerialize()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests\Models;
|
||||
|
||||
use Modules\ContractManagement\Models\NullContractTypeL11n;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullContractTypeL11nTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Models\NullContractTypeL11n
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\ContractManagement\Models\ContractTypeL11n', new NullContractTypeL11n());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Models\NullContractTypeL11n
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullContractTypeL11n(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user