Created
August 6, 2012 11:52
-
-
Save pepakriz/3273867 to your computer and use it in GitHub Desktop.
Application.Responses/FileResponse.send.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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