Laravel version update
Laravel version update
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\HttpFoundation\Tests;
|
||||
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\File\Stream;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\HttpFoundation\Tests\File\FakeFile;
|
||||
@@ -68,6 +69,17 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
$this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html', $response->headers->get('Content-Disposition'));
|
||||
}
|
||||
|
||||
public function testSetContentDispositionGeneratesSafeFallbackFilenameForWronglyEncodedFilename()
|
||||
{
|
||||
$response = new BinaryFileResponse(__FILE__);
|
||||
|
||||
$iso88591EncodedFilename = utf8_decode('föö.html');
|
||||
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename);
|
||||
|
||||
// the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one)
|
||||
$this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%F6%F6.html', $response->headers->get('Content-Disposition'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideRanges
|
||||
*/
|
||||
@@ -97,6 +109,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
|
||||
$this->assertEquals(206, $response->getStatusCode());
|
||||
$this->assertEquals($responseRange, $response->headers->get('Content-Range'));
|
||||
$this->assertSame($length, $response->headers->get('Content-Length'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,6 +328,15 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testStream()
|
||||
{
|
||||
$request = Request::create('/');
|
||||
$response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain'));
|
||||
$response->prepare($request);
|
||||
|
||||
$this->assertNull($response->headers->get('Content-Length'));
|
||||
}
|
||||
|
||||
protected function provideResponse()
|
||||
{
|
||||
return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
|
||||
|
Reference in New Issue
Block a user