Fix lib/
This commit is contained in:
parent
55fc6536d3
commit
9a4253ef7c
|
@ -6,7 +6,9 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class TestHTTPHelper extends \Test\TestCase {
|
namespace Test;
|
||||||
|
|
||||||
|
class HTTPHelperTest extends \Test\TestCase {
|
||||||
|
|
||||||
/** @var \OCP\IConfig*/
|
/** @var \OCP\IConfig*/
|
||||||
private $config;
|
private $config;
|
|
@ -6,12 +6,14 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the storage functions of OC_Helper
|
* Test the storage functions of OC_Helper
|
||||||
*
|
*
|
||||||
* @group DB
|
* @group DB
|
||||||
*/
|
*/
|
||||||
class Test_Helper_Storage extends \Test\TestCase {
|
class HelperStorageTest extends \Test\TestCase {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $user;
|
private $user;
|
||||||
/** @var \OC\Files\Storage\Storage */
|
/** @var \OC\Files\Storage\Storage */
|
|
@ -6,7 +6,11 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Test_Image extends \Test\TestCase {
|
namespace Test;
|
||||||
|
|
||||||
|
use OC;
|
||||||
|
|
||||||
|
class ImageTest extends \Test\TestCase {
|
||||||
public static function tearDownAfterClass() {
|
public static function tearDownAfterClass() {
|
||||||
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
|
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
|
||||||
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
|
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
|
|
@ -6,7 +6,11 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Test_Helper extends \Test\TestCase {
|
namespace Test;
|
||||||
|
|
||||||
|
use OC_Helper;
|
||||||
|
|
||||||
|
class LegacyHelperTest extends \Test\TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider humanFileSizeProvider
|
* @dataProvider humanFileSizeProvider
|
|
@ -6,7 +6,9 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Test_NaturalSort extends \Test\TestCase {
|
namespace Test;
|
||||||
|
|
||||||
|
class NaturalSortTest extends \Test\TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider naturalSortDataProvider
|
* @dataProvider naturalSortDataProvider
|
|
@ -11,7 +11,7 @@ namespace Test;
|
||||||
use OCP\Migration\IRepairStep;
|
use OCP\Migration\IRepairStep;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
class TestRepairStep implements IRepairStep {
|
class RepairStepTest implements IRepairStep {
|
||||||
private $warning;
|
private $warning;
|
||||||
|
|
||||||
public function __construct($warning = false) {
|
public function __construct($warning = false) {
|
|
@ -6,23 +6,25 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
use OCP\IConfig;
|
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;
|
protected $config;
|
||||||
/** @var \bantu\IniGetWrapper\IniGetWrapper | PHPUnit_Framework_MockObject_MockObject */
|
/** @var \bantu\IniGetWrapper\IniGetWrapper | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $iniWrapper;
|
private $iniWrapper;
|
||||||
/** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject */
|
/** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $l10n;
|
private $l10n;
|
||||||
/** @var \OC_Defaults | PHPUnit_Framework_MockObject_MockObject */
|
/** @var \OC_Defaults | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $defaults;
|
private $defaults;
|
||||||
/** @var \OC\Setup | PHPUnit_Framework_MockObject_MockObject */
|
/** @var \OC\Setup | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
protected $setupClass;
|
protected $setupClass;
|
||||||
/** @var \OCP\ILogger | PHPUnit_Framework_MockObject_MockObject */
|
/** @var \OCP\ILogger | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
/** @var \OCP\Security\ISecureRandom | PHPUnit_Framework_MockObject_MockObject */
|
/** @var \OCP\Security\ISecureRandom | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
protected $random;
|
protected $random;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
|
@ -20,12 +20,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Test_StreamWrappers
|
* Class StreamWrappersTest
|
||||||
*
|
*
|
||||||
* @group DB
|
* @group DB
|
||||||
*/
|
*/
|
||||||
class Test_StreamWrappers extends \Test\TestCase {
|
class StreamWrappersTest extends \Test\TestCase {
|
||||||
|
|
||||||
private static $trashBinStatus;
|
private static $trashBinStatus;
|
||||||
|
|
|
@ -20,12 +20,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Test_Tags
|
* Class TagsTest
|
||||||
*
|
*
|
||||||
* @group DB
|
* @group DB
|
||||||
*/
|
*/
|
||||||
class Test_Tags extends \Test\TestCase {
|
class TagsTest extends \Test\TestCase {
|
||||||
|
|
||||||
protected $objectType;
|
protected $objectType;
|
||||||
/** @var \OCP\IUser */
|
/** @var \OCP\IUser */
|
||||||
|
@ -41,12 +43,12 @@ class Test_Tags extends \Test\TestCase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
OC_User::clearBackends();
|
\OC_User::clearBackends();
|
||||||
OC_User::useBackend('dummy');
|
\OC_User::useBackend('dummy');
|
||||||
$userId = $this->getUniqueID('user_');
|
$userId = $this->getUniqueID('user_');
|
||||||
\OC::$server->getUserManager()->createUser($userId, 'pass');
|
\OC::$server->getUserManager()->createUser($userId, 'pass');
|
||||||
OC_User::setUserId($userId);
|
\OC_User::setUserId($userId);
|
||||||
$this->user = new OC\User\User($userId, null);
|
$this->user = new \OC\User\User($userId, null);
|
||||||
$this->userSession = $this->getMock('\OCP\IUserSession');
|
$this->userSession = $this->getMock('\OCP\IUserSession');
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
|
@ -54,8 +56,8 @@ class Test_Tags extends \Test\TestCase {
|
||||||
->will($this->returnValue($this->user));
|
->will($this->returnValue($this->user));
|
||||||
|
|
||||||
$this->objectType = $this->getUniqueID('type_');
|
$this->objectType = $this->getUniqueID('type_');
|
||||||
$this->tagMapper = new OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
|
$this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
|
||||||
$this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
|
$this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +75,7 @@ class Test_Tags extends \Test\TestCase {
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
->will($this->returnValue(null));
|
->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));
|
$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->rename('Wrok', 'Work'));
|
||||||
$this->assertTrue($tagger->hasTag('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('Wrok', 'Work')); // Rename non-existant tag.
|
||||||
$this->assertFalse($tagger->rename('Work', 'Family')); // Collide with existing tag.
|
$this->assertFalse($tagger->rename('Work', 'Family')); // Collide with existing tag.
|
||||||
}
|
}
|
||||||
|
@ -284,28 +286,28 @@ class Test_Tags extends \Test\TestCase {
|
||||||
|
|
||||||
public function testShareTags() {
|
public function testShareTags() {
|
||||||
$testTag = 'TestTag';
|
$testTag = 'TestTag';
|
||||||
OCP\Share::registerBackend('test', 'Test_Share_Backend');
|
\OCP\Share::registerBackend('test', 'Test_Share_Backend');
|
||||||
|
|
||||||
$tagger = $this->tagMgr->load('test');
|
$tagger = $this->tagMgr->load('test');
|
||||||
$tagger->tagAs(1, $testTag);
|
$tagger->tagAs(1, $testTag);
|
||||||
|
|
||||||
$otherUserId = $this->getUniqueID('user2_');
|
$otherUserId = $this->getUniqueID('user2_');
|
||||||
\OC::$server->getUserManager()->createUser($otherUserId, 'pass');
|
\OC::$server->getUserManager()->createUser($otherUserId, 'pass');
|
||||||
OC_User::setUserId($otherUserId);
|
\OC_User::setUserId($otherUserId);
|
||||||
$otherUserSession = $this->getMock('\OCP\IUserSession');
|
$otherUserSession = $this->getMock('\OCP\IUserSession');
|
||||||
$otherUserSession
|
$otherUserSession
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUser')
|
->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');
|
$otherTagger = $otherTagMgr->load('test');
|
||||||
$this->assertFalse($otherTagger->hasTag($testTag));
|
$this->assertFalse($otherTagger->hasTag($testTag));
|
||||||
|
|
||||||
OC_User::setUserId($this->user->getUID());
|
\OC_User::setUserId($this->user->getUID());
|
||||||
OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
|
\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.
|
$otherTagger = $otherTagMgr->load('test', array(), true); // Update tags, load shared ones.
|
||||||
$this->assertTrue($otherTagger->hasTag($testTag));
|
$this->assertTrue($otherTagger->hasTag($testTag));
|
||||||
$this->assertContains(1, $otherTagger->getIdsForTag($testTag));
|
$this->assertContains(1, $otherTagger->getIdsForTag($testTag));
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud
|
* ownCloud
|
||||||
*
|
*
|
||||||
|
@ -20,12 +19,15 @@
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* 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() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib']);
|
$loader = new \OC\Autoloader([\OC::$SERVERROOT . '/lib']);
|
||||||
$loader->load('OC_Template');
|
$loader->load('OC_Template');
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC;
|
namespace Test;
|
||||||
|
|
||||||
|
use OC\Updater;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OC\IntegrityCheck\Checker;
|
use OC\IntegrityCheck\Checker;
|
|
@ -6,12 +6,14 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Test_UrlGenerator
|
* Class UrlGeneratorTest
|
||||||
*
|
*
|
||||||
* @group DB
|
* @group DB
|
||||||
*/
|
*/
|
||||||
class Test_UrlGenerator extends \Test\TestCase {
|
class UrlGeneratorTest extends \Test\TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @small
|
* @small
|
|
@ -6,18 +6,20 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for server check functions
|
* Tests for server check functions
|
||||||
*
|
*
|
||||||
* @group DB
|
* @group DB
|
||||||
*/
|
*/
|
||||||
class Test_Util_CheckServer extends \Test\TestCase {
|
class UtilCheckServerTest extends \Test\TestCase {
|
||||||
|
|
||||||
private $datadir;
|
private $datadir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $systemOptions
|
* @param array $systemOptions
|
||||||
* @return \OCP\IConfig | PHPUnit_Framework_MockObject_MockObject
|
* @return \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject
|
||||||
*/
|
*/
|
||||||
protected function getConfig($systemOptions) {
|
protected function getConfig($systemOptions) {
|
||||||
$systemOptions['datadirectory'] = $this->datadir;
|
$systemOptions['datadirectory'] = $this->datadir;
|
|
@ -1,12 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Lukas Reschke <lukas@statuscode.ch>
|
* Copyright (c) 2012 Lukas Reschke <lukas@statuscode.ch>
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
* later.
|
* later.
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
class Test_Util extends \Test\TestCase {
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
|
use OC_Util;
|
||||||
|
|
||||||
|
class UtilTest extends \Test\TestCase {
|
||||||
public function testGetVersion() {
|
public function testGetVersion() {
|
||||||
$version = \OCP\Util::getVersion();
|
$version = \OCP\Util::getVersion();
|
||||||
$this->assertTrue(is_array($version));
|
$this->assertTrue(is_array($version));
|
||||||
|
@ -46,7 +50,7 @@ class Test_Util extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Exception
|
* @expectedException \Exception
|
||||||
*/
|
*/
|
||||||
function testFormatDateWithInvalidTZ() {
|
function testFormatDateWithInvalidTZ() {
|
||||||
OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr');
|
OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr');
|
||||||
|
@ -283,7 +287,7 @@ class Test_Util extends \Test\TestCase {
|
||||||
* @dataProvider defaultAppsProvider
|
* @dataProvider defaultAppsProvider
|
||||||
*/
|
*/
|
||||||
function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) {
|
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
|
// CLI is doing messy stuff with the webroot, so need to work it around
|
||||||
$oldWebRoot = \OC::$WEBROOT;
|
$oldWebRoot = \OC::$WEBROOT;
|
||||||
\OC::$WEBROOT = '';
|
\OC::$WEBROOT = '';
|
|
@ -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() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
OC_Group::clearBackends();
|
OC_Group::clearBackends();
|
|
@ -19,6 +19,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Test;
|
||||||
|
|
||||||
use OC\OCSClient;
|
use OC\OCSClient;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
Loading…
Reference in New Issue