public function testGetSize() { $size = 1024; $data = Helper::random($size); $file = new File($this->createTestFile()); $file->write($data); $this->assertEquals($size, $file->getSize()); $file->delete(); }
protected function createTestFile($exists = false, $suffix = '') { $filename = $this->tmp_dir . DIRECTORY_SEPARATOR . Helper::random() . $suffix; if (!file_exists($filename) && $exists) { touch($filename); } if (file_exists($filename) && !$exists) { unlink($filename); } return $filename; }