Laravel version update
Laravel version update
This commit is contained in:
@@ -11,10 +11,11 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class StreamedResponseTest extends \PHPUnit_Framework_TestCase
|
||||
class StreamedResponseTest extends TestCase
|
||||
{
|
||||
public function testConstructor()
|
||||
{
|
||||
@@ -50,10 +51,12 @@ class StreamedResponseTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testPrepareWithHeadRequest()
|
||||
{
|
||||
$response = new StreamedResponse(function () { echo 'foo'; });
|
||||
$response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123'));
|
||||
$request = Request::create('/', 'HEAD');
|
||||
|
||||
$response->prepare($request);
|
||||
|
||||
$this->assertSame('123', $response->headers->get('Content-Length'));
|
||||
}
|
||||
|
||||
public function testPrepareWithCacheHeaders()
|
||||
@@ -109,4 +112,33 @@ class StreamedResponseTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response);
|
||||
$this->assertEquals(204, $response->getStatusCode());
|
||||
}
|
||||
|
||||
public function testReturnThis()
|
||||
{
|
||||
$response = new StreamedResponse(function () {});
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent());
|
||||
|
||||
$response = new StreamedResponse(function () {});
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
|
||||
}
|
||||
|
||||
public function testSetNotModified()
|
||||
{
|
||||
$response = new StreamedResponse(function () { echo 'foo'; });
|
||||
$modified = $response->setNotModified();
|
||||
$this->assertObjectHasAttribute('headers', $modified);
|
||||
$this->assertObjectHasAttribute('content', $modified);
|
||||
$this->assertObjectHasAttribute('version', $modified);
|
||||
$this->assertObjectHasAttribute('statusCode', $modified);
|
||||
$this->assertObjectHasAttribute('statusText', $modified);
|
||||
$this->assertObjectHasAttribute('charset', $modified);
|
||||
$this->assertEquals(304, $modified->getStatusCode());
|
||||
|
||||
ob_start();
|
||||
$modified->sendContent();
|
||||
$string = ob_get_clean();
|
||||
$this->assertEmpty($string);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user