fix tests

This commit is contained in:
root
2026-06-11 11:46:12 -04:00
parent c91fa2ce4d
commit 5ead80fdc7
1489 changed files with 11349 additions and 10305 deletions
@@ -12,8 +12,7 @@ class ReimbursementFileService
{
public function __construct(
private ApplicationUrlService $urls
) {
}
) {}
public function receiptUrl(?string $filename): ?string
{
@@ -32,7 +31,7 @@ class ReimbursementFileService
public function storeReceipt(?UploadedFile $file): ?string
{
if (!$file || !$file->isValid()) {
if (! $file || ! $file->isValid()) {
return null;
}
@@ -42,10 +41,10 @@ class ReimbursementFileService
$dir = $this->ensureUploadDir();
$extension = $file->getClientOriginalExtension();
$extension = $extension !== '' ? '.' . strtolower($extension) : '';
$filename = 'reimb_' . date('Ymd_His') . '_' . Str::random(8) . $extension;
$extension = $extension !== '' ? '.'.strtolower($extension) : '';
$filename = 'reimb_'.date('Ymd_His').'_'.Str::random(8).$extension;
if (!$file->move($dir, $filename)) {
if (! $file->move($dir, $filename)) {
throw new RuntimeException('Unable to save uploaded file.');
}
@@ -56,10 +55,10 @@ class ReimbursementFileService
{
$dir = $this->ensureUploadDir();
$extension = $file->getClientOriginalExtension();
$extension = $extension !== '' ? '.' . strtolower($extension) : '';
$filename = 'batch_check_' . date('Ymd_His') . '_' . Str::random(8) . $extension;
$extension = $extension !== '' ? '.'.strtolower($extension) : '';
$filename = 'batch_check_'.date('Ymd_His').'_'.Str::random(8).$extension;
if (!$file->move($dir, $filename)) {
if (! $file->move($dir, $filename)) {
throw new RuntimeException('Unable to save uploaded file.');
}
@@ -68,8 +67,8 @@ class ReimbursementFileService
->where('admin_id', $adminId)
->first();
if ($existing && !empty($existing->filename)) {
$oldPath = $dir . DIRECTORY_SEPARATOR . $existing->filename;
if ($existing && ! empty($existing->filename)) {
$oldPath = $dir.DIRECTORY_SEPARATOR.$existing->filename;
if (is_file($oldPath)) {
@unlink($oldPath);
}
@@ -102,13 +101,13 @@ class ReimbursementFileService
{
$dir = storage_path('uploads/reimbursements');
if (!is_dir($dir)) {
if (!@mkdir($dir, 0755, true) && !is_dir($dir)) {
if (! is_dir($dir)) {
if (! @mkdir($dir, 0755, true) && ! is_dir($dir)) {
throw new RuntimeException('Upload directory is not available.');
}
}
if (!is_writable($dir)) {
if (! is_writable($dir)) {
throw new RuntimeException('Upload directory is not writable.');
}