mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
HHVM Workaround: Do not use Exception from Stream.
Works around https://github.com/facebook/hhvm/issues/2436#issuecomment-69351373
This commit is contained in:
parent
bedc4664e4
commit
df849bb69a
1 changed files with 5 additions and 12 deletions
|
|
@ -48,20 +48,13 @@ class Test_StreamWrappers extends \Test\TestCase {
|
|||
//test callback
|
||||
$tmpFile = OC_Helper::TmpFile('.txt');
|
||||
$file = 'close://' . $tmpFile;
|
||||
\OC\Files\Stream\Close::registerCallback($tmpFile, array('Test_StreamWrappers', 'closeCallBack'));
|
||||
$actual = false;
|
||||
$callback = function($path) use (&$actual) { $actual = $path; };
|
||||
\OC\Files\Stream\Close::registerCallback($tmpFile, $callback);
|
||||
$fh = fopen($file, 'w');
|
||||
fwrite($fh, 'asd');
|
||||
try {
|
||||
fclose($fh);
|
||||
$this->fail('Expected exception');
|
||||
} catch (Exception $e) {
|
||||
$path = $e->getMessage();
|
||||
$this->assertEquals($path, $tmpFile);
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeCallBack($path) {
|
||||
throw new Exception($path);
|
||||
fclose($fh);
|
||||
$this->assertSame($tmpFile, $actual);
|
||||
}
|
||||
|
||||
public function testOC() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue