27 lines
748 B
PHP
27 lines
748 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));
|
|
}
|
|
}
|