From 5774d3e82c093166e21ebb1d469e85acd240dab8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 3 Jan 2017 17:26:44 +0100 Subject: replace close:// streamwrapper with CallBackWrapper Signed-off-by: Robin Appelman --- tests/lib/StreamWrappersTest.php | 68 ---------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 tests/lib/StreamWrappersTest.php (limited to 'tests') diff --git a/tests/lib/StreamWrappersTest.php b/tests/lib/StreamWrappersTest.php deleted file mode 100644 index ee2f6a8b0b2..00000000000 --- a/tests/lib/StreamWrappersTest.php +++ /dev/null @@ -1,68 +0,0 @@ -. - * - */ - -namespace Test; - -/** - * Class StreamWrappersTest - * - * @group DB - */ -class StreamWrappersTest extends \Test\TestCase { - - private static $trashBinStatus; - - public static function setUpBeforeClass() { - self::$trashBinStatus = \OC_App::isEnabled('files_trashbin'); - \OC_App::disable('files_trashbin'); - } - - public static function tearDownAfterClass() { - if (self::$trashBinStatus) { - (new \OC_App())->enable('files_trashbin'); - } - } - - public function testCloseStream() { - //ensure all basic stream stuff works - $sourceFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; - $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); - $file = 'close://' . $tmpFile; - $this->assertTrue(file_exists($file)); - file_put_contents($file, file_get_contents($sourceFile)); - $this->assertEquals(file_get_contents($sourceFile), file_get_contents($file)); - unlink($file); - clearstatcache(); - $this->assertFalse(file_exists($file)); - - //test callback - $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); - $file = 'close://' . $tmpFile; - $actual = false; - $callback = function($path) use (&$actual) { $actual = $path; }; - \OC\Files\Stream\Close::registerCallback($tmpFile, $callback); - $fh = fopen($file, 'w'); - fwrite($fh, 'asd'); - fclose($fh); - $this->assertSame($tmpFile, $actual); - } -} -- cgit v1.2.3