add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
@@ -12,7 +12,7 @@ class PurchaseOrderCreateService
public function create(array $payload): PurchaseOrder
{
$itemsPayload = $payload['items'] ?? [];
if (empty($itemsPayload) || ! is_array($itemsPayload)) {
if (empty($itemsPayload) || !is_array($itemsPayload)) {
throw new RuntimeException('Add at least one line item.');
}
@@ -45,7 +45,7 @@ class PurchaseOrderQueryService
->where('purchase_orders.id', $id)
->first();
if (! $po) {
if (!$po) {
return null;
}
@@ -14,7 +14,7 @@ class PurchaseOrderReceiveService
public function receive(int $poId, array $received, string $issuedBy): array
{
$po = PurchaseOrder::query()->find($poId);
if (! $po || in_array($po->status, [PurchaseOrder::STATUS_CANCELED, PurchaseOrder::STATUS_RECEIVED], true)) {
if (!$po || in_array($po->status, [PurchaseOrder::STATUS_CANCELED, PurchaseOrder::STATUS_RECEIVED], true)) {
throw new RuntimeException('PO not receivable.');
}
@@ -37,9 +37,8 @@ class PurchaseOrderReceiveService
->where('id', $itemId)
->first();
if (! $poItem) {
if (!$poItem) {
$completed = false;
continue;
}
@@ -53,9 +52,8 @@ class PurchaseOrderReceiveService
$poItem->save();
$supply = Supply::query()->find($poItem->supply_id);
if (! $supply) {
if (!$supply) {
$completed = false;
continue;
}
@@ -66,7 +64,7 @@ class PurchaseOrderReceiveService
'supply_id' => $supply->id,
'type' => 'in',
'quantity' => $toReceive,
'ref' => 'PO '.($po->po_number ?? $po->id),
'ref' => 'PO ' . ($po->po_number ?? $po->id),
'issued_to' => 'Inventory',
'issued_by' => $issuedBy,
'notes' => 'Received against PO',
@@ -10,7 +10,7 @@ class PurchaseOrderStatusService
public function cancel(int $poId): PurchaseOrder
{
$po = PurchaseOrder::query()->find($poId);
if (! $po || $po->status === PurchaseOrder::STATUS_RECEIVED) {
if (!$po || $po->status === PurchaseOrder::STATUS_RECEIVED) {
throw new RuntimeException('Cannot cancel this PO.');
}