Files
alrahma_sunday_school_api/tests/Unit/Services/Expenses/ExpenseReceiptServiceTest.php
T
2026-06-09 01:25:14 -04:00

27 lines
744 B
PHP

<?php
namespace Tests\Unit\Services\Expenses;
use App\Services\Expenses\ExpenseReceiptService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class ExpenseReceiptServiceTest extends TestCase
{
use RefreshDatabase;
public function test_store_receipt_returns_filename_and_url(): void
{
Storage::fake();
$service = new ExpenseReceiptService;
$file = UploadedFile::fake()->create('receipt.pdf', 10, 'application/pdf');
$filename = $service->storeReceipt($file);
$this->assertNotEmpty($filename);
$this->assertSame(url('receipts/'.$filename), $service->receiptUrl($filename));
}
}