bug and media fixes

This commit is contained in:
Dennis Eichhorn 2021-10-29 14:49:55 +02:00
parent 0506ae8415
commit 3d27009178
12 changed files with 73 additions and 78 deletions

View File

@ -26,6 +26,7 @@
"name": "Default",
"virtualPath": "/Modules/Billing/Templates",
"path": "/Modules/Media/Files/Modules/Billing/Templates/Default",
"fixed_names": true,
"files": [
"/Modules/Billing/Admin/Install/Media"
],

View File

@ -18,7 +18,6 @@ use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount;
use Modules\ClientManagement\Models\Client;
use Modules\Media\Models\Media;
use Modules\Media\Models\NullMedia;
use Modules\SupplierManagement\Models\Supplier;
use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\Money;
@ -628,20 +627,20 @@ class Bill implements \JsonSerializable
public function toArray() : array
{
return [
'id' => $this->id,
'number' => $this->number,
'type' => $this->type,
'shipTo' => $this->shipTo,
'shipFAO' => $this->shipFAO,
'id' => $this->id,
'number' => $this->number,
'type' => $this->type,
'shipTo' => $this->shipTo,
'shipFAO' => $this->shipFAO,
'shipAddress' => $this->shipAddress,
'shipCity' => $this->shipCity,
'shipZip' => $this->shipZip,
'shipCity' => $this->shipCity,
'shipZip' => $this->shipZip,
'shipCountry' => $this->shipCountry,
'billTo' => $this->billTo,
'billFAO' => $this->billFAO,
'billTo' => $this->billTo,
'billFAO' => $this->billFAO,
'billAddress' => $this->billAddress,
'billCity' => $this->billCity,
'billZip' => $this->billZip,
'billCity' => $this->billCity,
'billZip' => $this->billZip,
'billCountry' => $this->billCountry,
];
}

View File

@ -139,14 +139,14 @@ class BillElement implements \JsonSerializable
public function toArray() : array
{
return [
'id' => $this->id,
'order' => $this->order,
'item' => $this->item,
'itemNumber' => $this->itemNumber,
'itemName' => $this->itemName,
'id' => $this->id,
'order' => $this->order,
'item' => $this->item,
'itemNumber' => $this->itemNumber,
'itemName' => $this->itemName,
'itemDescription' => $this->itemDescription,
'quantity' => $this->quantity,
'bill' => $this->bill,
'quantity' => $this->quantity,
'bill' => $this->bill,
];
}

View File

@ -24,7 +24,7 @@ namespace Modules\Billing\Models;
*/
final class NullBill extends Bill
{
/**
/**
* Constructor
*
* @param int $id Model id

View File

@ -392,4 +392,4 @@ function phpServe() : void
});
}
phpServe();
\phpServe();

View File

@ -16,22 +16,21 @@ namespace Modules\Billing\tests\Controller;
use Model\CoreSettings;
use Modules\Admin\Models\AccountPermission;
use Modules\Billing\Models\AuditMapper;
use phpOMS\Account\Account;
use phpOMS\Account\AccountManager;
use phpOMS\Account\PermissionType;
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Event\EventManager;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\ModuleManager;
use phpOMS\Router\WebRouter;
use phpOMS\Utils\TestUtils;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\ModuleManager;
use phpOMS\Router\WebRouter;
use phpOMS\Uri\HttpUri;
use phpOMS\Utils\RnG\DateTime;
use phpOMS\Utils\TestUtils;
/**
* @testdox Modules\tests\Billing\Controller\ApiControllerTest: Billing api controller

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
namespace Modules\Billing\tests\Models;
use Modules\Billing\Models\BillElement;
use phpOMS\Localization\ISO4217CharEnum;
/**
* @internal
@ -61,24 +60,24 @@ final class BillElementTest extends \PHPUnit\Framework\TestCase
*/
public function testSerialize() : void
{
$this->element->order = 2;
$this->element->item = 3;
$this->element->itemNumber = '123456';
$this->element->itemName = 'Test';
$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;
$this->element->quantity = 4;
$this->element->bill = 5;
self::assertEquals(
[
'id' => 0,
'order' => 2,
'item' => 3,
'itemNumber' => '123456',
'itemName' => 'Test',
'id' => 0,
'order' => 2,
'item' => 3,
'itemNumber' => '123456',
'itemName' => 'Test',
'itemDescription' => 'Description',
'quantity' => 4,
'bill' => 5,
'quantity' => 4,
'bill' => 5,
],
$this->element->jsonSerialize()
);

View File

@ -49,9 +49,9 @@ final class BillTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, $this->bill->type);
self::assertInstanceOf('\DateTimeImmutable', $this->bill->createdAt);
self::assertInstanceOf('\DateTime', $this->bill->performanceDate);
self::assertEquals(null, $this->bill->send);
self::assertEquals(null, $this->bill->client);
self::assertEquals(null, $this->bill->supplier);
self::assertNull($this->bill->send);
self::assertNull($this->bill->client);
self::assertNull($this->bill->supplier);
self::assertEquals([], $this->bill->getVouchers());
self::assertEquals([], $this->bill->getTrackings());
self::assertEquals([], $this->bill->getMediaByType(0));
@ -170,37 +170,37 @@ final class BillTest extends \PHPUnit\Framework\TestCase
*/
public function testSerialize() : void
{
$this->bill->number = '123456';
$this->bill->type = 2;
$this->bill->shipTo = 'To';
$this->bill->shipFAO = 'FAO';
$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->shipCity = 'City';
$this->bill->shipZip = 'Zip';
$this->bill->shipCountry = 'Country';
$this->bill->billTo = 'To';
$this->bill->billFAO = 'FAO';
$this->bill->billTo = 'To';
$this->bill->billFAO = 'FAO';
$this->bill->billAddress = 'Address';
$this->bill->billCity = 'City';
$this->bill->billZip = 'Zip';
$this->bill->billCity = 'City';
$this->bill->billZip = 'Zip';
$this->bill->billCountry = 'Country';
self::assertEquals(
[
'id' => 0,
'number' => '123456',
'type' => 2,
'shipTo' => 'To',
'shipFAO' => 'FAO',
'id' => 0,
'number' => '123456',
'type' => 2,
'shipTo' => 'To',
'shipFAO' => 'FAO',
'shipAddress' => 'Address',
'shipCity' => 'City',
'shipZip' => 'Zip',
'shipCity' => 'City',
'shipZip' => 'Zip',
'shipCountry' => 'Country',
'billTo' => 'To',
'billFAO' => 'FAO',
'billTo' => 'To',
'billFAO' => 'FAO',
'billAddress' => 'Address',
'billCity' => 'City',
'billZip' => 'Zip',
'billCity' => 'City',
'billZip' => 'Zip',
'billCountry' => 'Country',
],
$this->bill->jsonSerialize()

View File

@ -70,17 +70,17 @@ final class BillTypeL11nTest extends \PHPUnit\Framework\TestCase
*/
public function testSerialize() : void
{
$this->l11n->name = 'Title';
$this->l11n->name = 'Title';
$this->l11n->description = 'Description';
$this->l11n->type = 2;
$this->l11n->type = 2;
$this->l11n->setLanguage(ISO639x1Enum::_DE);
self::assertEquals(
[
'id' => 0,
'name' => 'Title',
'id' => 0,
'name' => 'Title',
'type' => 2,
'language' => ISO639x1Enum::_DE,
'language' => ISO639x1Enum::_DE,
],
$this->l11n->jsonSerialize()
);

View File

@ -15,7 +15,6 @@ 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
@ -75,7 +74,7 @@ final class PurchaseBillMapperTest extends \PHPUnit\Framework\TestCase
*/
public function testGetLastOrderDateByItemIdInvalid() : void
{
self::assertEquals(null, PurchaseBillMapper::getLastOrderDateByItemId(99999));
self::assertNull(PurchaseBillMapper::getLastOrderDateByItemId(99999));
}
/**
@ -84,7 +83,7 @@ final class PurchaseBillMapperTest extends \PHPUnit\Framework\TestCase
*/
public function testGetLastOrderDateBySupplierIdInvalid() : void
{
self::assertEquals(null, PurchaseBillMapper::getLastOrderDateBySupplierId(99999));
self::assertNull(PurchaseBillMapper::getLastOrderDateBySupplierId(99999));
}
/**

View File

@ -15,7 +15,6 @@ 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
@ -24,7 +23,7 @@ use phpOMS\Utils\TestUtils;
*/
final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase
{
/**
/**
* @covers Modules\Billing\Models\SalesBillMapper
* @group module
*/
@ -75,7 +74,7 @@ final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase
*/
public function testGetLastOrderDateByItemIdInvalid() : void
{
self::assertEquals(null, SalesBillMapper::getLastOrderDateByItemId(99999));
self::assertNull(SalesBillMapper::getLastOrderDateByItemId(99999));
}
/**
@ -84,7 +83,7 @@ final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase
*/
public function testGetLastOrderDateByClientIdInvalid() : void
{
self::assertEquals(null, SalesBillMapper::getLastOrderDateByClientId(99999));
self::assertNull(SalesBillMapper::getLastOrderDateByClientId(99999));
}
/**

View File

@ -15,7 +15,6 @@ 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
@ -24,7 +23,7 @@ use phpOMS\Utils\TestUtils;
*/
final class StockBillMapperTest extends \PHPUnit\Framework\TestCase
{
/**
/**
* @covers Modules\Billing\Models\StockBillMapper
* @group module
*/