Symfony changed order of parameter for NGinx binary response

This commit is contained in:
Benoît Burnichon
2015-03-25 13:06:46 +01:00
parent 4ca4b8eb9c
commit c6b44e03df
3 changed files with 10 additions and 10 deletions

View File

@@ -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 ) {

View File

@@ -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());

View File

@@ -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()