From c6b44e03dfdae9a7ab172745daa78ca207d8ea11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Wed, 25 Mar 2015 13:06:46 +0100 Subject: [PATCH] Symfony changed order of parameter for NGinx binary response --- lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php | 2 +- .../Phrasea/Http/ServeFileResponseFactoryTest.php | 14 +++++++------- .../Tests/Phrasea/Http/XSendFile/NginxModeTest.php | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php b/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php index da8411678c..256b3d9ade 100644 --- a/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php +++ b/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php @@ -25,7 +25,7 @@ class NginxMode extends AbstractServerMode implements ModeInterface $xAccelMapping = []; 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 ) { diff --git a/tests/Alchemy/Tests/Phrasea/Http/ServeFileResponseFactoryTest.php b/tests/Alchemy/Tests/Phrasea/Http/ServeFileResponseFactoryTest.php index 46f658e380..580be06ed6 100644 --- a/tests/Alchemy/Tests/Phrasea/Http/ServeFileResponseFactoryTest.php +++ b/tests/Alchemy/Tests/Phrasea/Http/ServeFileResponseFactoryTest.php @@ -23,7 +23,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase $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(0, $response->getMaxAge()); $response->setPrivate(); @@ -45,7 +45,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase $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')); } @@ -55,7 +55,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase $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')); } @@ -77,7 +77,7 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase $response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'toto.jpg', 'attachment'); $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('/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->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('/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->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(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'); - $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('text/csv', $response->headers->get('content-type')); $this->assertEquals($data, $response->getContent()); diff --git a/tests/Alchemy/Tests/Phrasea/Http/XSendFile/NginxModeTest.php b/tests/Alchemy/Tests/Phrasea/Http/XSendFile/NginxModeTest.php index e6518bd3c8..74a78d4bd4 100644 --- a/tests/Alchemy/Tests/Phrasea/Http/XSendFile/NginxModeTest.php +++ b/tests/Alchemy/Tests/Phrasea/Http/XSendFile/NginxModeTest.php @@ -5,7 +5,7 @@ namespace Alchemy\Tests\Phrasea\Http\XSendFile; use Alchemy\Phrasea\Http\XSendFile\NginxMode; use Symfony\Component\HttpFoundation\Request; -class NginxModeTest extends \PhraseanetTestCase +class NginxModeTest extends \PHPUnit_Framework_TestCase { public function testGetVirtualHost() { @@ -43,7 +43,7 @@ class NginxModeTest extends \PhraseanetTestCase $mode->setHeaders($request); $this->assertArrayHasKey('x-sendfile-type', $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()