diff options
author | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2014-02-19 09:31:54 +0100 |
---|---|---|
committer | Scrutinizer <auto-fixer@scrutinizer-ci.com> | 2014-02-19 09:31:54 +0100 |
commit | adaee6a5a19a4b0050d189736bd4e6183fee9cf0 (patch) | |
tree | a553fc57c2ff8c99081f8e15fbee7dff2c00adbf /tests | |
parent | 1e321406ee2d973e937637ab090cbd83a6eb40cf (diff) | |
download | nextcloud-server-adaee6a5a19a4b0050d189736bd4e6183fee9cf0.tar.gz nextcloud-server-adaee6a5a19a4b0050d189736bd4e6183fee9cf0.zip |
Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
https://scrutinizer-ci.com/g/owncloud/core/inspections/cdfecc4e-a37e-4233-8025-f0d7252a8720
Enabled analysis tools:
- PHP Analyzer
- JSHint
- PHP Copy/Paste Detector
- PHP PDepend
Diffstat (limited to 'tests')
24 files changed, 91 insertions, 14 deletions
diff --git a/tests/lib/api.php b/tests/lib/api.php index 9c4324e63e0..233beebd68a 100644 --- a/tests/lib/api.php +++ b/tests/lib/api.php @@ -9,6 +9,10 @@ class Test_API extends PHPUnit_Framework_TestCase { // Helps build a response variable + + /** + * @param string $message + */ function buildResponse($shipped, $data, $code, $message=null) { return array( 'shipped' => $shipped, @@ -18,6 +22,10 @@ class Test_API extends PHPUnit_Framework_TestCase { } // Validate details of the result + + /** + * @param OC_OCS_Result $result + */ function checkResult($result, $success) { // Check response is of correct type $this->assertInstanceOf('OC_OCS_Result', $result); diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php index 6cf0da879ff..9841dcaa1f7 100644 --- a/tests/lib/appframework/http/DispatcherTest.php +++ b/tests/lib/appframework/http/DispatcherTest.php @@ -24,7 +24,6 @@ namespace OC\AppFramework\Http; -use OC\AppFramework\Core\API; use OC\AppFramework\Middleware\MiddlewareDispatcher; use OCP\AppFramework\Http; //require_once(__DIR__ . "/../classloader.php"); @@ -78,6 +77,10 @@ class DispatcherTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $out + * @param string $httpHeaders + */ private function setMiddlewareExpections($out=null, $httpHeaders=null, $responseHeaders=array(), $ex=false, $catchEx=true) { diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php index 1a38c38c1e7..4f21d77a170 100644 --- a/tests/lib/appframework/http/ResponseTest.php +++ b/tests/lib/appframework/http/ResponseTest.php @@ -25,8 +25,8 @@ namespace OC\AppFramework\Http; -use OCP\AppFramework\Http\Response, - OCP\AppFramework\Http; +use OCP\AppFramework\Http\Response; +use OCP\AppFramework\Http; class ResponseTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php index 95d42e4eb8e..f16b14150c3 100644 --- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php @@ -50,6 +50,9 @@ class TestMiddleware extends Middleware { private $beforeControllerThrowsEx; + /** + * @param boolean $beforeControllerThrowsEx + */ public function __construct($beforeControllerThrowsEx) { self::$beforeControllerCalled = 0; self::$afterControllerCalled = 0; diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php index dae6135dc54..63c48a62829 100644 --- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php @@ -58,6 +58,9 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $method + */ private function checkNavEntry($method){ $api = $this->getAPI(); @@ -79,6 +82,10 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $method + * @param string $test + */ private function ajaxExceptionStatus($method, $test, $status) { $api = $this->getAPI(); $api->expects($this->any()) @@ -183,6 +190,10 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $method + * @param string $expects + */ private function securityCheck($method, $expects, $shouldFail=false){ $api = $this->getAPI(); $api->expects($this->once()) diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php index a7aa922db12..d0244cf2511 100644 --- a/tests/lib/appframework/routing/RoutingTest.php +++ b/tests/lib/appframework/routing/RoutingTest.php @@ -78,6 +78,13 @@ class RouteConfigTest extends \PHPUnit_Framework_TestCase $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'adminAccountId'); } + /** + * @param string $name + * @param string $verb + * @param string $url + * @param string $controllerName + * @param string $actionName + */ private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName) { // route mocks @@ -100,6 +107,12 @@ class RouteConfigTest extends \PHPUnit_Framework_TestCase $config->register(); } + /** + * @param string $resourceName + * @param string $url + * @param string $controllerName + * @param string $paramName + */ private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName) { // router mock diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php index e8a43538004..11e9fcdf4fa 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/dbschema.php @@ -111,10 +111,16 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase { } } + /** + * @param string $table + */ public function assertTableExist($table) { $this->assertTrue($this->tableExist($table), 'Table ' . $table . ' does not exist'); } + /** + * @param string $table + */ public function assertTableNotExist($table) { $type=OC_Config::getValue( "dbtype", "sqlite" ); if( $type == 'sqlite' || $type == 'sqlite3' ) { diff --git a/tests/lib/errorHandler.php b/tests/lib/errorHandler.php index 68b87deccb6..32396eafbea 100644 --- a/tests/lib/errorHandler.php +++ b/tests/lib/errorHandler.php @@ -56,6 +56,10 @@ class Test_ErrorHandler extends \PHPUnit_Framework_TestCase { * @brief dummy class to access protected methods of \OC\Log\ErrorHandler */ class TestableErrorHandler extends \OC\Log\ErrorHandler { + + /** + * @param string $msg + */ public static function testRemovePassword($msg) { return self::removePassword($msg); } diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php index 87fd0dba4c6..dbcf6e9caa0 100644 --- a/tests/lib/files/cache/homecache.php +++ b/tests/lib/files/cache/homecache.php @@ -19,6 +19,10 @@ class DummyUser extends \OC\User\User { */ private $uid; + /** + * @param string $uid + * @param string $home + */ public function __construct($uid, $home) { $this->home = $home; $this->uid = $uid; diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php index 6c41413c4df..ce05adb188a 100644 --- a/tests/lib/files/etagtest.php +++ b/tests/lib/files/etagtest.php @@ -68,6 +68,9 @@ class EtagTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($originalEtags, $this->getEtags($files)); } + /** + * @param string[] $files + */ private function getEtags($files) { $etags = array(); foreach ($files as $file) { diff --git a/tests/lib/files/node/integration.php b/tests/lib/files/node/integration.php index 14e1d05853d..319f2f9f5f7 100644 --- a/tests/lib/files/node/integration.php +++ b/tests/lib/files/node/integration.php @@ -9,10 +9,7 @@ namespace Test\Files\Node; use OC\Files\Cache\Cache; -use OC\Files\Mount\Manager; use OC\Files\Node\Root; -use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; use OC\Files\Storage\Temporary; use OC\Files\View; use OC\User\User; diff --git a/tests/lib/files/node/root.php b/tests/lib/files/node/root.php index 97eaf7f7162..27f1a937826 100644 --- a/tests/lib/files/node/root.php +++ b/tests/lib/files/node/root.php @@ -8,7 +8,6 @@ namespace Test\Files\Node; -use OC\Files\Cache\Cache; use OCP\Files\NotPermittedException; use OC\Files\Mount\Manager; diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php index 885291e4404..51315a2a556 100644 --- a/tests/lib/files/storage/home.php +++ b/tests/lib/files/storage/home.php @@ -29,6 +29,10 @@ class DummyUser extends User { private $uid; + /** + * @param string $uid + * @param string $home + */ public function __construct($uid, $home) { $this->uid = $uid; $this->home = $home; diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php index 87bafb64d41..e1b880255fb 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/files/storage/wrapper/quota.php @@ -27,6 +27,9 @@ class Quota extends \Test\Files\Storage\Storage { \OC_Helper::rmdirr($this->tmpDir); } + /** + * @param integer $limit + */ protected function getLimitedStorage($limit) { $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); $storage->getScanner()->scan(''); diff --git a/tests/lib/files/stream/quota.php b/tests/lib/files/stream/quota.php index b11f0ac74c0..d5edace544d 100644 --- a/tests/lib/files/stream/quota.php +++ b/tests/lib/files/stream/quota.php @@ -13,6 +13,10 @@ class Quota extends \PHPUnit_Framework_TestCase { \OC\Files\Stream\Quota::clear(); } + /** + * @param string $mode + * @param integer $limit + */ protected function getStream($mode, $limit) { $source = fopen('php://temp', $mode); return \OC\Files\Stream\Quota::wrap($source, $limit); diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php index d308232a78b..2c563ae9ac9 100644 --- a/tests/lib/group/backend.php +++ b/tests/lib/group/backend.php @@ -29,7 +29,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { /** * get a new unique group name * test cases can override this in order to clean up created groups - * @return array + * @return string */ public function getGroupName() { return uniqid('test_'); @@ -38,7 +38,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { /** * get a new unique user name * test cases can override this in order to clean up created user - * @return array + * @return string */ public function getUserName() { return uniqid('test_'); diff --git a/tests/lib/group/database.php b/tests/lib/group/database.php index 5278c26f4df..3e05c656061 100644 --- a/tests/lib/group/database.php +++ b/tests/lib/group/database.php @@ -26,7 +26,7 @@ class Test_Group_Database extends Test_Group_Backend { /** * get a new unique group name * test cases can override this in order to clean up created groups - * @return array + * @return string */ public function getGroupName() { $name=uniqid('test_'); @@ -37,7 +37,7 @@ class Test_Group_Database extends Test_Group_Backend { /** * get a new unique user name * test cases can override this in order to clean up created user - * @return array + * @return string */ public function getUserName() { return uniqid('test_'); diff --git a/tests/lib/group/group.php b/tests/lib/group/group.php index f1fda3b9288..3982c00e45f 100644 --- a/tests/lib/group/group.php +++ b/tests/lib/group/group.php @@ -13,7 +13,7 @@ use OC\User\User; class Group extends \PHPUnit_Framework_TestCase { /** - * @return \PHPUnit_Framework_MockObject_MockObject | \OC\User\Manager + * @return \OC\User\Manager | \OC\User\Manager */ protected function getUserManager() { $userManager = $this->getMock('\OC\User\Manager'); diff --git a/tests/lib/migrate.php b/tests/lib/migrate.php index 39a9bfc8d5a..d438a7a692e 100644 --- a/tests/lib/migrate.php +++ b/tests/lib/migrate.php @@ -31,6 +31,7 @@ class Test_Migrate extends PHPUnit_Framework_TestCase { * @brief checks for existence of export_info.json and file folder * @param string $exportedUser the user that was exported * @param string $path the path to the .zip export + * @param string $exportedBy */ public function validateUserExport($exportedBy, $exportedUser, $path) { $this->assertTrue(file_exists($path)); diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php index ea8413734f1..498ab718621 100644 --- a/tests/lib/ocs/privatedata.php +++ b/tests/lib/ocs/privatedata.php @@ -131,6 +131,7 @@ class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase /** * @param \OC_OCS_Result $result + * @param integer $expectedArraySize */ public function assertOcsResult($expectedArraySize, $result) { $this->assertEquals(100, $result->getStatusCode()); diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index d6acee6c924..a89f100d97a 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -151,6 +151,10 @@ class Test_Share extends PHPUnit_Framework_TestCase { ); } + /** + * @param string $sharer + * @param string $receiver + */ protected function shareUserTestFileWithUser($sharer, $receiver) { OC_User::setUserId($sharer); $this->assertTrue( @@ -558,6 +562,9 @@ class Test_Share extends PHPUnit_Framework_TestCase { ); } + /** + * @param boolean|string $token + */ protected function getShareByValidToken($token) { $row = OCP\Share::getShareByToken($token); $this->assertInternalType( diff --git a/tests/lib/template/resourcelocator.php b/tests/lib/template/resourcelocator.php index d80d222e2c9..619560643fe 100644 --- a/tests/lib/template/resourcelocator.php +++ b/tests/lib/template/resourcelocator.php @@ -7,6 +7,11 @@ */ class Test_ResourceLocator extends PHPUnit_Framework_TestCase { + + /** + * @param string $theme + * @param string $form_factor + */ public function getResourceLocator( $theme, $form_factor, $core_map, $party_map, $appsroots ) { return $this->getMockForAbstractClass('OC\Template\ResourceLocator', array( $theme, $form_factor, $core_map, $party_map, $appsroots ), diff --git a/tests/lib/user.php b/tests/lib/user.php index fdf9e7a08e0..e2c3282a19f 100644 --- a/tests/lib/user.php +++ b/tests/lib/user.php @@ -9,8 +9,6 @@ namespace Test; -use OC\Hooks\PublicEmitter; - class User extends \PHPUnit_Framework_TestCase { /** * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend diff --git a/tests/testcleanuplistener.php b/tests/testcleanuplistener.php index a969ece6dd5..299a589ef4e 100644 --- a/tests/testcleanuplistener.php +++ b/tests/testcleanuplistener.php @@ -57,6 +57,9 @@ class TestCleanupListener implements PHPUnit_Framework_TestListener { return $this->verbosity === 'detail'; } + /** + * @param string $dir + */ private function unlinkDir($dir) { if ($dh = @opendir($dir)) { while (($file = readdir($dh)) !== false) { |