public function BinaryFileResponseTest::testDeleteFileAfterSend in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php \Symfony\Component\HttpFoundation\Tests\BinaryFileResponseTest::testDeleteFileAfterSend()
File
- vendor/
symfony/ http-foundation/ Tests/ BinaryFileResponseTest.php, line 193
Class
Namespace
Symfony\Component\HttpFoundation\TestsCode
public function testDeleteFileAfterSend() {
$request = Request::create('/');
$path = __DIR__ . '/File/Fixtures/to_delete';
touch($path);
$realPath = realpath($path);
$this
->assertFileExists($realPath);
$response = new BinaryFileResponse($realPath, 200, array(
'Content-Type' => 'application/octet-stream',
));
$response
->deleteFileAfterSend(true);
$response
->prepare($request);
$response
->sendContent();
$this
->assertFileNotExists($path);
}