summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-05-19 09:38:52 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2016-05-19 09:38:52 +0200
commit9a4253ef7c34f9dc71a6a9f7828a10df769f0c32 (patch)
treefebe8415af243c7f69867d095a3f281c65071d40 /tests
parent55fc6536d33bd044a72437ac61d3c5ade09111cb (diff)
downloadnextcloud-server-9a4253ef7c34f9dc71a6a9f7828a10df769f0c32.tar.gz
nextcloud-server-9a4253ef7c34f9dc71a6a9f7828a10df769f0c32.zip
Fix lib/
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/HTTPHelperTest.php (renamed from tests/lib/httphelper.php)4
-rw-r--r--tests/lib/HelperStorageTest.php (renamed from tests/lib/helperstorage.php)4
-rw-r--r--tests/lib/ImageTest.php (renamed from tests/lib/image.php)6
-rw-r--r--tests/lib/LegacyHelperTest.php (renamed from tests/lib/helper.php)6
-rw-r--r--tests/lib/NaturalSortTest.php (renamed from tests/lib/naturalsort.php)4
-rw-r--r--tests/lib/RepairStepTest.php (renamed from tests/lib/RepairTest.php)2
-rw-r--r--tests/lib/SetupTest.php (renamed from tests/lib/setup.php)18
-rw-r--r--tests/lib/StreamWrappersTest.php (renamed from tests/lib/streamwrappers.php)6
-rw-r--r--tests/lib/TagsTest.php (renamed from tests/lib/tags.php)36
-rw-r--r--tests/lib/TemplateFunctionsTest.php (renamed from tests/lib/template.php)8
-rw-r--r--tests/lib/UpdaterTest.php (renamed from tests/lib/updater.php)3
-rw-r--r--tests/lib/UrlGeneratorTest.php (renamed from tests/lib/urlGenerator.php)6
-rw-r--r--tests/lib/UtilCheckServerTest.php (renamed from tests/lib/utilcheckserver.php)6
-rw-r--r--tests/lib/UtilTest.php (renamed from tests/lib/util.php)12
-rw-r--r--tests/lib/group/LegacyGroupTest.php (renamed from tests/lib/group.php)7
-rw-r--r--tests/lib/ocsclienttest.php2
16 files changed, 84 insertions, 46 deletions
diff --git a/tests/lib/httphelper.php b/tests/lib/HTTPHelperTest.php
index 1d0981ba51b..6d9c4788735 100644
--- a/tests/lib/httphelper.php
+++ b/tests/lib/HTTPHelperTest.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class TestHTTPHelper extends \Test\TestCase {
+namespace Test;
+
+class HTTPHelperTest extends \Test\TestCase {
/** @var \OCP\IConfig*/
private $config;
diff --git a/tests/lib/helperstorage.php b/tests/lib/HelperStorageTest.php
index 3109b509549..e841dbfce18 100644
--- a/tests/lib/helperstorage.php
+++ b/tests/lib/HelperStorageTest.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test;
+
/**
* Test the storage functions of OC_Helper
*
* @group DB
*/
-class Test_Helper_Storage extends \Test\TestCase {
+class HelperStorageTest extends \Test\TestCase {
/** @var string */
private $user;
/** @var \OC\Files\Storage\Storage */
diff --git a/tests/lib/image.php b/tests/lib/ImageTest.php
index e74c75b48cf..9dba7e3739b 100644
--- a/tests/lib/image.php
+++ b/tests/lib/ImageTest.php
@@ -6,7 +6,11 @@
* See the COPYING-README file.
*/
-class Test_Image extends \Test\TestCase {
+namespace Test;
+
+use OC;
+
+class ImageTest extends \Test\TestCase {
public static function tearDownAfterClass() {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
diff --git a/tests/lib/helper.php b/tests/lib/LegacyHelperTest.php
index 89a981e6e23..d8b1a82c271 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -6,7 +6,11 @@
* See the COPYING-README file.
*/
-class Test_Helper extends \Test\TestCase {
+namespace Test;
+
+use OC_Helper;
+
+class LegacyHelperTest extends \Test\TestCase {
/**
* @dataProvider humanFileSizeProvider
diff --git a/tests/lib/naturalsort.php b/tests/lib/NaturalSortTest.php
index 8fcbc6f5fd3..50c2d0be9f0 100644
--- a/tests/lib/naturalsort.php
+++ b/tests/lib/NaturalSortTest.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class Test_NaturalSort extends \Test\TestCase {
+namespace Test;
+
+class NaturalSortTest extends \Test\TestCase {
/**
* @dataProvider naturalSortDataProvider
diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairStepTest.php
index 9ae1318eb32..3f7a0ce064b 100644
--- a/tests/lib/RepairTest.php
+++ b/tests/lib/RepairStepTest.php
@@ -11,7 +11,7 @@ namespace Test;
use OCP\Migration\IRepairStep;
use Symfony\Component\EventDispatcher\EventDispatcher;
-class TestRepairStep implements IRepairStep {
+class RepairStepTest implements IRepairStep {
private $warning;
public function __construct($warning = false) {
diff --git a/tests/lib/setup.php b/tests/lib/SetupTest.php
index bc78c14008f..e2723efd76a 100644
--- a/tests/lib/setup.php
+++ b/tests/lib/SetupTest.php
@@ -6,23 +6,25 @@
* See the COPYING-README file.
*/
+namespace Test;
+
use OCP\IConfig;
-class Test_OC_Setup extends \Test\TestCase {
+class SetupTest extends \Test\TestCase {
- /** @var IConfig | PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
protected $config;
- /** @var \bantu\IniGetWrapper\IniGetWrapper | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \bantu\IniGetWrapper\IniGetWrapper | \PHPUnit_Framework_MockObject_MockObject */
private $iniWrapper;
- /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject */
private $l10n;
- /** @var \OC_Defaults | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC_Defaults | \PHPUnit_Framework_MockObject_MockObject */
private $defaults;
- /** @var \OC\Setup | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Setup | \PHPUnit_Framework_MockObject_MockObject */
protected $setupClass;
- /** @var \OCP\ILogger | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\ILogger | \PHPUnit_Framework_MockObject_MockObject */
protected $logger;
- /** @var \OCP\Security\ISecureRandom | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Security\ISecureRandom | \PHPUnit_Framework_MockObject_MockObject */
protected $random;
protected function setUp() {
diff --git a/tests/lib/streamwrappers.php b/tests/lib/StreamWrappersTest.php
index 7175683a60b..14bcbb847d9 100644
--- a/tests/lib/streamwrappers.php
+++ b/tests/lib/StreamWrappersTest.php
@@ -20,12 +20,14 @@
*
*/
+namespace Test;
+
/**
- * Class Test_StreamWrappers
+ * Class StreamWrappersTest
*
* @group DB
*/
-class Test_StreamWrappers extends \Test\TestCase {
+class StreamWrappersTest extends \Test\TestCase {
private static $trashBinStatus;
diff --git a/tests/lib/tags.php b/tests/lib/TagsTest.php
index 91472d5ceb8..88e0f87ad8f 100644
--- a/tests/lib/tags.php
+++ b/tests/lib/TagsTest.php
@@ -20,12 +20,14 @@
*
*/
+namespace Test;
+
/**
- * Class Test_Tags
+ * Class TagsTest
*
* @group DB
*/
-class Test_Tags extends \Test\TestCase {
+class TagsTest extends \Test\TestCase {
protected $objectType;
/** @var \OCP\IUser */
@@ -41,12 +43,12 @@ class Test_Tags extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- OC_User::clearBackends();
- OC_User::useBackend('dummy');
+ \OC_User::clearBackends();
+ \OC_User::useBackend('dummy');
$userId = $this->getUniqueID('user_');
\OC::$server->getUserManager()->createUser($userId, 'pass');
- OC_User::setUserId($userId);
- $this->user = new OC\User\User($userId, null);
+ \OC_User::setUserId($userId);
+ $this->user = new \OC\User\User($userId, null);
$this->userSession = $this->getMock('\OCP\IUserSession');
$this->userSession
->expects($this->any())
@@ -54,8 +56,8 @@ class Test_Tags extends \Test\TestCase {
->will($this->returnValue($this->user));
$this->objectType = $this->getUniqueID('type_');
- $this->tagMapper = new OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
- $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
+ $this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
+ $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
}
@@ -73,7 +75,7 @@ class Test_Tags extends \Test\TestCase {
->expects($this->any())
->method('getUser')
->will($this->returnValue(null));
- $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
+ $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
$this->assertNull($this->tagMgr->load($this->objectType));
}
@@ -236,7 +238,7 @@ class Test_Tags extends \Test\TestCase {
$this->assertTrue($tagger->rename('Wrok', 'Work'));
$this->assertTrue($tagger->hasTag('Work'));
- $this->assertFalse($tagger->hastag('Wrok'));
+ $this->assertFalse($tagger->hasTag('Wrok'));
$this->assertFalse($tagger->rename('Wrok', 'Work')); // Rename non-existant tag.
$this->assertFalse($tagger->rename('Work', 'Family')); // Collide with existing tag.
}
@@ -284,28 +286,28 @@ class Test_Tags extends \Test\TestCase {
public function testShareTags() {
$testTag = 'TestTag';
- OCP\Share::registerBackend('test', 'Test_Share_Backend');
+ \OCP\Share::registerBackend('test', 'Test_Share_Backend');
$tagger = $this->tagMgr->load('test');
$tagger->tagAs(1, $testTag);
$otherUserId = $this->getUniqueID('user2_');
\OC::$server->getUserManager()->createUser($otherUserId, 'pass');
- OC_User::setUserId($otherUserId);
+ \OC_User::setUserId($otherUserId);
$otherUserSession = $this->getMock('\OCP\IUserSession');
$otherUserSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue(new OC\User\User($otherUserId, null)));
+ ->will($this->returnValue(new \OC\User\User($otherUserId, null)));
- $otherTagMgr = new OC\TagManager($this->tagMapper, $otherUserSession);
+ $otherTagMgr = new \OC\TagManager($this->tagMapper, $otherUserSession);
$otherTagger = $otherTagMgr->load('test');
$this->assertFalse($otherTagger->hasTag($testTag));
- OC_User::setUserId($this->user->getUID());
- OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
+ \OC_User::setUserId($this->user->getUID());
+ \OCP\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
- OC_User::setUserId($otherUserId);
+ \OC_User::setUserId($otherUserId);
$otherTagger = $otherTagMgr->load('test', array(), true); // Update tags, load shared ones.
$this->assertTrue($otherTagger->hasTag($testTag));
$this->assertContains(1, $otherTagger->getIdsForTag($testTag));
diff --git a/tests/lib/template.php b/tests/lib/TemplateFunctionsTest.php
index 6e62d3955f1..aa3c73d4743 100644
--- a/tests/lib/template.php
+++ b/tests/lib/TemplateFunctionsTest.php
@@ -1,5 +1,4 @@
<?php
-
/**
* ownCloud
*
@@ -20,12 +19,15 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
-class Test_TemplateFunctions extends \Test\TestCase {
+
+namespace Test;
+
+class TemplateFunctionsTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib']);
+ $loader = new \OC\Autoloader([\OC::$SERVERROOT . '/lib']);
$loader->load('OC_Template');
}
diff --git a/tests/lib/updater.php b/tests/lib/UpdaterTest.php
index f97eb3ac139..643a18cc714 100644
--- a/tests/lib/updater.php
+++ b/tests/lib/UpdaterTest.php
@@ -20,8 +20,9 @@
*
*/
-namespace OC;
+namespace Test;
+use OC\Updater;
use OCP\IConfig;
use OCP\ILogger;
use OC\IntegrityCheck\Checker;
diff --git a/tests/lib/urlGenerator.php b/tests/lib/UrlGeneratorTest.php
index 07103225baa..7186c8fad80 100644
--- a/tests/lib/urlGenerator.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test;
+
/**
- * Class Test_UrlGenerator
+ * Class UrlGeneratorTest
*
* @group DB
*/
-class Test_UrlGenerator extends \Test\TestCase {
+class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
diff --git a/tests/lib/utilcheckserver.php b/tests/lib/UtilCheckServerTest.php
index 94e7fd2f779..b864af6888a 100644
--- a/tests/lib/utilcheckserver.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -6,18 +6,20 @@
* See the COPYING-README file.
*/
+namespace Test;
+
/**
* Tests for server check functions
*
* @group DB
*/
-class Test_Util_CheckServer extends \Test\TestCase {
+class UtilCheckServerTest extends \Test\TestCase {
private $datadir;
/**
* @param array $systemOptions
- * @return \OCP\IConfig | PHPUnit_Framework_MockObject_MockObject
+ * @return \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject
*/
protected function getConfig($systemOptions) {
$systemOptions['datadirectory'] = $this->datadir;
diff --git a/tests/lib/util.php b/tests/lib/UtilTest.php
index 4d788353881..7da7db0291c 100644
--- a/tests/lib/util.php
+++ b/tests/lib/UtilTest.php
@@ -1,12 +1,16 @@
<?php
-
/**
* Copyright (c) 2012 Lukas Reschke <lukas@statuscode.ch>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
-class Test_Util extends \Test\TestCase {
+
+namespace Test;
+
+use OC_Util;
+
+class UtilTest extends \Test\TestCase {
public function testGetVersion() {
$version = \OCP\Util::getVersion();
$this->assertTrue(is_array($version));
@@ -46,7 +50,7 @@ class Test_Util extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
*/
function testFormatDateWithInvalidTZ() {
OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr');
@@ -283,7 +287,7 @@ class Test_Util extends \Test\TestCase {
* @dataProvider defaultAppsProvider
*/
function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) {
- $oldDefaultApps = \OCP\Config::getSystemValue('core', 'defaultapp', '');
+ $oldDefaultApps = \OCP\Config::getSystemValue('defaultapp', '');
// CLI is doing messy stuff with the webroot, so need to work it around
$oldWebRoot = \OC::$WEBROOT;
\OC::$WEBROOT = '';
diff --git a/tests/lib/group.php b/tests/lib/group/LegacyGroupTest.php
index d3ac6d8d69e..12bcfdddf15 100644
--- a/tests/lib/group.php
+++ b/tests/lib/group/LegacyGroupTest.php
@@ -22,7 +22,12 @@
*
*/
-class Test_Group extends \Test\TestCase {
+namespace Test\Group;
+
+use OC_Group;
+use OC_User;
+
+class LegacyGroupTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
OC_Group::clearBackends();
diff --git a/tests/lib/ocsclienttest.php b/tests/lib/ocsclienttest.php
index 7555562d124..4ae6fb62e0e 100644
--- a/tests/lib/ocsclienttest.php
+++ b/tests/lib/ocsclienttest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test;
+
use OC\OCSClient;
use OCP\Http\Client\IClientService;
use OCP\IConfig;