mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Symfony changed order of parameter for NGinx binary response
This commit is contained in:
@@ -25,7 +25,7 @@ class NginxMode extends AbstractServerMode implements ModeInterface
|
|||||||
$xAccelMapping = [];
|
$xAccelMapping = [];
|
||||||
|
|
||||||
foreach ($this->mapping as $entry) {
|
foreach ($this->mapping as $entry) {
|
||||||
$xAccelMapping[] = sprintf('%s=%s', $entry['mount-point'], $entry['directory']);
|
$xAccelMapping[] = sprintf('%s=%s', $entry['directory'], $entry['mount-point']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($xAccelMapping) > 0 ) {
|
if (count($xAccelMapping) > 0 ) {
|
||||||
|
@@ -23,7 +23,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
|
|
||||||
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg');
|
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg');
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('inline; filename="cestlafete.jpg"', $response->headers->get('content-disposition'));
|
$this->assertEquals('inline; filename="cestlafete.jpg"', $response->headers->get('content-disposition'));
|
||||||
$this->assertEquals(0, $response->getMaxAge());
|
$this->assertEquals(0, $response->getMaxAge());
|
||||||
$response->setPrivate();
|
$response->setPrivate();
|
||||||
@@ -45,7 +45,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
|
|
||||||
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg');
|
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg');
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('inline; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
$this->assertEquals('inline; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
|
|
||||||
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment');
|
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment');
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('attachment; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
$this->assertEquals('attachment; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment');
|
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment');
|
||||||
$response->prepare($request);
|
$response->prepare($request);
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('attachment; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
$this->assertEquals('attachment; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
||||||
$this->assertEquals('/protected/cestlafete.jpg', $response->headers->get('x-accel-redirect'));
|
$this->assertEquals('/protected/cestlafete.jpg', $response->headers->get('x-accel-redirect'));
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment');
|
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment');
|
||||||
$response->prepare($request);
|
$response->prepare($request);
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('attachment; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
$this->assertEquals('attachment; filename="toto.jpg"', $response->headers->get('content-disposition'));
|
||||||
$this->assertEquals('/protected/cestlafete.jpg', $response->headers->get('x-accel-redirect'));
|
$this->assertEquals('/protected/cestlafete.jpg', $response->headers->get('x-accel-redirect'));
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
$response = $this->factory->deliverFile($file, 'PhraseanetTestCase.php', 'attachment');
|
$response = $this->factory->deliverFile($file, 'PhraseanetTestCase.php', 'attachment');
|
||||||
$response->prepare($request);
|
$response->prepare($request);
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('attachment; filename="PhraseanetTestCase.php"', $response->headers->get('content-disposition'));
|
$this->assertEquals('attachment; filename="PhraseanetTestCase.php"', $response->headers->get('content-disposition'));
|
||||||
$this->assertEquals(realpath($file), $response->headers->get('x-accel-redirect'));
|
$this->assertEquals(realpath($file), $response->headers->get('x-accel-redirect'));
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
|
|
||||||
$response = $this->factory->deliverData($data, 'data.csv', 'text/csv', 'attachment');
|
$response = $this->factory->deliverData($data, 'data.csv', 'text/csv', 'attachment');
|
||||||
|
|
||||||
$this->assertInstanceOf("Symfony\Component\HttpFoundation\Response", $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
$this->assertEquals('attachment; filename="data.csv"', $response->headers->get('content-disposition'));
|
$this->assertEquals('attachment; filename="data.csv"', $response->headers->get('content-disposition'));
|
||||||
$this->assertEquals('text/csv', $response->headers->get('content-type'));
|
$this->assertEquals('text/csv', $response->headers->get('content-type'));
|
||||||
$this->assertEquals($data, $response->getContent());
|
$this->assertEquals($data, $response->getContent());
|
||||||
|
@@ -5,7 +5,7 @@ namespace Alchemy\Tests\Phrasea\Http\XSendFile;
|
|||||||
use Alchemy\Phrasea\Http\XSendFile\NginxMode;
|
use Alchemy\Phrasea\Http\XSendFile\NginxMode;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
class NginxModeTest extends \PhraseanetTestCase
|
class NginxModeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetVirtualHost()
|
public function testGetVirtualHost()
|
||||||
{
|
{
|
||||||
@@ -43,7 +43,7 @@ class NginxModeTest extends \PhraseanetTestCase
|
|||||||
$mode->setHeaders($request);
|
$mode->setHeaders($request);
|
||||||
$this->assertArrayHasKey('x-sendfile-type', $request->headers->all());
|
$this->assertArrayHasKey('x-sendfile-type', $request->headers->all());
|
||||||
$this->assertArrayHasKey('x-accel-mapping', $request->headers->all());
|
$this->assertArrayHasKey('x-accel-mapping', $request->headers->all());
|
||||||
$this->assertEquals('/protected='.realpath($protected).',/uploads='.realpath($upload), $request->headers->get('X-Accel-Mapping'));
|
$this->assertEquals(realpath($protected).'=/protected,'.realpath($upload).'=/uploads', $request->headers->get('X-Accel-Mapping'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetInvalidHeaders()
|
public function testSetInvalidHeaders()
|
||||||
|
Reference in New Issue
Block a user