Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -33,7 +33,7 @@ class ResponseTest extends ResponseTestCase
$response = new Response();
$response = explode("\r\n", $response);
$this->assertEquals('HTTP/1.0 200 OK', $response[0]);
$this->assertEquals('Cache-Control: no-cache', $response[1]);
$this->assertEquals('Cache-Control: no-cache, private', $response[1]);
}
public function testClone()
@@ -126,7 +126,7 @@ class ResponseTest extends ResponseTestCase
public function testSetNotModified()
{
$response = new Response();
$response = new Response('foo');
$modified = $response->setNotModified();
$this->assertObjectHasAttribute('headers', $modified);
$this->assertObjectHasAttribute('content', $modified);
@@ -135,6 +135,11 @@ class ResponseTest extends ResponseTestCase
$this->assertObjectHasAttribute('statusText', $modified);
$this->assertObjectHasAttribute('charset', $modified);
$this->assertEquals(304, $modified->getStatusCode());
ob_start();
$modified->sendContent();
$string = ob_get_clean();
$this->assertEmpty($string);
}
public function testIsSuccessful()
@@ -276,8 +281,10 @@ class ResponseTest extends ResponseTestCase
$this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the date when the header has been modified');
$response = new Response('', 200);
$now = $this->createDateTimeNow();
$response->headers->remove('Date');
$this->assertInstanceOf('\DateTime', $response->getDate());
$date = $response->getDate();
$this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the current Date when the header has previously been removed');
}
public function testGetMaxAge()
@@ -442,7 +449,7 @@ class ResponseTest extends ResponseTestCase
public function testDefaultContentType()
{
$headerMock = $this->getMock('Symfony\Component\HttpFoundation\ResponseHeaderBag', array('set'));
$headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(array('set'))->getMock();
$headerMock->expects($this->at(0))
->method('set')
->with('Content-Type', 'text/html');
@@ -608,6 +615,12 @@ class ResponseTest extends ResponseTestCase
$response->setCache(array('private' => false));
$this->assertTrue($response->headers->hasCacheControlDirective('public'));
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
$response->setCache(array('immutable' => true));
$this->assertTrue($response->headers->hasCacheControlDirective('immutable'));
$response->setCache(array('immutable' => false));
$this->assertFalse($response->headers->hasCacheControlDirective('immutable'));
}
public function testSendContent()
@@ -629,6 +642,22 @@ class ResponseTest extends ResponseTestCase
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
}
public function testSetImmutable()
{
$response = new Response();
$response->setImmutable();
$this->assertTrue($response->headers->hasCacheControlDirective('immutable'));
}
public function testIsImmutable()
{
$response = new Response();
$response->setImmutable();
$this->assertTrue($response->isImmutable());
}
public function testSetExpires()
{
$response = new Response();
@@ -843,6 +872,16 @@ class ResponseTest extends ResponseTestCase
}
}
public function testNoDeprecationsAreTriggered()
{
new DefaultResponse();
$this->getMockBuilder(Response::class)->getMock();
// we just need to ensure that subclasses of Response can be created without any deprecations
// being triggered if the subclass does not override any final methods
$this->addToAssertionCount(1);
}
public function validContentProvider()
{
return array(
@@ -882,6 +921,67 @@ class ResponseTest extends ResponseTestCase
{
return new Response();
}
/**
* @see http://github.com/zendframework/zend-diactoros for the canonical source repository
*
* @author Fábio Pacheco
* @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/
public function ianaCodesReasonPhrasesProvider()
{
if (!\in_array('https', stream_get_wrappers(), true)) {
$this->markTestSkipped('The "https" wrapper is not available');
}
$ianaHttpStatusCodes = new \DOMDocument();
libxml_set_streams_context(stream_context_create(array(
'http' => array(
'method' => 'GET',
'timeout' => 30,
),
)));
$ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) {
self::fail('Invalid IANA\'s HTTP status code list.');
}
$ianaCodesReasonPhrases = array();
$xpath = new \DOMXPath($ianaHttpStatusCodes);
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
$records = $xpath->query('//ns:record');
foreach ($records as $record) {
$value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue;
$description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue;
if (\in_array($description, array('Unassigned', '(Unused)'), true)) {
continue;
}
if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) {
for ($value = $matches[1]; $value <= $matches[2]; ++$value) {
$ianaCodesReasonPhrases[] = array($value, $description);
}
} else {
$ianaCodesReasonPhrases[] = array($value, $description);
}
}
return $ianaCodesReasonPhrases;
}
/**
* @dataProvider ianaCodesReasonPhrasesProvider
*/
public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase)
{
$this->assertEquals($reasonPhrase, Response::$statusTexts[$code]);
}
}
class StringableObject
@@ -891,3 +991,18 @@ class StringableObject
return 'Foo';
}
}
class DefaultResponse extends Response
{
}
class ExtendedResponse extends Response
{
public function setLastModified(\DateTime $date = null)
{
}
public function getDate()
{
}
}