Skip to content

Instantly share code, notes, and snippets.

@pepakriz
Created August 6, 2012 11:52
Show Gist options
  • Save pepakriz/3273867 to your computer and use it in GitHub Desktop.
Save pepakriz/3273867 to your computer and use it in GitHub Desktop.
Application.Responses/FileResponse.send.phpt
<?php
/**
* Test: Nette\Application\Responses\FileResponse and send.
*
* @author Josef Kříž
* @package Nette\Config
* @subpackage UnitTests
*/
use Nette\Application\Responses\FileResponse;
use Nette\Http\Request;
use Nette\Http\Response;
use Nette\Http\UrlScript;
require __DIR__ . '/../bootstrap.php';
$file = __FILE__;
$fileResponse = new FileResponse($file);
$urlScript = new UrlScript;
$httpRequest = new Request($urlScript);
$httpResponse = new Response();
$origData = file_get_contents($file);
ob_start();
$fileResponse->send($httpRequest, $httpResponse);
$data = ob_get_contents();
ob_end_clean();
Assert::equal($origData, $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment