Exemplo n.º 1
0
 public function testUnextingDirectoryMapping()
 {
     $mode = new NginxMode([['directory' => __DIR__ . '/Unknown/Dir', 'mount-point' => '/download']]);
     $this->assertEquals([], $mode->getMapping());
 }
 public function testDeliverFileWithFilenameAndDispositionAndXSendFileButFileNotInXAccelMapping()
 {
     BinaryFileResponse::trustXSendfileTypeHeader();
     $this->factory = new ServeFileResponseFactory(new \unicode());
     $mode = new NginxMode([['directory' => __DIR__ . '/../../../../files/', 'mount-point' => '/protected/']]);
     $request = Request::create('/');
     $mode->setHeaders($request);
     $file = __DIR__ . '/../../../../classes/PhraseanetTestCase.php';
     $response = $this->factory->deliverFile($file, 'PhraseanetTestCase.php', 'attachment');
     $response->prepare($request);
     $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'));
 }