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
@@ -51,7 +51,6 @@ class ExpenseController extends BaseApiController
$rows = $this->queryService->listAll();
$rows = array_map(function ($row) {
$row['receipt_url'] = $this->receiptService->receiptUrl($row['receipt_path'] ?? null);
return $row;
}, $rows);
@@ -64,7 +63,7 @@ class ExpenseController extends BaseApiController
public function show(int $id): JsonResponse
{
$row = $this->queryService->findById($id);
if (! $row) {
if (!$row) {
return response()->json(['ok' => false, 'message' => 'Expense not found.'], 404);
}
@@ -122,7 +121,7 @@ class ExpenseController extends BaseApiController
}
$expense = Expense::query()->find($id);
if (! $expense) {
if (!$expense) {
return response()->json(['ok' => false, 'message' => 'Expense not found.'], 404);
}
@@ -132,7 +131,7 @@ class ExpenseController extends BaseApiController
if ($request->hasFile('receipt')) {
$receiptName = $this->receiptService->storeReceipt($request->file('receipt'));
}
if (! empty($payload['remove_receipt'])) {
if (!empty($payload['remove_receipt'])) {
$receiptName = null;
}
@@ -177,7 +176,7 @@ class ExpenseController extends BaseApiController
}
$expense = Expense::query()->find($id);
if (! $expense) {
if (!$expense) {
return response()->json(['ok' => false, 'message' => 'Expense not found.'], 404);
}
@@ -191,6 +190,9 @@ class ExpenseController extends BaseApiController
]);
}
/**
* @return int|JsonResponse
*/
private function authenticatedUserIdOrUnauthorized(): int|JsonResponse
{
$userId = (int) (auth()->id() ?? 0);