/** * @test */ public function testGetCheksum() { $file = new Filesystem(); $dir = static::getTempPath(__FUNCTION__); mkdir($dir); $filename = rand(1, 10) . rand(0, getrandmax()); $path = $dir . DIRECTORY_SEPARATOR . $filename; touch($path); $input = 'abcdefgijklmnopqrstuvwxyz01234567890'; file_put_contents($path, $input); $this->assertEquals('73c85e86880209a9d2b6b78e22e817bd', $file->getChecksum($path)); $this->assertEquals('73c85e86880209a9d2b6b78e22e817bd', $file->getChecksum($path, 'md5')); $this->assertEquals('8a5e9122ee281ee98967a4af363f823f', md5($file->getChecksum($path, 'md5raw'))); $this->assertEquals('a1a0d18053dac3145cb4246736b5c48332a96cd1', $file->getChecksum($path, 'sha1')); $this->assertEquals('f76f2647f1db6ca5b3fee55934bf4c569766deee', sha1($file->getChecksum($path, 'sha1raw'))); $this->assertEquals('494136d29a2c6af32f999858630519280d0d47bf', sha1($file->getChecksum($path, 'crc32'))); }