summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-05-18 18:46:03 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2016-05-18 18:57:45 +0200
commit5ce5eb195ac6b464455b1e55ed37af3f555dfb21 (patch)
tree2ccdaa4d11995a3794a984d21d5a3e61c82ed630 /tests
parent9eade36ae5ac8d0fd9e002c78494f3ad19f919ab (diff)
downloadnextcloud-server-5ce5eb195ac6b464455b1e55ed37af3f555dfb21.tar.gz
nextcloud-server-5ce5eb195ac6b464455b1e55ed37af3f555dfb21.zip
Fix namespace for archive tests
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/archive/tartest.php (renamed from tests/lib/archive/tar.php)11
-rw-r--r--tests/lib/archive/testbase.php (renamed from tests/lib/archive.php)33
-rw-r--r--tests/lib/archive/ziptest.php (renamed from tests/lib/archive/zip.php)11
3 files changed, 32 insertions, 23 deletions
diff --git a/tests/lib/archive/tar.php b/tests/lib/archive/tartest.php
index 2d20bb4c3b1..998ce201e72 100644
--- a/tests/lib/archive/tar.php
+++ b/tests/lib/archive/tartest.php
@@ -6,23 +6,26 @@
* See the COPYING-README file.
*/
+namespace Test\Archive;
+
+
use OC\Archive\TAR;
-class Test_Archive_TAR extends Test_Archive {
+class TARTest extends TestBase {
protected function setUp() {
parent::setUp();
- if (OC_Util::runningOnWindows()) {
+ if (\OC_Util::runningOnWindows()) {
$this->markTestSkipped('[Windows] tar archives are not supported on Windows');
}
}
protected function getExisting() {
- $dir = OC::$SERVERROOT . '/tests/data';
+ $dir = \OC::$SERVERROOT . '/tests/data';
return new TAR($dir . '/data.tar.gz');
}
protected function getNew() {
- return new TAR(OCP\Files::tmpFile('.tar.gz'));
+ return new TAR(\OCP\Files::tmpFile('.tar.gz'));
}
}
diff --git a/tests/lib/archive.php b/tests/lib/archive/testbase.php
index 690b4378b88..5bf4d9d43ea 100644
--- a/tests/lib/archive.php
+++ b/tests/lib/archive/testbase.php
@@ -6,20 +6,23 @@
* See the COPYING-README file.
*/
-abstract class Test_Archive extends \Test\TestCase {
+namespace Test\Archive;
+
+
+abstract class TestBase extends \Test\TestCase {
/**
- * @var OC_Archive
+ * @var \OC\Archive\Archive
*/
protected $instance;
/**
* get the existing test archive
- * @return OC_Archive
+ * @return \OC\Archive\Archive
*/
abstract protected function getExisting();
/**
* get a new archive for write testing
- * @return OC_Archive
+ * @return \OC\Archive\Archive
*/
abstract protected function getNew();
@@ -51,17 +54,17 @@ abstract class Test_Archive extends \Test\TestCase {
public function testContent() {
$this->instance=$this->getExisting();
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$textFile=$dir.'/lorem.txt';
$this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
- $tmpFile=OCP\Files::tmpFile('.txt');
+ $tmpFile=\OCP\Files::tmpFile('.txt');
$this->instance->extractFile('lorem.txt', $tmpFile);
$this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile));
}
public function testWrite() {
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$textFile=$dir.'/lorem.txt';
$this->instance=$this->getNew();
$this->assertEquals(0, count($this->instance->getFiles()));
@@ -76,7 +79,7 @@ abstract class Test_Archive extends \Test\TestCase {
}
public function testReadStream() {
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getExisting();
$fh=$this->instance->getStream('lorem.txt', 'r');
$this->assertTrue((bool)$fh);
@@ -85,11 +88,11 @@ abstract class Test_Archive extends \Test\TestCase {
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content);
}
public function testWriteStream() {
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getNew();
$fh=$this->instance->getStream('lorem.txt', 'w');
$source=fopen($dir.'/lorem.txt', 'r');
- OCP\Files::streamCopy($source, $fh);
+ \OCP\Files::streamCopy($source, $fh);
fclose($source);
fclose($fh);
$this->assertTrue($this->instance->fileExists('lorem.txt'));
@@ -107,18 +110,18 @@ abstract class Test_Archive extends \Test\TestCase {
$this->assertFalse($this->instance->fileExists('/test/'));
}
public function testExtract() {
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getExisting();
- $tmpDir=OCP\Files::tmpFolder();
+ $tmpDir=\OCP\Files::tmpFolder();
$this->instance->extract($tmpDir);
$this->assertEquals(true, file_exists($tmpDir.'lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'logo-wide.png'));
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt'));
- OCP\Files::rmdirr($tmpDir);
+ \OCP\Files::rmdirr($tmpDir);
}
public function testMoveRemove() {
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$textFile=$dir.'/lorem.txt';
$this->instance=$this->getNew();
$this->instance->addFile('lorem.txt', $textFile);
@@ -131,7 +134,7 @@ abstract class Test_Archive extends \Test\TestCase {
$this->assertFalse($this->instance->fileExists('target.txt'));
}
public function testRecursive() {
- $dir=OC::$SERVERROOT.'/tests/data';
+ $dir=\OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getNew();
$this->instance->addRecursive('/dir', $dir);
$this->assertTrue($this->instance->fileExists('/dir/lorem.txt'));
diff --git a/tests/lib/archive/zip.php b/tests/lib/archive/ziptest.php
index 2f4c9cace1d..8d639e0d686 100644
--- a/tests/lib/archive/zip.php
+++ b/tests/lib/archive/ziptest.php
@@ -6,23 +6,26 @@
* See the COPYING-README file.
*/
+namespace Test\Archive;
+
+
use OC\Archive\ZIP;
-class Test_Archive_ZIP extends Test_Archive {
+class ZIPTest extends TestBase {
protected function setUp() {
parent::setUp();
- if (OC_Util::runningOnWindows()) {
+ if (\OC_Util::runningOnWindows()) {
$this->markTestSkipped('[Windows] ');
}
}
protected function getExisting() {
- $dir = OC::$SERVERROOT . '/tests/data';
+ $dir = \OC::$SERVERROOT . '/tests/data';
return new ZIP($dir . '/data.zip');
}
protected function getNew() {
- return new ZIP(OCP\Files::tmpFile('.zip'));
+ return new ZIP(\OCP\Files::tmpFile('.zip'));
}
}