mirror of
https://github.com/Karaka-Management/oms-Accounting.git
synced 2026-02-11 18:28:40 +00:00
get overall coverage to 76%
This commit is contained in:
parent
f2e8a01a5f
commit
804e1fa71d
|
|
@ -69,4 +69,22 @@ class Balance
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function toArray() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,4 +77,24 @@ class CostCenter
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function toArray() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'code' => $this->code,
|
||||||
|
'parent' => $this->parent,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,4 +77,24 @@ class CostObject
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function toArray() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'code' => $this->code,
|
||||||
|
'parent' => $this->parent,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,23 @@ class Creditor
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function toArray() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'account' => $this->account,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,23 @@ class Debitor
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function toArray() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'account' => $this->account,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ trait ApiControllerAccountTrait
|
||||||
*/
|
*/
|
||||||
public function testApiAccountCreate() : void
|
public function testApiAccountCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
|
|
@ -45,7 +45,7 @@ trait ApiControllerAccountTrait
|
||||||
*/
|
*/
|
||||||
public function testApiAccountCreateInvalid() : void
|
public function testApiAccountCreateInvalid() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
|
|
@ -61,7 +61,7 @@ trait ApiControllerAccountTrait
|
||||||
*/
|
*/
|
||||||
public function testApiAccountUpdate() : void
|
public function testApiAccountUpdate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
|
|
@ -79,7 +79,7 @@ trait ApiControllerAccountTrait
|
||||||
*/
|
*/
|
||||||
public function testApiAccountUpdateInvalid() : void
|
public function testApiAccountUpdateInvalid() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,18 @@ final class BalanceTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->balance->getId());
|
self::assertEquals(0, $this->balance->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Accounting\Models\Balance
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testSerialize() : void
|
||||||
|
{
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
],
|
||||||
|
$this->balance->jsonSerialize()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
47
tests/Models/BatchPostingTest.php
Normal file
47
tests/Models/BatchPostingTest.php
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?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\Accounting\tests\Models;
|
||||||
|
|
||||||
|
use Modules\Accounting\Models\BatchPosting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class BatchPostingTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
private BatchPosting $batch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function setUp() : void
|
||||||
|
{
|
||||||
|
$this->batch = new BatchPosting();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Accounting\Models\BatchPosting
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testDefault() : void
|
||||||
|
{
|
||||||
|
self::assertEquals(0, $this->batch->getId());
|
||||||
|
self::assertEquals(0, $this->batch->creator);
|
||||||
|
self::assertEquals('', $this->batch->description);
|
||||||
|
self::assertEquals(0, $this->batch->count());
|
||||||
|
self::assertEquals(null, $this->batch->getPosting(1));
|
||||||
|
self::assertInstanceOf('\DateTimeImmutable', $this->batch->created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -61,4 +61,22 @@ final class CostCenterTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->cc->parent = 1;
|
$this->cc->parent = 1;
|
||||||
self::assertEquals(1, $this->cc->parent);
|
self::assertEquals(1, $this->cc->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Accounting\Models\CostCenter
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testSerialize() : void
|
||||||
|
{
|
||||||
|
$this->cc->code = '123';
|
||||||
|
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'code' => '123',
|
||||||
|
'parent' => null,
|
||||||
|
],
|
||||||
|
$this->cc->jsonSerialize()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,14 @@ use Modules\Accounting\Models\CostObject;
|
||||||
*/
|
*/
|
||||||
final class CostObjectTest extends \PHPUnit\Framework\TestCase
|
final class CostObjectTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private CostObject $cc;
|
private CostObject $co;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function setUp() : void
|
protected function setUp() : void
|
||||||
{
|
{
|
||||||
$this->cc = new CostObject();
|
$this->co = new CostObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,9 +37,9 @@ final class CostObjectTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testDefault() : void
|
public function testDefault() : void
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->cc->getId());
|
self::assertEquals(0, $this->co->getId());
|
||||||
self::assertEquals('', $this->cc->code);
|
self::assertEquals('', $this->co->code);
|
||||||
self::assertNull($this->cc->parent);
|
self::assertNull($this->co->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -48,8 +48,8 @@ final class CostObjectTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testCodeInputOutput() : void
|
public function testCodeInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->cc->code = 'TestCode';
|
$this->co->code = 'TestCode';
|
||||||
self::assertEquals('TestCode', $this->cc->code);
|
self::assertEquals('TestCode', $this->co->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,7 +58,25 @@ final class CostObjectTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testParentInputOutput() : void
|
public function testParentInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->cc->parent = 1;
|
$this->co->parent = 1;
|
||||||
self::assertEquals(1, $this->cc->parent);
|
self::assertEquals(1, $this->co->parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Accounting\Models\CostObject
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testSerialize() : void
|
||||||
|
{
|
||||||
|
$this->co->code = '123';
|
||||||
|
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'code' => '123',
|
||||||
|
'parent' => null,
|
||||||
|
],
|
||||||
|
$this->co->jsonSerialize()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,19 @@ final class CreditorTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->creditor->getId());
|
self::assertEquals(0, $this->creditor->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Accounting\Models\Creditor
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testSerialize() : void
|
||||||
|
{
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'account' => null,
|
||||||
|
],
|
||||||
|
$this->creditor->jsonSerialize()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,14 @@ use Modules\Accounting\Models\Debitor;
|
||||||
*/
|
*/
|
||||||
final class DebitorTest extends \PHPUnit\Framework\TestCase
|
final class DebitorTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private Debitor $creditor;
|
private Debitor $debitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function setUp() : void
|
protected function setUp() : void
|
||||||
{
|
{
|
||||||
$this->creditor = new Debitor();
|
$this->debitor = new Debitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,6 +37,21 @@ final class DebitorTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testDefault() : void
|
public function testDefault() : void
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->creditor->getId());
|
self::assertEquals(0, $this->debitor->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Accounting\Models\Debitor
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testSerialize() : void
|
||||||
|
{
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'account' => null,
|
||||||
|
],
|
||||||
|
$this->debitor->jsonSerialize()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?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\Accounting\tests\Models;
|
|
||||||
|
|
||||||
use Modules\Accounting\Models\NullCostCenter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
final class Null extends \PHPUnit\Framework\TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @covers Modules\Accounting\Models\NullCostCenter
|
|
||||||
* @group framework
|
|
||||||
*/
|
|
||||||
public function testNull() : void
|
|
||||||
{
|
|
||||||
self::assertInstanceOf('\Modules\Accounting\Models\CostCenter', new NullCostCenter());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers Modules\Accounting\Models\NullCostCenter
|
|
||||||
* @group framework
|
|
||||||
*/
|
|
||||||
public function testId() : void
|
|
||||||
{
|
|
||||||
$null = new NullCostCenter(2);
|
|
||||||
self::assertEquals(2, $null->getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?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\Accounting\tests\Models;
|
|
||||||
|
|
||||||
use Modules\Accounting\Models\NullCostObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
final class Null extends \PHPUnit\Framework\TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @covers Modules\Accounting\Models\NullCostObject
|
|
||||||
* @group framework
|
|
||||||
*/
|
|
||||||
public function testNull() : void
|
|
||||||
{
|
|
||||||
self::assertInstanceOf('\Modules\Accounting\Models\CostObject', new NullCostObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers Modules\Accounting\Models\NullCostObject
|
|
||||||
* @group framework
|
|
||||||
*/
|
|
||||||
public function testId() : void
|
|
||||||
{
|
|
||||||
$null = new NullCostObject(2);
|
|
||||||
self::assertEquals(2, $null->getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user