summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-01-10 10:21:10 +0100
committerGitHub <noreply@github.com>2017-01-10 10:21:10 +0100
commitb847dfcee934734d68a2cf6e566558d514326858 (patch)
treeae9fbb255993a8c216f4bebee9225cc9189b9c15 /tests/lib
parentbc8e565e2ab1081f168b1e36decf39d1ea1df839 (diff)
parente40ecc1aa130c47099745cf73b7a5d7d912172e0 (diff)
downloadnextcloud-server-b847dfcee934734d68a2cf6e566558d514326858.tar.gz
nextcloud-server-b847dfcee934734d68a2cf6e566558d514326858.zip
Merge pull request #2925 from nextcloud/remove-close-wrapper
replace close:// streamwrapper with CallBackWrapper
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/StreamWrappersTest.php68
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);
- }
-}