Merge branch '2.4' into 2.5
* 2.4: PHP Fatal error when getContainer method of ContainerAwareCommand has be... [HttpFoundation] Fixed isSecure() check to be compliant with the docs Update MimeTypeExtensionGuesser.php fix test src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php Fixed the Travis build on PHP 5.3.3
This commit is contained in:
commit
349549cd17
@ -24,7 +24,7 @@ before_script:
|
||||
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
||||
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale
|
||||
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install
|
||||
- phpunit --self-update
|
||||
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi;'
|
||||
|
||||
script:
|
||||
- ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark {};' || false
|
||||
|
@ -29,11 +29,17 @@ abstract class ContainerAwareCommand extends Command implements ContainerAwareIn
|
||||
|
||||
/**
|
||||
* @return ContainerInterface
|
||||
* @throws \LogicException
|
||||
*/
|
||||
protected function getContainer()
|
||||
{
|
||||
if (null === $this->container) {
|
||||
$this->container = $this->getApplication()->getKernel()->getContainer();
|
||||
$application = $this->getApplication();
|
||||
if (null === $application) {
|
||||
throw new \LogicException('The container cannot be retrieved as the application instance is not yet set.');
|
||||
}
|
||||
|
||||
$this->container = $application->getKernel()->getContainer();
|
||||
}
|
||||
|
||||
return $this->container;
|
||||
|
@ -723,6 +723,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
|
||||
'text/plain' => 'txt',
|
||||
'text/prs.lines.tag' => 'dsc',
|
||||
'text/richtext' => 'rtx',
|
||||
'text/rtf' => 'rtf',
|
||||
'text/sgml' => 'sgml',
|
||||
'text/tab-separated-values' => 'tsv',
|
||||
'text/troff' => 't',
|
||||
|
@ -1123,7 +1123,9 @@ class Request
|
||||
return in_array(strtolower(current(explode(',', $proto))), array('https', 'on', 'ssl', '1'));
|
||||
}
|
||||
|
||||
return 'on' == strtolower($this->server->get('HTTPS')) || 1 == $this->server->get('HTTPS');
|
||||
$https = $this->server->get('HTTPS');
|
||||
|
||||
return !empty($https) && 'off' !== strtolower($https);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,14 +19,15 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
{
|
||||
public function testConstruction()
|
||||
{
|
||||
$response = new BinaryFileResponse('README.md', 404, array('X-Header' => 'Foo'), true, null, true, true);
|
||||
$file = __DIR__ . '/../README.md';
|
||||
$response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true);
|
||||
$this->assertEquals(404, $response->getStatusCode());
|
||||
$this->assertEquals('Foo', $response->headers->get('X-Header'));
|
||||
$this->assertTrue($response->headers->has('ETag'));
|
||||
$this->assertTrue($response->headers->has('Last-Modified'));
|
||||
$this->assertFalse($response->headers->has('Content-Disposition'));
|
||||
|
||||
$response = BinaryFileResponse::create('README.md', 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
|
||||
$response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
|
||||
$this->assertEquals(404, $response->getStatusCode());
|
||||
$this->assertFalse($response->headers->has('ETag'));
|
||||
$this->assertEquals('inline; filename="README.md"', $response->headers->get('Content-Disposition'));
|
||||
@ -37,13 +38,13 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
*/
|
||||
public function testSetContent()
|
||||
{
|
||||
$response = new BinaryFileResponse('README.md');
|
||||
$response = new BinaryFileResponse(__FILE__);
|
||||
$response->setContent('foo');
|
||||
}
|
||||
|
||||
public function testGetContent()
|
||||
{
|
||||
$response = new BinaryFileResponse('README.md');
|
||||
$response = new BinaryFileResponse(__FILE__);
|
||||
$this->assertFalse($response->getContent());
|
||||
}
|
||||
|
||||
@ -160,7 +161,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
|
||||
|
||||
BinaryFileResponse::trustXSendfileTypeHeader();
|
||||
$response = BinaryFileResponse::create('README.md');
|
||||
$response = BinaryFileResponse::create(__DIR__ . '/../README.md');
|
||||
$response->prepare($request);
|
||||
|
||||
$this->expectOutputString('');
|
||||
@ -187,9 +188,12 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
$file->expects($this->any())
|
||||
->method('isReadable')
|
||||
->will($this->returnValue(true));
|
||||
$file->expects($this->any())
|
||||
->method('getMTime')
|
||||
->will($this->returnValue(time()));
|
||||
|
||||
BinaryFileResponse::trustXSendFileTypeHeader();
|
||||
$response = new BinaryFileResponse('README.md');
|
||||
$response = new BinaryFileResponse($file);
|
||||
$reflection = new \ReflectionObject($response);
|
||||
$property = $reflection->getProperty('file');
|
||||
$property->setAccessible(true);
|
||||
@ -209,6 +213,6 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
|
||||
protected function provideResponse()
|
||||
{
|
||||
return new BinaryFileResponse('README.md');
|
||||
return new BinaryFileResponse(__DIR__ . '/../README.md');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user