public function testFileRead()
{
$filename = \tempnam('/tmp', 'x');
$buf = \Sodium\randombytes_buf(65537);
\file_put_contents($filename, $buf);
$fStream = new ReadOnlyFile($filename);
$this->assertSame($fStream->readBytes(65537), $buf);
$fStream->reset(0);
\file_put_contents($filename, Util::safeSubstr($buf, 0, 32768) . 'x' . Util::safeSubstr($buf, 32768));
try {
$fStream->readBytes(65537);
throw new \Exception('fail');
} catch (CryptoException\FileModified $ex) {
$this->assertTrue($ex instanceof CryptoException\FileModified);
}
}