diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-05-19 09:27:21 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-05-19 09:27:21 +0200 |
commit | 55fc6536d33bd044a72437ac61d3c5ade09111cb (patch) | |
tree | ee2f5dd35734d7f8fdba75b77d5cfb98444abeb7 | |
parent | 7f3f16d1554bd2adbe3287fbf09a1124664f54af (diff) | |
download | nextcloud-server-55fc6536d33bd044a72437ac61d3c5ade09111cb.tar.gz nextcloud-server-55fc6536d33bd044a72437ac61d3c5ade09111cb.zip |
FIx lib/ a-d
-rw-r--r-- | tests/lib/APITest.php (renamed from tests/lib/api.php) | 14 | ||||
-rw-r--r-- | tests/lib/AllConfigTest.php (renamed from tests/lib/allconfig.php) | 4 | ||||
-rw-r--r-- | tests/lib/AppTest.php (renamed from tests/lib/app.php) | 15 | ||||
-rw-r--r-- | tests/lib/CapabilitiesManagerTest.php (renamed from tests/lib/capabilitiesmanager.php) | 2 | ||||
-rw-r--r-- | tests/lib/ConfigTest.php (renamed from tests/lib/configtests.php) | 2 | ||||
-rw-r--r-- | tests/lib/ContactsManagerTest.php (renamed from tests/lib/contactsmanager.php) | 5 | ||||
-rw-r--r-- | tests/lib/ErrorHandlerTest.php (renamed from tests/lib/errorHandler.php) | 4 | ||||
-rw-r--r-- | tests/lib/appconfig.php | 6 | ||||
-rw-r--r-- | tests/lib/avatarmanagertest.php | 5 | ||||
-rw-r--r-- | tests/lib/avatartest.php | 19 | ||||
-rw-r--r-- | tests/lib/db/DBSchemaTest.php (renamed from tests/lib/dbschema.php) | 12 | ||||
-rw-r--r-- | tests/lib/db/LegacyDBTest.php (renamed from tests/lib/db.php) | 10 |
12 files changed, 56 insertions, 42 deletions
diff --git a/tests/lib/api.php b/tests/lib/APITest.php index 1d1f97c4942..d3ab6db9e4b 100644 --- a/tests/lib/api.php +++ b/tests/lib/APITest.php @@ -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"), )); diff --git a/tests/lib/allconfig.php b/tests/lib/AllConfigTest.php index 869bf9b8d66..4f8b0658b80 100644 --- a/tests/lib/allconfig.php +++ b/tests/lib/AllConfigTest.php @@ -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; diff --git a/tests/lib/app.php b/tests/lib/AppTest.php index e7255ad955a..2e5b6f74ab7 100644 --- a/tests/lib/app.php +++ b/tests/lib/AppTest.php @@ -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; }); diff --git a/tests/lib/capabilitiesmanager.php b/tests/lib/CapabilitiesManagerTest.php index b5dac80ee51..d4dd52d07f1 100644 --- a/tests/lib/capabilitiesmanager.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -21,8 +21,6 @@ namespace Test; -use OC\CapabilitiesManager; - class CapabilitiesManagerTest extends TestCase { /** diff --git a/tests/lib/configtests.php b/tests/lib/ConfigTest.php index c0251e693c6..74dcdc192ce 100644 --- a/tests/lib/configtests.php +++ b/tests/lib/ConfigTest.php @@ -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 */ diff --git a/tests/lib/contactsmanager.php b/tests/lib/ContactsManagerTest.php index 39e44cc6302..89a9cb95b97 100644 --- a/tests/lib/contactsmanager.php +++ b/tests/lib/ContactsManagerTest.php @@ -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); } -}
\ No newline at end of file +} diff --git a/tests/lib/errorHandler.php b/tests/lib/ErrorHandlerTest.php index 726529e83f4..aece7f146f6 100644 --- a/tests/lib/errorHandler.php +++ b/tests/lib/ErrorHandlerTest.php @@ -20,7 +20,9 @@ * */ -class Test_ErrorHandler extends \Test\TestCase { +namespace Test; + +class ErrorHandlerTest extends \Test\TestCase { /** * provide username, password combinations for testRemovePassword diff --git a/tests/lib/appconfig.php b/tests/lib/appconfig.php index 64f0f80e045..12d9728c868 100644 --- a/tests/lib/appconfig.php +++ b/tests/lib/appconfig.php @@ -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 */ diff --git a/tests/lib/avatarmanagertest.php b/tests/lib/avatarmanagertest.php index f5cdd99176d..2dd6ff34923 100644 --- a/tests/lib/avatarmanagertest.php +++ b/tests/lib/avatarmanagertest.php @@ -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() { diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php index b0ab4cb8b5c..0a00f5d5614 100644 --- a/tests/lib/avatartest.php +++ b/tests/lib/avatartest.php @@ -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()); diff --git a/tests/lib/dbschema.php b/tests/lib/db/DBSchemaTest.php index 11eacbf397f..284fc532c2a 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/db/DBSchemaTest.php @@ -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) . '_'; diff --git a/tests/lib/db.php b/tests/lib/db/LegacyDBTest.php index 88c9ee75b3b..7aeeb3dd1f9 100644 --- a/tests/lib/db.php +++ b/tests/lib/db/LegacyDBTest.php @@ -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 ); |