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", "name": "Default",
"virtualPath": "/Modules/Billing/Templates", "virtualPath": "/Modules/Billing/Templates",
"path": "/Modules/Media/Files/Modules/Billing/Templates/Default", "path": "/Modules/Media/Files/Modules/Billing/Templates/Default",
"fixed_names": true,
"files": [ "files": [
"/Modules/Billing/Admin/Install/Media" "/Modules/Billing/Admin/Install/Media"
], ],

View File

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

View File

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

View File

@ -24,7 +24,7 @@ namespace Modules\Billing\Models;
*/ */
final class NullBill extends Bill final class NullBill extends Bill
{ {
/** /**
* Constructor * Constructor
* *
* @param int $id Model id * @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 Model\CoreSettings;
use Modules\Admin\Models\AccountPermission; use Modules\Admin\Models\AccountPermission;
use Modules\Billing\Models\AuditMapper;
use phpOMS\Account\Account; use phpOMS\Account\Account;
use phpOMS\Account\AccountManager; use phpOMS\Account\AccountManager;
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
use phpOMS\Application\ApplicationAbstract; use phpOMS\Application\ApplicationAbstract;
use phpOMS\Dispatcher\Dispatcher; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Event\EventManager; 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\HttpRequest;
use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\ModuleManager;
use phpOMS\Router\WebRouter;
use phpOMS\Uri\HttpUri; use phpOMS\Uri\HttpUri;
use phpOMS\Utils\RnG\DateTime; use phpOMS\Utils\RnG\DateTime;
use phpOMS\Utils\TestUtils;
/** /**
* @testdox Modules\tests\Billing\Controller\ApiControllerTest: Billing api controller * @testdox Modules\tests\Billing\Controller\ApiControllerTest: Billing api controller

View File

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

View File

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

View File

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

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
namespace Modules\Billing\tests\Models; namespace Modules\Billing\tests\Models;
use Modules\Billing\Models\PurchaseBillMapper; use Modules\Billing\Models\PurchaseBillMapper;
use phpOMS\Utils\TestUtils;
/** /**
* @testdox Modules\Billing\tests\Models\PurchaseBillMapperTest: App database mapper * @testdox Modules\Billing\tests\Models\PurchaseBillMapperTest: App database mapper
@ -75,7 +74,7 @@ final class PurchaseBillMapperTest extends \PHPUnit\Framework\TestCase
*/ */
public function testGetLastOrderDateByItemIdInvalid() : void 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 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; namespace Modules\Billing\tests\Models;
use Modules\Billing\Models\SalesBillMapper; use Modules\Billing\Models\SalesBillMapper;
use phpOMS\Utils\TestUtils;
/** /**
* @testdox Modules\Billing\tests\Models\SalesBillMapperTest: App database mapper * @testdox Modules\Billing\tests\Models\SalesBillMapperTest: App database mapper
@ -24,7 +23,7 @@ use phpOMS\Utils\TestUtils;
*/ */
final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase
{ {
/** /**
* @covers Modules\Billing\Models\SalesBillMapper * @covers Modules\Billing\Models\SalesBillMapper
* @group module * @group module
*/ */
@ -75,7 +74,7 @@ final class SalesBillMapperTest extends \PHPUnit\Framework\TestCase
*/ */
public function testGetLastOrderDateByItemIdInvalid() : void 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 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; namespace Modules\Billing\tests\Models;
use Modules\Billing\Models\StockBillMapper; use Modules\Billing\Models\StockBillMapper;
use phpOMS\Utils\TestUtils;
/** /**
* @testdox Modules\Billing\tests\Models\StockBillMapperTest: App database mapper * @testdox Modules\Billing\tests\Models\StockBillMapperTest: App database mapper
@ -24,7 +23,7 @@ use phpOMS\Utils\TestUtils;
*/ */
final class StockBillMapperTest extends \PHPUnit\Framework\TestCase final class StockBillMapperTest extends \PHPUnit\Framework\TestCase
{ {
/** /**
* @covers Modules\Billing\Models\StockBillMapper * @covers Modules\Billing\Models\StockBillMapper
* @group module * @group module
*/ */