29 lines
814 B
PHP
29 lines
814 B
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Support\DownloadFile;
|
|
use Tests\TestCase;
|
|
|
|
class DownloadFileTest extends TestCase
|
|
{
|
|
public function test_ascii_fallback_filename_keeps_extension(): void
|
|
{
|
|
$fallback = DownloadFile::asciiFallbackFilename('台灣尤塞氏症暨視聽弱協會章程V2.pdf');
|
|
|
|
$this->assertSame('V2.pdf', $fallback);
|
|
}
|
|
|
|
public function test_content_disposition_contains_utf8_filename_star(): void
|
|
{
|
|
$filename = '台灣尤塞氏症暨視聽弱協會章程V2.pdf';
|
|
$header = DownloadFile::contentDisposition($filename);
|
|
|
|
$this->assertStringContainsString('attachment; filename="V2.pdf"', $header);
|
|
$this->assertStringContainsString(
|
|
"filename*=UTF-8''".rawurlencode($filename),
|
|
$header
|
|
);
|
|
}
|
|
}
|