feat(cms): sync site assets, revalidate webhook, and document download naming
This commit is contained in:
28
tests/Unit/DownloadFileTest.php
Normal file
28
tests/Unit/DownloadFileTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user