@@ -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; |
@@ -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 */ |
@@ -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'); |
@@ -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 |
@@ -6,7 +6,9 @@ | |||
* See the COPYING-README file. | |||
*/ | |||
class Test_NaturalSort extends \Test\TestCase { | |||
namespace Test; | |||
class NaturalSortTest extends \Test\TestCase { | |||
/** | |||
* @dataProvider naturalSortDataProvider |
@@ -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) { |
@@ -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() { |
@@ -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; | |||
@@ -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)); |
@@ -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'); | |||
} | |||
@@ -20,8 +20,9 @@ | |||
* | |||
*/ | |||
namespace OC; | |||
namespace Test; | |||
use OC\Updater; | |||
use OCP\IConfig; | |||
use OCP\ILogger; | |||
use OC\IntegrityCheck\Checker; |
@@ -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 |
@@ -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; |
@@ -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 = ''; |
@@ -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(); |
@@ -19,6 +19,8 @@ | |||
* | |||
*/ | |||
namespace Test; | |||
use OC\OCSClient; | |||
use OCP\Http\Client\IClientService; | |||
use OCP\IConfig; |