Merge pull request #24716 from owncloud/fix-test-namespaces-2
Fix test namespaces [files-]
This commit is contained in:
commit
61b3260ebd
80 changed files with 529 additions and 408 deletions
|
@ -154,7 +154,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
|
|||
public function testKeepNonFileShares() {
|
||||
$this->loginAsUser($this->user1);
|
||||
|
||||
\OCP\Share::registerBackend('test', 'Test_Share_Backend');
|
||||
\OCP\Share::registerBackend('test', 'Test\Share\Backend');
|
||||
|
||||
$this->assertTrue(
|
||||
\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
|
||||
|
|
|
@ -51,7 +51,7 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
|
||||
\OCP\Share::registerBackend('test', 'Test_Share_Backend');
|
||||
\OCP\Share::registerBackend('test', 'Test\Share\Backend');
|
||||
|
||||
$config = $this->getMockBuilder('\OCP\IConfig')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
class Test_API extends \Test\TestCase {
|
||||
namespace Test;
|
||||
|
||||
class APITest extends \Test\TestCase {
|
||||
|
||||
// Helps build a response variable
|
||||
|
||||
|
@ -14,7 +16,7 @@ class Test_API extends \Test\TestCase {
|
|||
* @param string $message
|
||||
*/
|
||||
function buildResponse($shipped, $data, $code, $message=null) {
|
||||
$resp = new OC_OCS_Result($data, $code, $message);
|
||||
$resp = new \OC_OCS_Result($data, $code, $message);
|
||||
$resp->addHeader('KEY', 'VALUE');
|
||||
return [
|
||||
'shipped' => $shipped,
|
||||
|
@ -26,13 +28,13 @@ class Test_API extends \Test\TestCase {
|
|||
// Validate details of the result
|
||||
|
||||
/**
|
||||
* @param OC_OCS_Result $result
|
||||
* @param \OC_OCS_Result $result
|
||||
*/
|
||||
function checkResult($result, $success) {
|
||||
// Check response is of correct type
|
||||
$this->assertInstanceOf('OC_OCS_Result', $result);
|
||||
// Check if it succeeded
|
||||
/** @var $result OC_OCS_Result */
|
||||
/** @var $result \OC_OCS_Result */
|
||||
$this->assertEquals($success, $result->succeeded());
|
||||
}
|
||||
|
||||
|
@ -108,7 +110,7 @@ class Test_API extends \Test\TestCase {
|
|||
|
||||
// Test merging one success result
|
||||
$response = $this->buildResponse(true, $data1, $statusCode);
|
||||
$result = OC_API::mergeResponses([$response]);
|
||||
$result = \OC_API::mergeResponses([$response]);
|
||||
$this->assertEquals($response['response'], $result);
|
||||
$this->checkResult($result, $succeeded);
|
||||
}
|
||||
|
@ -170,7 +172,7 @@ class Test_API extends \Test\TestCase {
|
|||
));
|
||||
|
||||
// Two shipped success results
|
||||
$result = OC_API::mergeResponses(array(
|
||||
$result = \OC_API::mergeResponses(array(
|
||||
$this->buildResponse($shipped1, $data1, $statusCode1, "message1"),
|
||||
$this->buildResponse($shipped2, $data2, $statusCode2, "message2"),
|
||||
));
|
|
@ -9,13 +9,13 @@
|
|||
namespace Test;
|
||||
|
||||
/**
|
||||
* Class TestAllConfig
|
||||
* Class AllConfigTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test
|
||||
*/
|
||||
class TestAllConfig extends \Test\TestCase {
|
||||
class AllConfigTest extends \Test\TestCase {
|
||||
|
||||
/** @var \OCP\IDBConnection */
|
||||
protected $connection;
|
|
@ -7,12 +7,15 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
use OCP\IAppConfig;
|
||||
|
||||
/**
|
||||
* Class Test_App
|
||||
* Class AppTest
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_App extends \Test\TestCase {
|
||||
class AppTest extends \Test\TestCase {
|
||||
|
||||
const TEST_USER1 = 'user1';
|
||||
const TEST_USER2 = 'user2';
|
||||
|
@ -267,7 +270,7 @@ class Test_App extends \Test\TestCase {
|
|||
* @dataProvider appVersionsProvider
|
||||
*/
|
||||
public function testIsAppCompatible($ocVersion, $appInfo, $expectedResult) {
|
||||
$this->assertEquals($expectedResult, OC_App::isAppCompatible($ocVersion, $appInfo));
|
||||
$this->assertEquals($expectedResult, \OC_App::isAppCompatible($ocVersion, $appInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,7 +283,7 @@ class Test_App extends \Test\TestCase {
|
|||
'requiremin' => '6',
|
||||
'requiremax' => '6',
|
||||
);
|
||||
$this->assertTrue(OC_App::isAppCompatible($ocVersion, $appInfo));
|
||||
$this->assertTrue(\OC_App::isAppCompatible($ocVersion, $appInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -478,9 +481,9 @@ class Test_App extends \Test\TestCase {
|
|||
/**
|
||||
* Register an app config mock for testing purposes.
|
||||
*
|
||||
* @param $appConfig app config mock
|
||||
* @param IAppConfig $appConfig app config mock
|
||||
*/
|
||||
private function registerAppConfig($appConfig) {
|
||||
private function registerAppConfig(IAppConfig $appConfig) {
|
||||
\OC::$server->registerService('AppConfig', function ($c) use ($appConfig) {
|
||||
return $appConfig;
|
||||
});
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
namespace Test;
|
||||
|
||||
use OC\CapabilitiesManager;
|
||||
|
||||
class CapabilitiesManagerTest extends TestCase {
|
||||
|
||||
/**
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
namespace Test;
|
||||
|
||||
class ConfigTests extends TestCase {
|
||||
class ConfigTest extends TestCase {
|
||||
const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);';
|
||||
|
||||
/** @var array */
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Test;
|
||||
|
||||
class Test_ContactsManager extends \Test\TestCase {
|
||||
class ContactsManagerTest extends \Test\TestCase {
|
||||
|
||||
/** @var \OC\ContactsManager */
|
||||
private $cm;
|
||||
|
@ -206,4 +207,4 @@ class Test_ContactsManager extends \Test\TestCase {
|
|||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Test_ErrorHandler extends \Test\TestCase {
|
||||
namespace Test;
|
||||
|
||||
class ErrorHandlerTest extends \Test\TestCase {
|
||||
|
||||
/**
|
||||
* provide username, password combinations for testRemovePassword
|
|
@ -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;
|
||||
|
||||
|
@ -54,7 +56,7 @@ class Test_StreamWrappers extends \Test\TestCase {
|
|||
|
||||
public function testCloseStream() {
|
||||
//ensure all basic stream stuff works
|
||||
$sourceFile = OC::$SERVERROOT . '/tests/data/lorem.txt';
|
||||
$sourceFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
|
||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt');
|
||||
$file = 'close://' . $tmpFile;
|
||||
$this->assertTrue(file_exists($file));
|
|
@ -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 = '';
|
|
@ -7,16 +7,14 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Lib;
|
||||
|
||||
use Test\TestCase;
|
||||
namespace Test;
|
||||
|
||||
/**
|
||||
* Class AppConfig
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Lib
|
||||
* @package Test
|
||||
*/
|
||||
class AppConfig extends TestCase {
|
||||
/** @var \OCP\IAppConfig */
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
use OC\AvatarManager;
|
||||
use Test\Traits\UserTrait;
|
||||
use Test\Traits\MountProviderTrait;
|
||||
|
@ -48,7 +51,7 @@ class AvatarManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage user does not exist
|
||||
*/
|
||||
public function testGetAvatarInvalidUser() {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
|
@ -7,23 +6,25 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
use OCP\Files\Folder;
|
||||
|
||||
class AvatarTest extends \Test\TestCase {
|
||||
/** @var Folder | PHPUnit_Framework_MockObject_MockObject */
|
||||
/** @var Folder | \PHPUnit_Framework_MockObject_MockObject */
|
||||
private $folder;
|
||||
|
||||
/** @var \OC\Avatar */
|
||||
private $avatar;
|
||||
|
||||
/** @var \OC\User\User | PHPUnit_Framework_MockObject_MockObject $user */
|
||||
/** @var \OC\User\User | \PHPUnit_Framework_MockObject_MockObject $user */
|
||||
private $user;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->folder = $this->getMock('\OCP\Files\Folder');
|
||||
/** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject $l */
|
||||
/** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */
|
||||
$l = $this->getMock('\OCP\IL10N');
|
||||
$l->method('t')->will($this->returnArgument(0));
|
||||
$this->user = $this->getMockBuilder('\OC\User\User')->disableOriginalConstructor()->getMock();
|
||||
|
@ -41,7 +42,7 @@ class AvatarTest extends \Test\TestCase {
|
|||
['avatar.128.jpg', true],
|
||||
]));
|
||||
|
||||
$expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
|
||||
$file = $this->getMock('\OCP\Files\File');
|
||||
$file->method('getContent')->willReturn($expected->data());
|
||||
|
@ -56,7 +57,7 @@ class AvatarTest extends \Test\TestCase {
|
|||
['avatar.jpg', true],
|
||||
]));
|
||||
|
||||
$expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
|
||||
$file = $this->getMock('\OCP\Files\File');
|
||||
$file->method('getContent')->willReturn($expected->data());
|
||||
|
@ -72,8 +73,8 @@ class AvatarTest extends \Test\TestCase {
|
|||
['avatar.32.png', false],
|
||||
]));
|
||||
|
||||
$expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$expected2 = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$expected2 = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$expected2->resize(32);
|
||||
|
||||
$file = $this->getMock('\OCP\Files\File');
|
||||
|
@ -157,7 +158,7 @@ class AvatarTest extends \Test\TestCase {
|
|||
->with('avatar.png')
|
||||
->willReturn($newFile);
|
||||
|
||||
$image = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$image = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
|
||||
$newFile->expects($this->once())
|
||||
->method('putContent')
|
||||
->with($image->data());
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
|
@ -7,14 +6,17 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\DB;
|
||||
|
||||
use OC_DB;
|
||||
use OCP\Security\ISecureRandom;
|
||||
|
||||
/**
|
||||
* Class Test_DBSchema
|
||||
* Class DBSchemaTest
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_DBSchema extends \Test\TestCase {
|
||||
class DBSchemaTest extends \Test\TestCase {
|
||||
protected $schema_file = 'static://test_db_scheme';
|
||||
protected $schema_file2 = 'static://test_db_scheme2';
|
||||
protected $table1;
|
||||
|
@ -23,8 +25,8 @@ class Test_DBSchema extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
|
||||
$dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml';
|
||||
$dbfile = \OC::$SERVERROOT.'/tests/data/db_structure.xml';
|
||||
$dbfile2 = \OC::$SERVERROOT.'/tests/data/db_structure2.xml';
|
||||
|
||||
$r = '_' . \OC::$server->getSecureRandom()->
|
||||
generate(4, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) . '_';
|
|
@ -6,12 +6,16 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\DB;
|
||||
|
||||
use OC_DB;
|
||||
|
||||
/**
|
||||
* Class Test_DB
|
||||
* Class LegacyDBTest
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_DB extends \Test\TestCase {
|
||||
class LegacyDBTest extends \Test\TestCase {
|
||||
protected $backupGlobals = FALSE;
|
||||
|
||||
protected static $schema_file = 'static://test_db_scheme';
|
||||
|
@ -45,7 +49,7 @@ class Test_DB extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$dbFile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
|
||||
$dbFile = \OC::$SERVERROOT.'/tests/data/db_structure.xml';
|
||||
|
||||
$r = $this->getUniqueID('_', 4).'_';
|
||||
$content = file_get_contents( $dbFile );
|
3
tests/lib/files/cache/cache.php
vendored
3
tests/lib/files/cache/cache.php
vendored
|
@ -8,7 +8,6 @@
|
|||
|
||||
namespace Test\Files\Cache;
|
||||
|
||||
use PHPUnit_Framework_MockObject_MockObject;
|
||||
|
||||
class LongId extends \OC\Files\Storage\Temporary {
|
||||
public function getId() {
|
||||
|
@ -491,7 +490,7 @@ class Cache extends \Test\TestCase {
|
|||
$folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e";
|
||||
|
||||
/**
|
||||
* @var \OC\Files\Cache\Cache | PHPUnit_Framework_MockObject_MockObject $cacheMock
|
||||
* @var \OC\Files\Cache\Cache | \PHPUnit_Framework_MockObject_MockObject $cacheMock
|
||||
*/
|
||||
$cacheMock = $this->getMock('\OC\Files\Cache\Cache', array('normalize'), array($this->storage), '', true);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use OC\User\User;
|
|||
*
|
||||
* @package Test\Files\Node
|
||||
*/
|
||||
class IntegrationTests extends \Test\TestCase {
|
||||
class IntegrationTest extends \Test\TestCase {
|
||||
/**
|
||||
* @var \OC\Files\Node\Root $root
|
||||
*/
|
|
@ -18,22 +18,22 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\ObjectStore\Tests\Unit;
|
||||
namespace Test\Files\Cache\ObjectStore;
|
||||
|
||||
use OC\Files\ObjectStore\ObjectStoreStorage;
|
||||
use OC\Files\ObjectStore\Swift as ObjectStoreToTest;
|
||||
use OC\Files\ObjectStore\Swift;
|
||||
|
||||
/**
|
||||
* Class Swift
|
||||
* Class SwiftTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package OCA\ObjectStore\Tests\Unit
|
||||
* @package Test\Files\Cache\ObjectStore
|
||||
*/
|
||||
class Swift extends \Test\Files\Storage\Storage {
|
||||
class SwiftTest extends \Test\Files\Storage\Storage {
|
||||
|
||||
/**
|
||||
* @var ObjectStoreToTest
|
||||
* @var Swift
|
||||
*/
|
||||
private $objectStorage;
|
||||
|
||||
|
@ -63,7 +63,7 @@ class Swift extends \Test\Files\Storage\Storage {
|
|||
\OC_User::setUserId('test');
|
||||
|
||||
$config = \OC::$server->getConfig()->getSystemValue('objectstore');
|
||||
$this->objectStorage = new ObjectStoreToTest($config['arguments']);
|
||||
$this->objectStorage = new Swift($config['arguments']);
|
||||
$config['objectstore'] = $this->objectStorage;
|
||||
$this->instance = new ObjectStoreStorage($config);
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
namespace Test\Files\Cache;
|
||||
namespace Test\Files\Cache\ObjectStore;
|
||||
|
||||
class NoopScanner extends \Test\TestCase {
|
||||
/** @var \OC\Files\Storage\Storage $storage */
|
||||
|
|
|
@ -17,7 +17,7 @@ use OC\Files\View;
|
|||
*
|
||||
* @package Test\Files
|
||||
*/
|
||||
class PathVerification extends \Test\TestCase {
|
||||
class PathVerificationTest extends \Test\TestCase {
|
||||
|
||||
/**
|
||||
* @var \OC\Files\View
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage\Wrapper;
|
||||
|
||||
class Availability extends \Test\TestCase {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Type;
|
||||
namespace Test\Files\Type;
|
||||
|
||||
use \OC\Files\Type\Loader;
|
||||
use \OCP\IDBConnection;
|
||||
|
|
|
@ -1508,7 +1508,7 @@ class View extends \Test\TestCase {
|
|||
$defaultView = new \OC\Files\View('/foo/files');
|
||||
$defaultRootValue->setValue($defaultView);
|
||||
$view = new \OC\Files\View($root);
|
||||
$result = \Test_Helper::invokePrivate($view, 'shouldEmitHooks', [$path]);
|
||||
$result = $this->invokePrivate($view, 'shouldEmitHooks', [$path]);
|
||||
$defaultRootValue->setValue($oldRoot);
|
||||
$this->assertEquals($shouldEmit, $result);
|
||||
}
|
||||
|
@ -1872,7 +1872,7 @@ class View extends \Test\TestCase {
|
|||
|
||||
$this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypePre, 'File locked properly during pre-hook');
|
||||
$this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeDuring, 'File locked properly during operation');
|
||||
$this->assertNull(null, $lockTypePost, 'No post hook, no lock check possible');
|
||||
$this->assertNull($lockTypePost, 'No post hook, no lock check possible');
|
||||
|
||||
$this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeDuring, 'File still locked after fopen');
|
||||
|
||||
|
|
|
@ -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();
|
|
@ -24,12 +24,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Group;
|
||||
|
||||
/**
|
||||
* Class Test_Group_Backend
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
abstract class Test_Group_Backend extends \Test\TestCase {
|
||||
abstract class Backend extends \Test\TestCase {
|
||||
/**
|
||||
* @var \OC\Group\Backend $backend
|
||||
*/
|
||||
|
|
|
@ -23,12 +23,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Group;
|
||||
|
||||
/**
|
||||
* Class Test_Group_Database
|
||||
* Class Database
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_Group_Database extends Test_Group_Backend {
|
||||
class Database extends Backend {
|
||||
private $groups = array();
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Group;
|
||||
|
||||
/**
|
||||
* Class Test_Group_Dummy
|
||||
* Class Dummy
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_Group_Dummy extends Test_Group_Backend {
|
||||
class Dummy extends Backend {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->backend=new \Test\Util\Group\Dummy();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace Test\Group;
|
||||
|
||||
class Test_MetaData extends \Test\TestCase {
|
||||
class MetaDataTest extends \Test\TestCase {
|
||||
/** @var \OC\Group\Manager */
|
||||
private $groupManager;
|
||||
/** @var \OCP\IUserSession */
|
|
@ -6,9 +6,11 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace OC\Http\Client;
|
||||
namespace Test\Http\Client;
|
||||
|
||||
use GuzzleHttp\Client as GuzzleClient;
|
||||
use OC\Http\Client\Client;
|
||||
use OC\Http\Client\ClientService;
|
||||
|
||||
/**
|
||||
* Class ClientServiceTest
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace OC\Http\Client;
|
||||
namespace Test\Http\Client;
|
||||
|
||||
use GuzzleHttp\Message\Response;
|
||||
use OC\Http\Client\Client;
|
||||
use OCP\IConfig;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace OC\Http\Client;
|
||||
namespace Test\Http\Client;
|
||||
|
||||
use Guzzle\Stream\Stream;
|
||||
use GuzzleHttp\Message\Response as GuzzleResponse;
|
||||
use OC\Http\Client\Response;
|
||||
|
||||
/**
|
||||
* Class ResponseTest
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace Test\IntegrityCheck;
|
|||
|
||||
use OC\IntegrityCheck\Checker;
|
||||
use OC\Memcache\NullCache;
|
||||
use OCP\ICache;
|
||||
use phpseclib\Crypt\RSA;
|
||||
use phpseclib\File\X509;
|
||||
use Test\TestCase;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\IntegrityCheck\Factories;
|
||||
namespace Test\IntegrityCheck\Helpers;
|
||||
|
||||
use OC\IntegrityCheck\Helpers\EnvironmentHelper;
|
||||
use Test\TestCase;
|
||||
|
|
|
@ -6,11 +6,13 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
namespace Test\Mail;
|
||||
|
||||
use OC\Mail\Mailer;
|
||||
use OCP\IConfig;
|
||||
use OC_Defaults;
|
||||
use OCP\ILogger;
|
||||
use Test\TestCase;
|
||||
|
||||
class MailerTest extends TestCase {
|
||||
/** @var IConfig */
|
|
@ -6,10 +6,11 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
namespace Test\Mail;
|
||||
|
||||
use OC\Mail\Message;
|
||||
use Swift_Message;
|
||||
use Test\TestCase;
|
||||
|
||||
class MessageTest extends TestCase {
|
||||
/** @var Swift_Message */
|
|
@ -56,7 +56,7 @@ class Test_Factory_Unavailable_Cache2 {
|
|||
}
|
||||
}
|
||||
|
||||
class Test_Factory extends \Test\TestCase {
|
||||
class FactoryTest extends \Test\TestCase {
|
||||
const AVAILABLE1 = '\\Test\\Memcache\\Test_Factory_Available_Cache1';
|
||||
const AVAILABLE2 = '\\Test\\Memcache\\Test_Factory_Available_Cache2';
|
||||
const UNAVAILABLE1 = '\\Test\\Memcache\\Test_Factory_Unavailable_Cache1';
|
|
@ -20,12 +20,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\OCS;
|
||||
|
||||
use OC_OCS_Privatedata;
|
||||
|
||||
/**
|
||||
* Class Test_OC_OCS_Privatedata
|
||||
* Class PrivatedataTest
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_OC_OCS_Privatedata extends \Test\TestCase {
|
||||
class PrivatedataTest extends \Test\TestCase {
|
||||
private $appKey;
|
||||
|
||||
protected function setUp() {
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test;
|
||||
|
||||
use OC\OCSClient;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
|
|
|
@ -19,15 +19,17 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class Test_Contacts extends \Test\TestCase {
|
||||
namespace Test\PublicNamespace;
|
||||
|
||||
class ContactsTest extends \Test\TestCase {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
OCP\Contacts::clear();
|
||||
\OCP\Contacts::clear();
|
||||
}
|
||||
|
||||
public function testDisabledIfEmpty() {
|
||||
// pretty simple
|
||||
$this->assertFalse(OCP\Contacts::isEnabled());
|
||||
$this->assertFalse(\OCP\Contacts::isEnabled());
|
||||
}
|
||||
|
||||
public function testEnabledAfterRegister() {
|
||||
|
@ -41,19 +43,19 @@ class Test_Contacts extends \Test\TestCase {
|
|||
->method('getKey');
|
||||
|
||||
// not enabled before register
|
||||
$this->assertFalse(OCP\Contacts::isEnabled());
|
||||
$this->assertFalse(\OCP\Contacts::isEnabled());
|
||||
|
||||
// register the address book
|
||||
OCP\Contacts::registerAddressBook($stub);
|
||||
\OCP\Contacts::registerAddressBook($stub);
|
||||
|
||||
// contacts api shall be enabled
|
||||
$this->assertTrue(OCP\Contacts::isEnabled());
|
||||
$this->assertTrue(\OCP\Contacts::isEnabled());
|
||||
|
||||
// unregister the address book
|
||||
OCP\Contacts::unregisterAddressBook($stub);
|
||||
\OCP\Contacts::unregisterAddressBook($stub);
|
||||
|
||||
// not enabled after register
|
||||
$this->assertFalse(OCP\Contacts::isEnabled());
|
||||
$this->assertFalse(\OCP\Contacts::isEnabled());
|
||||
}
|
||||
|
||||
public function testAddressBookEnumeration() {
|
||||
|
@ -69,8 +71,8 @@ class Test_Contacts extends \Test\TestCase {
|
|||
->will($this->returnValue('A very simple Addressbook'));
|
||||
|
||||
// register the address book
|
||||
OCP\Contacts::registerAddressBook($stub);
|
||||
$all_books = OCP\Contacts::getAddressBooks();
|
||||
\OCP\Contacts::registerAddressBook($stub);
|
||||
$all_books = \OCP\Contacts::getAddressBooks();
|
||||
|
||||
$this->assertEquals(1, count($all_books));
|
||||
$this->assertEquals('A very simple Addressbook', $all_books['SIMPLE_ADDRESS_BOOK']);
|
||||
|
@ -101,15 +103,15 @@ class Test_Contacts extends \Test\TestCase {
|
|||
$stub2->expects($this->any())->method('search')->will($this->returnValue($searchResult2));
|
||||
|
||||
// register the address books
|
||||
OCP\Contacts::registerAddressBook($stub1);
|
||||
OCP\Contacts::registerAddressBook($stub2);
|
||||
$all_books = OCP\Contacts::getAddressBooks();
|
||||
\OCP\Contacts::registerAddressBook($stub1);
|
||||
\OCP\Contacts::registerAddressBook($stub2);
|
||||
$all_books = \OCP\Contacts::getAddressBooks();
|
||||
|
||||
// assert the count - doesn't hurt
|
||||
$this->assertEquals(2, count($all_books));
|
||||
|
||||
// perform the search
|
||||
$result = OCP\Contacts::search('x', array());
|
||||
$result = \OCP\Contacts::search('x', array());
|
||||
|
||||
// we expect 4 hits
|
||||
$this->assertEquals(4, count($result));
|
|
@ -19,7 +19,9 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class Test_OCPConfig extends \Test\TestCase {
|
||||
namespace Test\PublicNamespace;
|
||||
|
||||
class OCPConfigTest extends \Test\TestCase {
|
||||
|
||||
public function testSetAppValueIfSetToNull() {
|
||||
|
|
@ -19,10 +19,13 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class Test_Public_Util extends \Test\TestCase {
|
||||
namespace Test\PublicNamespace;
|
||||
|
||||
|
||||
class UtilTest extends \Test\TestCase {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
OCP\Contacts::clear();
|
||||
\OCP\Contacts::clear();
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Test\Repair;
|
||||
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +28,7 @@ class TestCollationRepair extends \OC\Repair\Collation {
|
|||
*
|
||||
* @see \OC\Repair\RepairMimeTypes
|
||||
*/
|
||||
class TestRepairCollation extends \Test\TestCase {
|
||||
class RepairCollationTest extends \Test\TestCase {
|
||||
|
||||
/**
|
||||
* @var TestCollationRepair
|
|
@ -6,6 +6,8 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use \OC\Security\CertificateManager;
|
||||
|
||||
/**
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use \OC\Security\Certificate;
|
||||
|
||||
class CertificateTest extends \Test\TestCase {
|
||||
|
@ -74,18 +76,18 @@ class CertificateTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetIssueDate() {
|
||||
$expected = new DateTime('2015-08-27 20:03:42 GMT');
|
||||
$expected = new \DateTime('2015-08-27 20:03:42 GMT');
|
||||
$this->assertEquals($expected->getTimestamp(), $this->goodCertificate->getIssueDate()->getTimestamp());
|
||||
$expected = new DateTime('2015-08-27 20:19:13 GMT');
|
||||
$expected = new \DateTime('2015-08-27 20:19:13 GMT');
|
||||
$this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getIssueDate()->getTimestamp());
|
||||
}
|
||||
|
||||
public function testGetExpireDate() {
|
||||
$expected = new DateTime('2025-08-24 20:03:42 GMT');
|
||||
$expected = new \DateTime('2025-08-24 20:03:42 GMT');
|
||||
$this->assertEquals($expected->getTimestamp(), $this->goodCertificate->getExpireDate()->getTimestamp());
|
||||
$expected = new DateTime('2025-08-24 20:19:13 GMT');
|
||||
$expected = new \DateTime('2025-08-24 20:19:13 GMT');
|
||||
$this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getExpireDate()->getTimestamp());
|
||||
$expected = new DateTime('2014-08-28 09:12:43 GMT');
|
||||
$expected = new \DateTime('2014-08-28 09:12:43 GMT');
|
||||
$this->assertEquals($expected->getTimestamp(), $this->expiredCertificate->getExpireDate()->getTimestamp());
|
||||
}
|
||||
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use \OCP\Security\ICrypto;
|
||||
use \OCP\IDBConnection;
|
||||
use \OC\Security\CredentialsManager;
|
|
@ -6,6 +6,8 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use \OC\Security\Crypto;
|
||||
|
||||
class CryptoTest extends \Test\TestCase {
|
|
@ -6,6 +6,8 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use OC\Security\Hasher;
|
||||
|
||||
/**
|
|
@ -6,6 +6,8 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use \OC\Security\SecureRandom;
|
||||
|
||||
class SecureRandomTest extends \Test\TestCase {
|
|
@ -6,6 +6,8 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Security;
|
||||
|
||||
use \OC\Security\TrustedDomainHelper;
|
||||
use OCP\IConfig;
|
||||
|
|
@ -19,6 +19,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security\CSP;
|
||||
|
||||
|
||||
use OC\Security\CSP\ContentSecurityPolicyManager;
|
||||
|
||||
class ContentSecurityPolicyManagerTest extends \Test\TestCase {
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security\CSRF;
|
||||
|
||||
class CsrfTokenGeneratorTest extends \Test\TestCase {
|
||||
/** @var \OCP\Security\ISecureRandom */
|
||||
private $random;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security\CSRF;
|
||||
|
||||
class CsrfTokenManagerTest extends \Test\TestCase {
|
||||
/** @var \OC\Security\CSRF\CsrfTokenManager */
|
||||
private $csrfTokenManager;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security\CSRF;
|
||||
|
||||
class CsrfTokenTest extends \Test\TestCase {
|
||||
public function testGetEncryptedValue() {
|
||||
$csrfToken = new \OC\Security\CSRF\CsrfToken('MyCsrfToken');
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Security\CSRF\TokenStorage;
|
||||
|
||||
class SessionStorageTest extends \Test\TestCase {
|
||||
/** @var \OCP\ISession */
|
||||
private $session;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Share;
|
||||
|
||||
use OC\Share\MailNotifications;
|
||||
use OCP\IL10N;
|
||||
use OCP\IUser;
|
||||
|
@ -33,15 +35,15 @@ use OCP\IURLGenerator;
|
|||
class MailNotificationsTest extends \Test\TestCase {
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
/** @var IMailer | PHPUnit_Framework_MockObject_MockObject */
|
||||
/** @var IMailer | \PHPUnit_Framework_MockObject_MockObject */
|
||||
private $mailer;
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
/** @var Defaults | PHPUnit_Framework_MockObject_MockObject */
|
||||
/** @var Defaults | \PHPUnit_Framework_MockObject_MockObject */
|
||||
private $defaults;
|
||||
/** @var IUser | PHPUnit_Framework_MockObject_MockObject */
|
||||
/** @var IUser | \PHPUnit_Framework_MockObject_MockObject */
|
||||
private $user;
|
||||
/** @var IURLGenerator | PHPUnit_Framework_MockObject_MockObject */
|
||||
/** @var IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */
|
||||
private $urlGenerator;
|
||||
|
||||
|
||||
|
@ -209,7 +211,7 @@ class MailNotificationsTest extends \Test\TestCase {
|
|||
public function testSendInternalShareMail() {
|
||||
$this->setupMailerMock('TestUser shared »welcome.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false);
|
||||
|
||||
/** @var MailNotifications | PHPUnit_Framework_MockObject_MockObject $mailNotifications */
|
||||
/** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */
|
||||
$mailNotifications = $this->getMock('OC\Share\MailNotifications',['getItemSharedWithUser'], [
|
||||
$this->user,
|
||||
$this->l10n,
|
||||
|
@ -286,7 +288,7 @@ class MailNotificationsTest extends \Test\TestCase {
|
|||
->expects($this->once())
|
||||
->method('send')
|
||||
->with($message)
|
||||
->will($this->throwException(new Exception('Some Exception Message')));
|
||||
->will($this->throwException(new \Exception('Some Exception Message')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class Test_Share_Backend implements OCP\Share_Backend {
|
||||
namespace Test\Share;
|
||||
|
||||
class Backend implements \OCP\Share_Backend {
|
||||
|
||||
const FORMAT_SOURCE = 0;
|
||||
const FORMAT_TARGET = 1;
|
||||
|
|
|
@ -19,11 +19,13 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Test\Share;
|
||||
|
||||
/**
|
||||
* @group DB
|
||||
* Class Test_Share_Helper
|
||||
* Class Helper
|
||||
*/
|
||||
class Test_Share_Helper extends \Test\TestCase {
|
||||
class Helper extends \Test\TestCase {
|
||||
|
||||
public function expireDateProvider() {
|
||||
return array(
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class Test_Share_Search extends \Test\TestCase {
|
||||
namespace Test\Share;
|
||||
|
||||
class SearchResultSorter extends \Test\TestCase {
|
||||
public function testSort() {
|
||||
$search = 'lin';
|
||||
$sorter = new \OC\Share\SearchResultSorter($search, 'foobar');
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC;
|
||||
namespace Test\Update;
|
||||
|
||||
use OC\Updater\VersionCheck;
|
||||
use OCP\IConfig;
|
|
@ -20,8 +20,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Avatar_User_Dummy extends \Test\Util\User\Dummy {
|
||||
namespace Test\User;
|
||||
|
||||
class AvatarUserDummy extends \Test\Util\User\Dummy {
|
||||
public function canChangeAvatar($uid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\User;
|
||||
|
||||
/**
|
||||
* Abstract class to provide the basis of backend-specific unit test classes.
|
||||
*
|
||||
|
@ -30,7 +32,7 @@
|
|||
* For an example see /tests/lib/user/dummy.php
|
||||
*/
|
||||
|
||||
abstract class Test_User_Backend extends \Test\TestCase {
|
||||
abstract class Backend extends \Test\TestCase {
|
||||
/**
|
||||
* @var \OC\User\Backend $backend
|
||||
*/
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\User;
|
||||
|
||||
/**
|
||||
* Class Test_User_Database
|
||||
*
|
||||
* @group DB
|
||||
*/
|
||||
class Test_User_Database extends Test_User_Backend {
|
||||
class Database extends Backend {
|
||||
/** @var array */
|
||||
private $users;
|
||||
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Test_User_Dummy extends Test_User_Backend {
|
||||
namespace Test\User;
|
||||
|
||||
class Dummy extends Backend {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->backend=new \Test\Util\User\Dummy();
|
||||
|
|
|
@ -121,7 +121,7 @@ class User extends \Test\TestCase {
|
|||
* @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
|
||||
*/
|
||||
require_once 'avataruserdummy.php';
|
||||
$backend = $this->getMock('Avatar_User_Dummy');
|
||||
$backend = $this->getMock('Test\User\AvatarUserDummy');
|
||||
$backend->expects($this->once())
|
||||
->method('canChangeAvatar')
|
||||
->with($this->equalTo('foo'))
|
||||
|
@ -146,7 +146,7 @@ class User extends \Test\TestCase {
|
|||
* @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
|
||||
*/
|
||||
require_once 'avataruserdummy.php';
|
||||
$backend = $this->getMock('Avatar_User_Dummy');
|
||||
$backend = $this->getMock('Test\User\AvatarUserDummy');
|
||||
$backend->expects($this->once())
|
||||
->method('canChangeAvatar')
|
||||
->with($this->equalTo('foo'))
|
||||
|
@ -171,7 +171,7 @@ class User extends \Test\TestCase {
|
|||
* @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
|
||||
*/
|
||||
require_once 'avataruserdummy.php';
|
||||
$backend = $this->getMock('Avatar_User_Dummy');
|
||||
$backend = $this->getMock('Test\User\AvatarUserDummy');
|
||||
$backend->expects($this->never())
|
||||
->method('canChangeAvatar');
|
||||
|
||||
|
|
Loading…
Reference in a new issue