Elgg\Application\ServeFileHandlerTest::testResponseHeadersMatchFileAttributesForAttachmentUrls PHP Method

testResponseHeadersMatchFileAttributesForAttachmentUrls() public method

    public function testResponseHeadersMatchFileAttributesForAttachmentUrls()
    {
        $file = new \Elgg\FileService\File();
        $file->setFile($this->file);
        $file->setDisposition('attachment');
        $file->bindSession(true);
        $request = $this->createRequest($file);
        $response = $this->handler->getResponse($request);
        $this->assertEquals('text/plain', $response->headers->get('Content-Type'));
        $filesize = filesize($this->file->getFilenameOnFilestore());
        $this->assertEquals($filesize, $response->headers->get('Content-Length'));
        $this->assertContains('attachment', $response->headers->get('Content-Disposition'));
        $this->assertEquals('"' . $this->file->getModifiedTime() . '"', $response->headers->get('Etag'));
    }