FakeFile example



    /** * @dataProvider getSampleXAccelMappings */
    public function testXAccelMapping($realpath$mapping$virtual)
    {
        $request = Request::create('/');
        $request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect');
        $request->headers->set('X-Accel-Mapping', $mapping);

        $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');

        BinaryFileResponse::trustXSendfileTypeHeader();
        $response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']);
        $reflection = new \ReflectionObject($response);
        $property = $reflection->getProperty('file');
        $property->setValue($response$file);

        $response->prepare($request);
        $this->assertEquals($virtual$response->headers->get('X-Accel-Redirect'));
    }

    
Home | Imprint | This part of the site doesn't use cookies.