public function testUpdateToStreamFailsToDetectsMimetypeByContent() { $path = '/missing-extension'; $data = ['path_id' => 123, 'type' => 'file', 'path' => $path, 'mimetype' => 'text/plain', 'visibility' => 'public', 'size' => 214454, 'is_compressed' => false, 'update_ts' => date('Y-m-d H:i:s')]; $this->setupDbFetchResponse($data); $content = base64_decode('R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs='); // 1x1 transparent gif $handle = $this->createTempResource($content); $meta = $this->adapter->updateStream($path, $handle, $this->emptyConfig); $this->assertNotEquals('image/gif', $meta['mimetype']); }
public function testMemoryUsageOnUpdateStream() { $path = '/path/to/file.txt'; $file = fopen(static::$tempFiles['10K'], 'r'); $this->adapter->writeStream($path, $file, $this->emptyConfig); fclose($file); $file = fopen(static::$tempFiles['15M'], 'r'); $variation = 2 * 1024 * 1024; // 2MB $this->memoryTest(function () use($path, $file) { $this->adapter->updateStream($path, $file, $this->emptyConfig); }, $variation); }