diff options
author | Robin Appelman <robin@icewind.nl> | 2017-01-03 17:26:44 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-01-06 15:33:32 +0100 |
commit | 5774d3e82c093166e21ebb1d469e85acd240dab8 (patch) | |
tree | 909001d4ad898f1c4ccab05333f4dd52e8d71b37 /tests | |
parent | 3ab22c2df53c8b86cbd72037ab407327b18cce11 (diff) | |
download | nextcloud-server-5774d3e82c093166e21ebb1d469e85acd240dab8.tar.gz nextcloud-server-5774d3e82c093166e21ebb1d469e85acd240dab8.zip |
replace close:// streamwrapper with CallBackWrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/StreamWrappersTest.php | 68 |
1 files changed, 0 insertions, 68 deletions
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 @@ -<?php -/** - * ownCloud - * - * @author Robin Appelman - * @copyright 2012 Robin Appelman icewind@owncloud.com - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - * - */ - -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); - } -} |