mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-01-11 15:18:42 +00:00
get overall coverage to 76%
This commit is contained in:
parent
1133dbc8fb
commit
b3006024c3
|
|
@ -120,7 +120,7 @@ final class ApiController extends Controller
|
|||
private function validateBillCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['client/customer'] = empty($request->getData('client') && empty($request->getData('supplier'))))
|
||||
if (($val['client/customer'] = (empty($request->getData('client')) && empty($request->getData('supplier'))))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -274,10 +274,12 @@ final class ApiController extends Controller
|
|||
|
||||
$status = !\is_dir($pdfDir) ? \mkdir($pdfDir, 0755, true) : true;
|
||||
if ($status === false) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$response->set($request->uri->__toString(), new FormValidation(['status' => $status]));
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
|
|
|||
|
|
@ -621,11 +621,35 @@ class Bill implements \JsonSerializable
|
|||
return new NullMedia();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'number' => $this->number,
|
||||
'type' => $this->type,
|
||||
'shipTo' => $this->shipTo,
|
||||
'shipFAO' => $this->shipFAO,
|
||||
'shipAddress' => $this->shipAddress,
|
||||
'shipCity' => $this->shipCity,
|
||||
'shipZip' => $this->shipZip,
|
||||
'shipCountry' => $this->shipCountry,
|
||||
'billTo' => $this->billTo,
|
||||
'billFAO' => $this->billFAO,
|
||||
'billAddress' => $this->billAddress,
|
||||
'billCity' => $this->billCity,
|
||||
'billZip' => $this->billZip,
|
||||
'billCountry' => $this->billCountry,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return [];
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,11 +133,28 @@ class BillElement implements \JsonSerializable
|
|||
$this->item = $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'order' => $this->order,
|
||||
'item' => $this->item,
|
||||
'itemNumber' => $this->itemNumber,
|
||||
'itemName' => $this->itemName,
|
||||
'itemDescription' => $this->itemDescription,
|
||||
'quantity' => $this->quantity,
|
||||
'bill' => $this->bill,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return [];
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class BillType
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name Name/identifier of the attribute type
|
||||
* @param string $name Name
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ final class SalesBillMapper extends BillMapper
|
|||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemTopCustomers(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array
|
||||
public static function getItemTopClients(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@
|
|||
"load": [
|
||||
{
|
||||
"pid": [
|
||||
"/sales/billing",
|
||||
"/purchase/billing"
|
||||
"/sales/bill",
|
||||
"/purchase/bill",
|
||||
"/warehouse/bill"
|
||||
],
|
||||
"type": 4,
|
||||
"for": 0,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ final class AdminTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
protected const NAME = 'Billing';
|
||||
|
||||
protected const URI_LOAD = 'http://127.0.0.1/en/backend/admin/audit';
|
||||
protected const URI_LOAD = 'http://127.0.0.1/en/backend/sales/bill';
|
||||
|
||||
use \Modules\tests\ModuleTestTrait;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
* @covers Modules\Billing\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testBillCreate() : void
|
||||
public function testBillClientCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
|
@ -164,6 +164,80 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertGreaterThan(0, $result === null ? -1 : $result['response']?->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests bill, bill element and bill pdf archive create
|
||||
*
|
||||
* @covers Modules\Billing\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testBillSupplierCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
|
||||
$request->setData('supplier', 1);
|
||||
$request->setData('address', null);
|
||||
$request->setData('type', 1);
|
||||
$request->setData('status', null); // null = system settings, value = individual input
|
||||
$request->setData('performancedate', DateTime::generateDateTime(new \DateTime('2015-01-01'), new \DateTime('now'))->format('Y-m-d H:i:s'));
|
||||
$request->setData('sales_referral', null); // who these sales belong to
|
||||
$request->setData('shipping_terms', 1); // e.g. incoterms
|
||||
$request->setData('shipping_type', 1);
|
||||
$request->setData('shipping_cost', null);
|
||||
$request->setData('insurance_type', 1);
|
||||
$request->setData('insurance_cost', null); // null = system settings, value = individual input
|
||||
$request->setData('info', null); // null = system settings, value = individual input
|
||||
$request->setData('currency', null); // null = system settings, value = individual input
|
||||
$request->setData('payment', null); // null = system settings, value = individual input
|
||||
$request->setData('payment_terms', null); // null = system settings, value = individual input
|
||||
|
||||
$this->module->apiBillCreate($request, $response);
|
||||
|
||||
$bId = $response->get('')['response']->getId();
|
||||
self::assertGreaterThan(0, $bId);
|
||||
|
||||
for ($k = 0; $k < 10; ++$k) {
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
|
||||
$iId = \mt_rand(0, 10);
|
||||
|
||||
$request->setData('bill', $bId);
|
||||
$request->setData('item', $iId === 0 ? null : $iId);
|
||||
|
||||
if ($iId === 0) {
|
||||
// @todo: add text
|
||||
}
|
||||
|
||||
$request->setData('quantity', \mt_rand(1, 11));
|
||||
$request->setData('tax', null);
|
||||
$request->setData('text', $iId === 0 ? 'Some test text' : null);
|
||||
|
||||
// discounts
|
||||
if (\mt_rand(1, 100) < 31) {
|
||||
$request->setData('discount_percentage', \mt_rand(5, 30));
|
||||
}
|
||||
|
||||
$this->module->apiBillElementCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||
}
|
||||
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('bill', $bId);
|
||||
|
||||
$this->module->apiBillPdfArchiveCreate($request, $response);
|
||||
|
||||
$result = $response->get('');
|
||||
self::assertGreaterThan(0, $result === null ? -1 : $result['response']?->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Controller\ApiController
|
||||
* @group module
|
||||
|
|
@ -174,8 +248,25 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->module->apiBillCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testBillElementCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->module->apiBillElementCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,42 @@ final class BillElementTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->totalPurchasePriceNet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\BillElement
|
||||
* @group module
|
||||
*/
|
||||
public function testItemInputOutput() : void
|
||||
{
|
||||
$this->element->setItem(123);
|
||||
self::assertEquals(123, $this->element->item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\BillElement
|
||||
* @group module
|
||||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->element->order = 2;
|
||||
$this->element->item = 3;
|
||||
$this->element->itemNumber = '123456';
|
||||
$this->element->itemName = 'Test';
|
||||
$this->element->itemDescription = 'Description';
|
||||
$this->element->quantity = 4;
|
||||
$this->element->bill = 5;
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'order' => 2,
|
||||
'item' => 3,
|
||||
'itemNumber' => '123456',
|
||||
'itemName' => 'Test',
|
||||
'itemDescription' => 'Description',
|
||||
'quantity' => 4,
|
||||
'bill' => 5,
|
||||
],
|
||||
$this->element->jsonSerialize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\Bill;
|
||||
use Modules\Billing\Models\BillElement;
|
||||
use Modules\Billing\Models\BillStatus;
|
||||
use Modules\Billing\Models\BillType;
|
||||
use phpOMS\Localization\ISO4217CharEnum;
|
||||
|
|
@ -139,4 +140,57 @@ final class BillTest extends \PHPUnit\Framework\TestCase
|
|||
$this->bill->addTracking('TEST');
|
||||
self::assertEquals(['TEST'], $this->bill->getTrackings());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\Bill
|
||||
* @group module
|
||||
*/
|
||||
public function testElementInputOutput() : void
|
||||
{
|
||||
$this->bill->addElement(new BillElement());
|
||||
self::assertCount(1, $this->bill->getElements());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\Bill
|
||||
* @group module
|
||||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->bill->number = '123456';
|
||||
$this->bill->type = 2;
|
||||
$this->bill->shipTo = 'To';
|
||||
$this->bill->shipFAO = 'FAO';
|
||||
$this->bill->shipAddress = 'Address';
|
||||
$this->bill->shipCity = 'City';
|
||||
$this->bill->shipZip = 'Zip';
|
||||
$this->bill->shipCountry = 'Country';
|
||||
$this->bill->billTo = 'To';
|
||||
$this->bill->billFAO = 'FAO';
|
||||
$this->bill->billAddress = 'Address';
|
||||
$this->bill->billCity = 'City';
|
||||
$this->bill->billZip = 'Zip';
|
||||
$this->bill->billCountry = 'Country';
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'number' => '123456',
|
||||
'type' => 2,
|
||||
'shipTo' => 'To',
|
||||
'shipFAO' => 'FAO',
|
||||
'shipAddress' => 'Address',
|
||||
'shipCity' => 'City',
|
||||
'shipZip' => 'Zip',
|
||||
'shipCountry' => 'Country',
|
||||
'billTo' => 'To',
|
||||
'billFAO' => 'FAO',
|
||||
'billAddress' => 'Address',
|
||||
'billCity' => 'City',
|
||||
'billZip' => 'Zip',
|
||||
'billCountry' => 'Country',
|
||||
],
|
||||
$this->bill->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\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\NullBill;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Null extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\Billing\Models\NullBill
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\Billing\Models\Bill', new NullBill());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\NullBill
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullBill(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\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\NullBillElement;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Null extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\Billing\Models\NullBillElement
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\Billing\Models\BillElement', new NullBillElement());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\NullBillElement
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullBillElement(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\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\NullBillType;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Null extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\Billing\Models\NullBillType
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\Billing\Models\BillType', new NullBillType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\NullBillType
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullBillType(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
152
tests/Models/PurchaseBillMapperTest.php
Normal file
152
tests/Models/PurchaseBillMapperTest.php
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
<?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\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\PurchaseBillMapper;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\Billing\tests\Models\PurchaseBillMapperTest: App database mapper
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class PurchaseBillMapperTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetPurchaseBeforePivotInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getPurchaseBeforePivot(-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetPurchaseAfterPivotInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getPurchaseAfterPivot(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetPurchaseByItemIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(0, PurchaseBillMapper::getPurchaseByItemId(99999, new \DateTime('now'), new \DateTime('now'))->getInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetPurchaseBySupplierIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(0, PurchaseBillMapper::getPurchaseBySupplierId(99999, new \DateTime('now'), new \DateTime('now'))->getInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetAvgPurchasePriceByItemIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(0, PurchaseBillMapper::getAvgPurchasePriceByItemId(99999, new \DateTime('now'), new \DateTime('now'))->getInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetLastOrderDateByItemIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(null, PurchaseBillMapper::getLastOrderDateByItemId(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetLastOrderDateBySupplierIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(null, PurchaseBillMapper::getLastOrderDateBySupplierId(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetNewestItemInvoicesInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getNewestItemInvoices(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetNewestSupplierInvoicesInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getNewestSupplierInvoices(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemTopSuppliersInvalid() : void
|
||||
{
|
||||
self::assertEquals([[], []], PurchaseBillMapper::getItemTopSuppliers(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemRegionPurchaseInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getItemRegionPurchase(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemCountryPurchaseInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getItemCountryPurchase(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemMonthlyPurchaseCostsInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getItemMonthlyPurchaseCosts(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\PurchaseBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetSupplierMonthlyPurchaseCostsInvalid() : void
|
||||
{
|
||||
self::assertEquals([], PurchaseBillMapper::getSupplierMonthlyPurchaseCosts(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
}
|
||||
170
tests/Models/SalesBillMapperTest.php
Normal file
170
tests/Models/SalesBillMapperTest.php
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
<?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\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\SalesBillMapper;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\Billing\tests\Models\SalesBillMapperTest: App database mapper
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetSalesBeforePivotInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getSalesBeforePivot(-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetSalesAfterPivotInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getSalesAfterPivot(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetSalesByItemIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(0, SalesBillMapper::getSalesByItemId(99999, new \DateTime('now'), new \DateTime('now'))->getInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetSalesByClientIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(0, SalesBillMapper::getSalesByClientId(99999, new \DateTime('now'), new \DateTime('now'))->getInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetAvgSalesPriceByItemIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(0, SalesBillMapper::getAvgSalesPriceByItemId(99999, new \DateTime('now'), new \DateTime('now'))->getInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetLastOrderDateByItemIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(null, SalesBillMapper::getLastOrderDateByItemId(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetLastOrderDateByClientIdInvalid() : void
|
||||
{
|
||||
self::assertEquals(null, SalesBillMapper::getLastOrderDateByClientId(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetNewestItemInvoicesInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getNewestItemInvoices(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetNewestClientInvoicesInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getNewestClientInvoices(99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemTopClientsInvalid() : void
|
||||
{
|
||||
self::assertEquals([[], []], SalesBillMapper::getItemTopClients(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemBillsInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getItemBills(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetClientItem() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getClientItem(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemRegionSalesInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getItemRegionSales(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemCountrySalesInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getItemCountrySales(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetItemMonthlySalesCostsInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getItemMonthlySalesCosts(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\SalesBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetClientMonthlySalesCostsInvalid() : void
|
||||
{
|
||||
self::assertEquals([], SalesBillMapper::getClientMonthlySalesCosts(99999, new \DateTime('now'), new \DateTime('now')));
|
||||
}
|
||||
}
|
||||
44
tests/Models/StockBillMapperTest.php
Normal file
44
tests/Models/StockBillMapperTest.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?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\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\StockBillMapper;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\Billing\tests\Models\StockBillMapperTest: App database mapper
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class StockBillMapperTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\Billing\Models\StockBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetStockBeforePivotInvalid() : void
|
||||
{
|
||||
self::assertEquals([], StockBillMapper::getStockBeforePivot(-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\StockBillMapper
|
||||
* @group module
|
||||
*/
|
||||
public function testGetStockAfterPivotInvalid() : void
|
||||
{
|
||||
self::assertEquals([], StockBillMapper::getStockAfterPivot(99999));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user