diff options
166 files changed, 1065 insertions, 138 deletions
diff --git a/apps/dav/tests/unit/bootstrap.php b/apps/dav/tests/unit/bootstrap.php index 28f6b971dec..b6ea48ec903 100644 --- a/apps/dav/tests/unit/bootstrap.php +++ b/apps/dav/tests/unit/bootstrap.php @@ -1,6 +1,8 @@ <?php -define('PHPUNIT_RUN', 1); +if (!defined('PHPUNIT_RUN')) { + define('PHPUNIT_RUN', 1); +} require_once __DIR__.'/../../../../lib/base.php'; diff --git a/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php b/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php index e1bcc996908..1a973a28ed4 100644 --- a/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php +++ b/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php @@ -8,6 +8,14 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre; * later. * See the COPYING-README file. */ + +/** + * Class CustomPropertiesBackend + * + * @group DB + * + * @package Tests\Connector\Sabre + */ class CustomPropertiesBackend extends \Test\TestCase { /** diff --git a/apps/dav/tests/unit/connector/sabre/file.php b/apps/dav/tests/unit/connector/sabre/file.php index 0a52299cec7..2a6cf46ef16 100644 --- a/apps/dav/tests/unit/connector/sabre/file.php +++ b/apps/dav/tests/unit/connector/sabre/file.php @@ -14,6 +14,13 @@ use Test\HookHelper; use OC\Files\Filesystem; use OCP\Lock\ILockingProvider; +/** + * Class File + * + * @group DB + * + * @package Test\Connector\Sabre + */ class File extends \Test\TestCase { /** diff --git a/apps/dav/tests/unit/connector/sabre/objecttree.php b/apps/dav/tests/unit/connector/sabre/objecttree.php index 3a56404e552..1cea4ff0b69 100644 --- a/apps/dav/tests/unit/connector/sabre/objecttree.php +++ b/apps/dav/tests/unit/connector/sabre/objecttree.php @@ -41,6 +41,13 @@ class TestDoubleFileView extends \OC\Files\View { } } +/** + * Class ObjectTree + * + * @group DB + * + * @package OCA\DAV\Tests\Unit\Connector\Sabre + */ class ObjectTree extends \Test\TestCase { /** diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php index 245deff3b31..29454c38218 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php @@ -11,6 +11,13 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use OCP\AppFramework\Http; use OCP\Lock\ILockingProvider; +/** + * Class DownloadTest + * + * @group DB + * + * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest + */ class DownloadTest extends RequestTest { public function testDownload() { $user = $this->getUniqueID(); diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php index ed1d6046d75..b79dfa0c265 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php @@ -11,6 +11,13 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use OC\Files\View; use Test\Traits\EncryptionTrait; +/** + * Class EncryptionUploadTest + * + * @group DB + * + * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest + */ class EncryptionUploadTest extends UploadTest { use EncryptionTrait; diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php index a2a8326f4ff..c1876a7f29f 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php @@ -12,6 +12,13 @@ use OC\Connector\Sabre\Exception\FileLocked; use OCP\AppFramework\Http; use OCP\Lock\ILockingProvider; +/** + * Class UploadTest + * + * @group DB + * + * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest + */ class UploadTest extends RequestTest { public function testBasicUpload() { $user = $this->getUniqueID(); diff --git a/apps/federation/tests/backgroundjob/getsharedsecrettest.php b/apps/federation/tests/backgroundjob/getsharedsecrettest.php index 953af5ff3e1..cb3a294713a 100644 --- a/apps/federation/tests/backgroundjob/getsharedsecrettest.php +++ b/apps/federation/tests/backgroundjob/getsharedsecrettest.php @@ -34,6 +34,13 @@ use OCP\Http\Client\IResponse; use OCP\ILogger; use OCP\IURLGenerator; +/** + * Class GetSharedSecretTest + * + * @group DB + * + * @package OCA\Federation\Tests\BackgroundJob + */ class GetSharedSecretTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject | IClient */ diff --git a/apps/files/l10n/nl.js b/apps/files/l10n/nl.js index 95054067597..f99d3314230 100644 --- a/apps/files/l10n/nl.js +++ b/apps/files/l10n/nl.js @@ -40,6 +40,17 @@ OC.L10N.register( "Unable to determine date" : "Kon datum niet vaststellen", "This operation is forbidden" : "Deze taak is verboden", "This directory is unavailable, please check the logs or contact the administrator" : "Deze map is niet beschikbaar. Verifieer de logs of neem contact op met de beheerder", + "Could not move \"{file}\", target exists" : "Kon \"{file}\" niet verplaatsen, doel bestaat al", + "Could not move \"{file}\"" : "Kon \"{file}\" niet verplaatsen", + "{newName} already exists" : "{newName} bestaat al", + "Could not rename \"{fileName}\", it does not exist any more" : "Kon \"{fileName}\" niet hernoemen, het bestaat niet meer", + "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "De naam \"{targetName}\" bestaat al in map \"{dir}\". Kies een andere naam.", + "Could not rename \"{fileName}\"" : "Kon \"{fileName}\" niet hernoemen", + "Could not create file \"{file}\"" : "Kon \"{file}\" niet aanmaken", + "Could not create file \"{file}\" because it already exists" : "Kon \"{file}\" niet aanmaken omdat het al bestaat", + "Could not create folder \"{dir}\"" : "Kon map \"{dir}\" niet aanmaken", + "Could not create folder \"{dir}\" because it already exists" : "Kon map \"{dir}\" niet aanmaken omdat die al bestaat", + "Error deleting file \"{fileName}\"." : "Fout bij verwijderen bestand \"{fileName}\".", "No entries in this folder match '{filter}'" : "Niets in deze map komt overeen met '{filter}'", "Name" : "Naam", "Size" : "Grootte", diff --git a/apps/files/l10n/nl.json b/apps/files/l10n/nl.json index 81f906d40b3..aaf4edcfdd4 100644 --- a/apps/files/l10n/nl.json +++ b/apps/files/l10n/nl.json @@ -38,6 +38,17 @@ "Unable to determine date" : "Kon datum niet vaststellen", "This operation is forbidden" : "Deze taak is verboden", "This directory is unavailable, please check the logs or contact the administrator" : "Deze map is niet beschikbaar. Verifieer de logs of neem contact op met de beheerder", + "Could not move \"{file}\", target exists" : "Kon \"{file}\" niet verplaatsen, doel bestaat al", + "Could not move \"{file}\"" : "Kon \"{file}\" niet verplaatsen", + "{newName} already exists" : "{newName} bestaat al", + "Could not rename \"{fileName}\", it does not exist any more" : "Kon \"{fileName}\" niet hernoemen, het bestaat niet meer", + "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "De naam \"{targetName}\" bestaat al in map \"{dir}\". Kies een andere naam.", + "Could not rename \"{fileName}\"" : "Kon \"{fileName}\" niet hernoemen", + "Could not create file \"{file}\"" : "Kon \"{file}\" niet aanmaken", + "Could not create file \"{file}\" because it already exists" : "Kon \"{file}\" niet aanmaken omdat het al bestaat", + "Could not create folder \"{dir}\"" : "Kon map \"{dir}\" niet aanmaken", + "Could not create folder \"{dir}\" because it already exists" : "Kon map \"{dir}\" niet aanmaken omdat die al bestaat", + "Error deleting file \"{fileName}\"." : "Fout bij verwijderen bestand \"{fileName}\".", "No entries in this folder match '{filter}'" : "Niets in deze map komt overeen met '{filter}'", "Name" : "Naam", "Size" : "Grootte", diff --git a/apps/files/tests/command/deleteorphanedfilestest.php b/apps/files/tests/command/deleteorphanedfilestest.php index a667dba99fc..18f568036e4 100644 --- a/apps/files/tests/command/deleteorphanedfilestest.php +++ b/apps/files/tests/command/deleteorphanedfilestest.php @@ -25,6 +25,13 @@ namespace OCA\Files\Tests\Command; use OCA\Files\Command\DeleteOrphanedFiles; use OCP\Files\StorageNotAvailableException; +/** + * Class DeleteOrphanedFilesTest + * + * @group DB + * + * @package OCA\Files\Tests\Command + */ class DeleteOrphanedFilesTest extends \Test\TestCase { /** diff --git a/apps/files/tests/service/tagservice.php b/apps/files/tests/service/tagservice.php index 147e698aaaa..36da3edc61e 100644 --- a/apps/files/tests/service/tagservice.php +++ b/apps/files/tests/service/tagservice.php @@ -22,6 +22,13 @@ namespace OCA\Files; use \OCA\Files\Service\TagService; +/** + * Class TagServiceTest + * + * @group DB + * + * @package OCA\Files + */ class TagServiceTest extends \Test\TestCase { /** diff --git a/apps/files_external/l10n/ja.js b/apps/files_external/l10n/ja.js index 38c98caf7aa..5518f6afa78 100644 --- a/apps/files_external/l10n/ja.js +++ b/apps/files_external/l10n/ja.js @@ -33,6 +33,7 @@ OC.L10N.register( "Every time the filesystem is used" : "ファイルシステム利用時には毎回", "All users. Type to select user or group." : "すべてのユーザー。ユーザー、グループを追加", "(group)" : "(グループ)", + "Admin defined" : "管理者設定済", "Saved" : "保存されました", "Access key" : "アクセスキー", "Secret key" : "シークレットキー", diff --git a/apps/files_external/l10n/ja.json b/apps/files_external/l10n/ja.json index be6f88f3155..8134ed16cd5 100644 --- a/apps/files_external/l10n/ja.json +++ b/apps/files_external/l10n/ja.json @@ -31,6 +31,7 @@ "Every time the filesystem is used" : "ファイルシステム利用時には毎回", "All users. Type to select user or group." : "すべてのユーザー。ユーザー、グループを追加", "(group)" : "(グループ)", + "Admin defined" : "管理者設定済", "Saved" : "保存されました", "Access key" : "アクセスキー", "Secret key" : "シークレットキー", diff --git a/apps/files_external/l10n/nl.js b/apps/files_external/l10n/nl.js index cb015b104cb..05d1a3f6de5 100644 --- a/apps/files_external/l10n/nl.js +++ b/apps/files_external/l10n/nl.js @@ -33,6 +33,7 @@ OC.L10N.register( "Every time the filesystem is used" : "Elke keer bij gebruik bestandssysteem", "All users. Type to select user or group." : "Alle gebruikers. Tikken om een gebruiker of groep te selecteren.", "(group)" : "(groep)", + "Admin defined" : "Beheerder gedefinieerd", "Saved" : "Bewaard", "Access key" : "Access Key", "Secret key" : "Geheime sleutel", diff --git a/apps/files_external/l10n/nl.json b/apps/files_external/l10n/nl.json index 1a80aa31e30..e30870e4ae1 100644 --- a/apps/files_external/l10n/nl.json +++ b/apps/files_external/l10n/nl.json @@ -31,6 +31,7 @@ "Every time the filesystem is used" : "Elke keer bij gebruik bestandssysteem", "All users. Type to select user or group." : "Alle gebruikers. Tikken om een gebruiker of groep te selecteren.", "(group)" : "(groep)", + "Admin defined" : "Beheerder gedefinieerd", "Saved" : "Bewaard", "Access key" : "Access Key", "Secret key" : "Geheime sleutel", diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 6c900f0f224..fac31445532 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -33,10 +33,9 @@ use phpseclib\Crypt\AES; use \OCA\Files_External\Appinfo\Application; -use \OCA\Files_External\Lib\BackendConfig; -use \OCA\Files_External\Service\BackendService; use \OCA\Files_External\Lib\Backend\LegacyBackend; use \OCA\Files_External\Lib\StorageConfig; +use \OCA\Files_External\Lib\Backend\Backend; /** * Class to configure mount.json globally and for users @@ -75,7 +74,7 @@ class OC_Mount_Config { return true; } - /* + /** * Hook that mounts the given user's visible mount points * * @param array $data @@ -245,6 +244,7 @@ class OC_Mount_Config { * @param string $class backend class name * @param array $options backend configuration options * @return int see self::STATUS_* + * @throws Exception */ public static function getBackendStatus($class, $options, $isPersonal) { if (self::$skipTest) { @@ -255,6 +255,7 @@ class OC_Mount_Config { } if (class_exists($class)) { try { + /** @var \OC\Files\Storage\Common $storage */ $storage = new $class($options); try { @@ -322,7 +323,7 @@ class OC_Mount_Config { * Get backend dependency message * TODO: move into AppFramework along with templates * - * @param BackendConfig[] $backends + * @param Backend[] $backends * @return string */ public static function dependencyMessage($backends) { diff --git a/apps/files_external/tests/amazons3migration.php b/apps/files_external/tests/amazons3migration.php index 3eba5bca644..33fb6119a92 100644 --- a/apps/files_external/tests/amazons3migration.php +++ b/apps/files_external/tests/amazons3migration.php @@ -25,6 +25,13 @@ namespace Test\Files\Storage; +/** + * Class AmazonS3Migration + * + * @group DB + * + * @package Test\Files\Storage + */ class AmazonS3Migration extends \Test\TestCase { /** diff --git a/apps/files_external/tests/backends/amazons3.php b/apps/files_external/tests/backends/amazons3.php index c16581a4495..e1465b51125 100644 --- a/apps/files_external/tests/backends/amazons3.php +++ b/apps/files_external/tests/backends/amazons3.php @@ -25,6 +25,13 @@ namespace Test\Files\Storage; +/** + * Class AmazonS3 + * + * @group DB + * + * @package Test\Files\Storage + */ class AmazonS3 extends Storage { private $config; diff --git a/apps/files_external/tests/backends/dropbox.php b/apps/files_external/tests/backends/dropbox.php index 8765011532c..8dd0e58adc1 100644 --- a/apps/files_external/tests/backends/dropbox.php +++ b/apps/files_external/tests/backends/dropbox.php @@ -25,6 +25,13 @@ namespace Test\Files\Storage; +/** + * Class Dropbox + * + * @group DB + * + * @package Test\Files\Storage + */ class Dropbox extends Storage { private $config; diff --git a/apps/files_external/tests/backends/ftp.php b/apps/files_external/tests/backends/ftp.php index 20a5c275d29..b715f0f780d 100644 --- a/apps/files_external/tests/backends/ftp.php +++ b/apps/files_external/tests/backends/ftp.php @@ -26,6 +26,13 @@ namespace Test\Files\Storage; +/** + * Class FTP + * + * @group DB + * + * @package Test\Files\Storage + */ class FTP extends Storage { private $config; diff --git a/apps/files_external/tests/backends/google.php b/apps/files_external/tests/backends/google.php index 6ff235ac6af..c9a5d48382c 100644 --- a/apps/files_external/tests/backends/google.php +++ b/apps/files_external/tests/backends/google.php @@ -28,6 +28,13 @@ namespace Test\Files\Storage; require_once 'files_external/lib/google.php'; +/** + * Class Google + * + * @group DB + * + * @package Test\Files\Storage + */ class Google extends Storage { private $config; diff --git a/apps/files_external/tests/backends/owncloud.php b/apps/files_external/tests/backends/owncloud.php index 47e27870be2..d51fa638c50 100644 --- a/apps/files_external/tests/backends/owncloud.php +++ b/apps/files_external/tests/backends/owncloud.php @@ -23,6 +23,13 @@ namespace Test\Files\Storage; +/** + * Class OwnCloud + * + * @group DB + * + * @package Test\Files\Storage + */ class OwnCloud extends Storage { private $config; diff --git a/apps/files_external/tests/backends/sftp.php b/apps/files_external/tests/backends/sftp.php index aaed2b3460a..03f2dcc0d77 100644 --- a/apps/files_external/tests/backends/sftp.php +++ b/apps/files_external/tests/backends/sftp.php @@ -25,6 +25,13 @@ namespace Test\Files\Storage; +/** + * Class SFTP + * + * @group DB + * + * @package Test\Files\Storage + */ class SFTP extends Storage { /** * @var \OC\Files\Storage\SFTP instance diff --git a/apps/files_external/tests/backends/sftp_key.php b/apps/files_external/tests/backends/sftp_key.php index 6e8ac9f7239..762cb0887c1 100644 --- a/apps/files_external/tests/backends/sftp_key.php +++ b/apps/files_external/tests/backends/sftp_key.php @@ -23,6 +23,13 @@ namespace Test\Files\Storage; +/** + * Class SFTP_Key + * + * @group DB + * + * @package Test\Files\Storage + */ class SFTP_Key extends Storage { private $config; diff --git a/apps/files_external/tests/backends/smb.php b/apps/files_external/tests/backends/smb.php index 0da86cb824f..0c43aba24dd 100644 --- a/apps/files_external/tests/backends/smb.php +++ b/apps/files_external/tests/backends/smb.php @@ -24,6 +24,13 @@ namespace Test\Files\Storage; +/** + * Class SMB + * + * @group DB + * + * @package Test\Files\Storage + */ class SMB extends Storage { protected function setUp() { diff --git a/apps/files_external/tests/backends/swift.php b/apps/files_external/tests/backends/swift.php index 07ee36043b1..b71b4f77add 100644 --- a/apps/files_external/tests/backends/swift.php +++ b/apps/files_external/tests/backends/swift.php @@ -25,6 +25,13 @@ namespace Test\Files\Storage; +/** + * Class Swift + * + * @group DB + * + * @package Test\Files\Storage + */ class Swift extends Storage { private $config; diff --git a/apps/files_external/tests/backends/webdav.php b/apps/files_external/tests/backends/webdav.php index e2020da7c72..130e0c99cb3 100644 --- a/apps/files_external/tests/backends/webdav.php +++ b/apps/files_external/tests/backends/webdav.php @@ -24,6 +24,13 @@ namespace Test\Files\Storage; +/** + * Class DAV + * + * @group DB + * + * @package Test\Files\Storage + */ class DAV extends Storage { protected function setUp() { diff --git a/apps/files_external/tests/etagpropagator.php b/apps/files_external/tests/etagpropagator.php index d45982cb40c..ff3c63add20 100644 --- a/apps/files_external/tests/etagpropagator.php +++ b/apps/files_external/tests/etagpropagator.php @@ -26,6 +26,13 @@ namespace Tests\Files_External; use OC\Files\Filesystem; use OC\User\User; +/** + * Class EtagPropagator + * + * @group DB + * + * @package Tests\Files_External + */ class EtagPropagator extends \Test\TestCase { protected function getUser() { return new User($this->getUniqueID(), null); diff --git a/apps/files_external/tests/owncloudfunctions.php b/apps/files_external/tests/owncloudfunctions.php index 4cfe83db950..887dd91539b 100644 --- a/apps/files_external/tests/owncloudfunctions.php +++ b/apps/files_external/tests/owncloudfunctions.php @@ -24,6 +24,13 @@ namespace Test\Files\Storage; +/** + * Class OwnCloudFunctions + * + * @group DB + * + * @package Test\Files\Storage + */ class OwnCloudFunctions extends \Test\TestCase { function configUrlProvider() { diff --git a/apps/files_sharing/tests/activity.php b/apps/files_sharing/tests/activity.php index f7f324cdfc3..fa626749957 100644 --- a/apps/files_sharing/tests/activity.php +++ b/apps/files_sharing/tests/activity.php @@ -22,10 +22,15 @@ */ namespace OCA\Files_sharing\Tests; -use OCA\Files_sharing\Tests\TestCase; - -class Activity extends \OCA\Files_Sharing\Tests\TestCase{ +/** + * Class Activity + * + * @group DB + * + * @package OCA\Files_sharing\Tests + */ +class Activity extends \OCA\Files_Sharing\Tests\TestCase { /** * @var \OCA\Files_Sharing\Activity diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 760bc0591e5..36ae3398393 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -31,6 +31,8 @@ use OCA\Files_sharing\Tests\TestCase; /** * Class Test_Files_Sharing_Api + * + * @group DB */ class Test_Files_Sharing_Api extends TestCase { diff --git a/apps/files_sharing/tests/api/shareestest.php b/apps/files_sharing/tests/api/shareestest.php index 8a35350aeb5..7db6580813f 100644 --- a/apps/files_sharing/tests/api/shareestest.php +++ b/apps/files_sharing/tests/api/shareestest.php @@ -27,6 +27,13 @@ use OCA\Files_sharing\Tests\TestCase; use OCP\AppFramework\Http; use OCP\Share; +/** + * Class ShareesTest + * + * @group DB + * + * @package OCA\Files_Sharing\Tests\API + */ class ShareesTest extends TestCase { /** @var Sharees */ protected $sharees; diff --git a/apps/files_sharing/tests/backend.php b/apps/files_sharing/tests/backend.php index 1332342c44b..57cdfc45115 100644 --- a/apps/files_sharing/tests/backend.php +++ b/apps/files_sharing/tests/backend.php @@ -27,6 +27,8 @@ use OCA\Files_sharing\Tests\TestCase; /** * Class Test_Files_Sharing + * + * @group DB */ class Test_Files_Sharing_Backend extends TestCase { diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php index 7e7e5ee26d5..df7f4fd19a3 100644 --- a/apps/files_sharing/tests/cache.php +++ b/apps/files_sharing/tests/cache.php @@ -47,6 +47,12 @@ use OCA\Files_sharing\Tests\TestCase; * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ + +/** + * Class Test_Files_Sharing_Cache + * + * @group DB + */ class Test_Files_Sharing_Cache extends TestCase { /** diff --git a/apps/files_sharing/tests/capabilities.php b/apps/files_sharing/tests/capabilities.php index 8bebde9f2d1..6fb76f10c24 100644 --- a/apps/files_sharing/tests/capabilities.php +++ b/apps/files_sharing/tests/capabilities.php @@ -26,6 +26,8 @@ use OCA\Files_Sharing\Tests\TestCase; /** * Class FilesSharingCapabilitiesTest + * + * @group DB */ class FilesSharingCapabilitiesTest extends \Test\TestCase { diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php index db5eb75d761..ccef4263c2b 100644 --- a/apps/files_sharing/tests/controller/sharecontroller.php +++ b/apps/files_sharing/tests/controller/sharecontroller.php @@ -38,6 +38,8 @@ use OCP\Share; use OC\URLGenerator; /** + * @group DB + * * @package OCA\Files_Sharing\Controllers */ class ShareControllerTest extends \Test\TestCase { diff --git a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php index 124cb83e6f0..a2e3f36f6ac 100644 --- a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php +++ b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php @@ -23,6 +23,13 @@ namespace Test\BackgroundJob; use OCA\Files_sharing\Lib\DeleteOrphanedSharesJob; +/** + * Class DeleteOrphanedSharesJobTest + * + * @group DB + * + * @package Test\BackgroundJob + */ class DeleteOrphanedSharesJobTest extends \Test\TestCase { /** diff --git a/apps/files_sharing/tests/etagpropagation.php b/apps/files_sharing/tests/etagpropagation.php index 2a33732d63f..de9ce565394 100644 --- a/apps/files_sharing/tests/etagpropagation.php +++ b/apps/files_sharing/tests/etagpropagation.php @@ -27,6 +27,13 @@ namespace OCA\Files_sharing\Tests; use OC\Files\Filesystem; use OC\Files\View; +/** + * Class EtagPropagation + * + * @group DB + * + * @package OCA\Files_sharing\Tests + */ class EtagPropagation extends TestCase { /** * @var \OC\Files\View diff --git a/apps/files_sharing/tests/expiresharesjobtest.php b/apps/files_sharing/tests/expiresharesjobtest.php index 63a2c46f647..b21d095e6b1 100644 --- a/apps/files_sharing/tests/expiresharesjobtest.php +++ b/apps/files_sharing/tests/expiresharesjobtest.php @@ -23,6 +23,13 @@ namespace OCA\Files_Sharing\Tests; use OCA\Files_Sharing\ExpireSharesJob; +/** + * Class ExpireSharesJobTest + * + * @group DB + * + * @package OCA\Files_Sharing\Tests + */ class ExpireSharesJobTest extends \Test\TestCase { /** diff --git a/apps/files_sharing/tests/external/cache.php b/apps/files_sharing/tests/external/cache.php index aa3839899ce..e44c935d3fd 100644 --- a/apps/files_sharing/tests/external/cache.php +++ b/apps/files_sharing/tests/external/cache.php @@ -23,24 +23,11 @@ namespace OCA\Files_sharing\Tests\External; use OCA\Files_sharing\Tests\TestCase; /** - * ownCloud + * Class Cache * - * @author Vincent Petry - * @copyright 2015 Vincent Petry <pvince81@owncloud.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * @group DB * + * @package OCA\Files_sharing\Tests\External */ class Cache extends TestCase { diff --git a/apps/files_sharing/tests/external/managertest.php b/apps/files_sharing/tests/external/managertest.php index 5b93b7494e9..015be47270e 100644 --- a/apps/files_sharing/tests/external/managertest.php +++ b/apps/files_sharing/tests/external/managertest.php @@ -28,6 +28,13 @@ use OCA\Files_Sharing\External\MountProvider; use OCA\Files_Sharing\Tests\TestCase; use Test\Traits\UserTrait; +/** + * Class ManagerTest + * + * @group DB + * + * @package OCA\Files_Sharing\Tests\External + */ class ManagerTest extends TestCase { use UserTrait; diff --git a/apps/files_sharing/tests/externalstorage.php b/apps/files_sharing/tests/externalstorage.php index a549e093dc1..109545119ba 100644 --- a/apps/files_sharing/tests/externalstorage.php +++ b/apps/files_sharing/tests/externalstorage.php @@ -24,6 +24,8 @@ /** * Tests for the external Storage class for remote shares. + * + * @group DB */ class Test_Files_Sharing_External_Storage extends \Test\TestCase { diff --git a/apps/files_sharing/tests/helper.php b/apps/files_sharing/tests/helper.php index 34a1389db77..1a4a9ee7834 100644 --- a/apps/files_sharing/tests/helper.php +++ b/apps/files_sharing/tests/helper.php @@ -24,26 +24,10 @@ use OCA\Files_sharing\Tests\TestCase; /** - * ownCloud - * - * @author Bjoern Schiessle - * @copyright 2014 Bjoern Schiessle <schiessle@owncloud.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * Class Test_Files_Sharing_Helper * + * @group DB */ - class Test_Files_Sharing_Helper extends TestCase { /** diff --git a/apps/files_sharing/tests/locking.php b/apps/files_sharing/tests/locking.php index ae1fcf30a53..3b8900f2061 100644 --- a/apps/files_sharing/tests/locking.php +++ b/apps/files_sharing/tests/locking.php @@ -27,6 +27,13 @@ use OC\Files\View; use OC\Lock\MemcacheLockingProvider; use OCP\Lock\ILockingProvider; +/** + * Class Locking + * + * @group DB + * + * @package OCA\Files_sharing\Tests + */ class Locking extends TestCase { /** * @var \Test\Util\User\Dummy diff --git a/apps/files_sharing/tests/migrationtest.php b/apps/files_sharing/tests/migrationtest.php index 522181fbb23..49d76126eb2 100644 --- a/apps/files_sharing/tests/migrationtest.php +++ b/apps/files_sharing/tests/migrationtest.php @@ -24,6 +24,11 @@ use OCA\Files_Sharing\Tests\TestCase; use OCA\Files_Sharing\Migration; +/** + * Class MigrationTest + * + * @group DB + */ class MigrationTest extends TestCase { /** diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php index 80e727b7178..4261ede7a76 100644 --- a/apps/files_sharing/tests/permissions.php +++ b/apps/files_sharing/tests/permissions.php @@ -26,7 +26,11 @@ use OC\Files\Cache\Cache; use OC\Files\Storage\Storage; use OC\Files\View; - +/** + * Class Test_Files_Sharing_Permissions + * + * @group DB + */ class Test_Files_Sharing_Permissions extends OCA\Files_sharing\Tests\TestCase { /** diff --git a/apps/files_sharing/tests/server2server.php b/apps/files_sharing/tests/server2server.php index 300c637c777..a0f0e18b769 100644 --- a/apps/files_sharing/tests/server2server.php +++ b/apps/files_sharing/tests/server2server.php @@ -26,6 +26,8 @@ use OCA\Files_Sharing\Tests\TestCase; /** * Class Test_Files_Sharing_Api + * + * @group DB */ class Test_Files_Sharing_S2S_OCS_API extends TestCase { diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php index 896191dfe51..b5ba0e3ad51 100644 --- a/apps/files_sharing/tests/share.php +++ b/apps/files_sharing/tests/share.php @@ -27,6 +27,8 @@ use OCA\Files\Share; /** * Class Test_Files_Sharing + * + * @group DB */ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { diff --git a/apps/files_sharing/tests/sharedmount.php b/apps/files_sharing/tests/sharedmount.php index 94c0ad448bc..7b256588f93 100644 --- a/apps/files_sharing/tests/sharedmount.php +++ b/apps/files_sharing/tests/sharedmount.php @@ -27,6 +27,8 @@ /** * Class Test_Files_Sharing_Api + * + * @group DB */ class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase { diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php index 3361d2cbd12..0d4a6b56307 100644 --- a/apps/files_sharing/tests/sharedstorage.php +++ b/apps/files_sharing/tests/sharedstorage.php @@ -28,6 +28,8 @@ use OCA\Files\Share; /** * Class Test_Files_Sharing_Api + * + * @group DB */ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase { diff --git a/apps/files_sharing/tests/sizepropagation.php b/apps/files_sharing/tests/sizepropagation.php index 1d09f69449f..535a475276c 100644 --- a/apps/files_sharing/tests/sizepropagation.php +++ b/apps/files_sharing/tests/sizepropagation.php @@ -24,6 +24,13 @@ namespace OCA\Files_sharing\Tests; use OC\Files\View; +/** + * Class SizePropagation + * + * @group DB + * + * @package OCA\Files_sharing\Tests + */ class SizePropagation extends TestCase { public function testSizePropagationWhenOwnerChangesFile() { diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php index 6a72a34149a..dc5b8ed79d9 100644 --- a/apps/files_sharing/tests/testcase.php +++ b/apps/files_sharing/tests/testcase.php @@ -36,6 +36,8 @@ use OCA\Files_Sharing\Appinfo\Application; /** * Class Test_Files_Sharing_Base * + * @group DB + * * Base class for sharing tests. */ abstract class TestCase extends \Test\TestCase { diff --git a/apps/files_sharing/tests/unsharechildren.php b/apps/files_sharing/tests/unsharechildren.php index c57070ba641..8de735363d1 100644 --- a/apps/files_sharing/tests/unsharechildren.php +++ b/apps/files_sharing/tests/unsharechildren.php @@ -26,6 +26,13 @@ namespace OCA\Files_sharing\Tests; use OCA\Files\Share; +/** + * Class UnshareChildren + * + * @group DB + * + * @package OCA\Files_sharing\Tests + */ class UnshareChildren extends TestCase { protected $subsubfolder; diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php index 63ab452a5e1..312734523b5 100644 --- a/apps/files_sharing/tests/updater.php +++ b/apps/files_sharing/tests/updater.php @@ -25,6 +25,8 @@ /** * Class Test_Files_Sharing_Updater + * + * @group DB */ class Test_Files_Sharing_Updater extends OCA\Files_Sharing\Tests\TestCase { diff --git a/apps/files_sharing/tests/watcher.php b/apps/files_sharing/tests/watcher.php index 5e96a3fe68e..6443be664a7 100644 --- a/apps/files_sharing/tests/watcher.php +++ b/apps/files_sharing/tests/watcher.php @@ -25,6 +25,11 @@ * */ +/** + * Class Test_Files_Sharing_Watcher + * + * @group DB + */ class Test_Files_Sharing_Watcher extends OCA\Files_sharing\Tests\TestCase { /** diff --git a/apps/files_trashbin/tests/command/cleanuptest.php b/apps/files_trashbin/tests/command/cleanuptest.php index e928f55eb8b..82084a2d525 100644 --- a/apps/files_trashbin/tests/command/cleanuptest.php +++ b/apps/files_trashbin/tests/command/cleanuptest.php @@ -29,6 +29,13 @@ use Test\TestCase; use OC\User\Manager; use OCP\Files\IRootFolder; +/** + * Class CleanUpTest + * + * @group DB + * + * @package OCA\Files_Trashbin\Tests\Command + */ class CleanUpTest extends TestCase { /** @var CleanUp */ diff --git a/apps/files_trashbin/tests/command/expiretest.php b/apps/files_trashbin/tests/command/expiretest.php index 0d457db2807..463fca6080e 100644 --- a/apps/files_trashbin/tests/command/expiretest.php +++ b/apps/files_trashbin/tests/command/expiretest.php @@ -24,6 +24,13 @@ namespace OCA\Files_Trashbin\Tests\Command; use OCA\Files_Trashbin\Command\Expire; use Test\TestCase; +/** + * Class ExpireTest + * + * @group DB + * + * @package OCA\Files_Trashbin\Tests\Command + */ class ExpireTest extends TestCase { public function testExpireNonExistingUser() { $command = new Expire('test'); diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php index 44b680f265c..3ebbbc3ec9d 100644 --- a/apps/files_trashbin/tests/storage.php +++ b/apps/files_trashbin/tests/storage.php @@ -27,6 +27,13 @@ namespace OCA\Files_trashbin\Tests\Storage; use OC\Files\Storage\Temporary; use OC\Files\Filesystem; +/** + * Class Storage + * + * @group DB + * + * @package OCA\Files_trashbin\Tests\Storage + */ class Storage extends \Test\TestCase { /** * @var string diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php index 934f831ef74..1b5e955d2b2 100644 --- a/apps/files_trashbin/tests/trashbin.php +++ b/apps/files_trashbin/tests/trashbin.php @@ -29,6 +29,8 @@ use OCA\Files_Trashbin; /** * Class Test_Encryption + * + * @group DB */ class Test_Trashbin extends \Test\TestCase { diff --git a/apps/files_versions/tests/command/cleanuptest.php b/apps/files_versions/tests/command/cleanuptest.php index bfde25d75ce..141213774c0 100644 --- a/apps/files_versions/tests/command/cleanuptest.php +++ b/apps/files_versions/tests/command/cleanuptest.php @@ -28,6 +28,13 @@ use Test\TestCase; use OC\User\Manager; use OCP\Files\IRootFolder; +/** + * Class CleanupTest + * + * @group DB + * + * @package OCA\Files_Versions\Tests\Command + */ class CleanupTest extends TestCase { /** @var CleanUp */ diff --git a/apps/files_versions/tests/command/expiretest.php b/apps/files_versions/tests/command/expiretest.php index eccc1f4c2ad..5048ab1ef31 100644 --- a/apps/files_versions/tests/command/expiretest.php +++ b/apps/files_versions/tests/command/expiretest.php @@ -25,6 +25,13 @@ namespace OCA\Files_Versions\Tests\Command; use OCA\Files_Versions\Command\Expire; use Test\TestCase; +/** + * Class ExpireTest + * + * @group DB + * + * @package OCA\Files_Versions\Tests\Command + */ class ExpireTest extends TestCase { public function testExpireNonExistingUser() { $command = new Expire($this->getUniqueID('test'), ''); diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php index 6ebbf830e70..ffc98c2e98c 100644 --- a/apps/files_versions/tests/versions.php +++ b/apps/files_versions/tests/versions.php @@ -34,6 +34,8 @@ use OC\Files\Storage\Temporary; /** * Class Test_Files_versions * this class provide basic files versions test + * + * @group DB */ class Test_Files_Versioning extends \Test\TestCase { diff --git a/apps/provisioning_api/tests/appstest.php b/apps/provisioning_api/tests/appstest.php index 2e1a86025c2..4ccba704a3a 100644 --- a/apps/provisioning_api/tests/appstest.php +++ b/apps/provisioning_api/tests/appstest.php @@ -23,15 +23,35 @@ */ namespace OCA\Provisioning_API\Tests; +use OCA\Provisioning_API\Apps; +use OCP\API; +use OCP\App\IAppManager; +use OCP\IUserSession; +/** + * Class AppsTest + * + * @group DB + * + * @package OCA\Provisioning_API\Tests + */ class AppsTest extends TestCase { - + + /** @var IAppManager */ + private $appManager; + + /** @var Apps */ + private $api; + + /** @var IUserSession */ + private $userSession; + public function setup() { parent::setup(); $this->appManager = \OC::$server->getAppManager(); $this->groupManager = \OC::$server->getGroupManager(); $this->userSession = \OC::$server->getUserSession(); - $this->api = new \OCA\Provisioning_API\Apps($this->appManager); + $this->api = new Apps($this->appManager); } public function testGetAppInfo() { @@ -46,7 +66,7 @@ class AppsTest extends TestCase { $result = $this->api->getAppInfo(['appid' => 'not_provisioning_api']); $this->assertInstanceOf('OC_OCS_Result', $result); $this->assertFalse($result->succeeded()); - $this->assertEquals(\OCP\API::RESPOND_NOT_FOUND, $result->getStatusCode()); + $this->assertEquals(API::RESPOND_NOT_FOUND, $result->getStatusCode()); } diff --git a/apps/provisioning_api/tests/testcase.php b/apps/provisioning_api/tests/testcase.php index 113bc512243..0cbe0d89f86 100644 --- a/apps/provisioning_api/tests/testcase.php +++ b/apps/provisioning_api/tests/testcase.php @@ -23,10 +23,13 @@ namespace OCA\Provisioning_API\Tests; +use OCP\IUser; use OCP\IUserManager; use OCP\IGroupManager; abstract class TestCase extends \Test\TestCase { + + /** @var IUser[] */ protected $users = array(); /** @var IUserManager */ @@ -46,7 +49,7 @@ abstract class TestCase extends \Test\TestCase { /** * Generates a temp user * @param int $num number of users to generate - * @return IUser[]|Iuser + * @return IUser[]|IUser */ protected function generateUsers($num = 1) { $users = array(); diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php index 25e871d9b3d..ef31a1037dd 100644 --- a/apps/user_ldap/tests/access.php +++ b/apps/user_ldap/tests/access.php @@ -28,6 +28,13 @@ use \OCA\user_ldap\lib\Access; use \OCA\user_ldap\lib\Connection; use \OCA\user_ldap\lib\ILDAPWrapper; +/** + * Class Test_Access + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_Access extends \Test\TestCase { private function getConnectorAndLdapMock() { static $conMethods; diff --git a/apps/user_ldap/tests/connection.php b/apps/user_ldap/tests/connection.php index b0b4b78ce4d..10a299a61b1 100644 --- a/apps/user_ldap/tests/connection.php +++ b/apps/user_ldap/tests/connection.php @@ -23,6 +23,13 @@ namespace OCA\user_ldap\tests; +/** + * Class Test_Connection + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_Connection extends \Test\TestCase { public function testOriginalAgentUnchangedOnClone() { @@ -52,4 +59,4 @@ class Test_Connection extends \Test\TestCase { $this->assertSame($agentPawd, $agent['ldapAgentPassword']); } -}
\ No newline at end of file +} diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php index 6a6d5bc7ca1..5362b97f216 100644 --- a/apps/user_ldap/tests/group_ldap.php +++ b/apps/user_ldap/tests/group_ldap.php @@ -30,6 +30,13 @@ use \OCA\user_ldap\lib\Access; use \OCA\user_ldap\lib\Connection; use \OCA\user_ldap\lib\ILDAPWrapper; +/** + * Class Test_Group_Ldap + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_Group_Ldap extends \Test\TestCase { private function getAccessMock() { static $conMethods; diff --git a/apps/user_ldap/tests/mapping/groupmapping.php b/apps/user_ldap/tests/mapping/groupmapping.php index e8fe655630d..f9136cf5290 100644 --- a/apps/user_ldap/tests/mapping/groupmapping.php +++ b/apps/user_ldap/tests/mapping/groupmapping.php @@ -24,6 +24,13 @@ namespace OCA\user_ldap\tests\mapping; use OCA\User_LDAP\Mapping\GroupMapping; +/** + * Class Test_GroupMapping + * + * @group DB + * + * @package OCA\user_ldap\tests\mapping + */ class Test_GroupMapping extends AbstractMappingTest { public function getMapper(\OCP\IDBConnection $dbMock) { return new GroupMapping($dbMock); diff --git a/apps/user_ldap/tests/mapping/usermapping.php b/apps/user_ldap/tests/mapping/usermapping.php index fa9311b405a..e84f5020231 100644 --- a/apps/user_ldap/tests/mapping/usermapping.php +++ b/apps/user_ldap/tests/mapping/usermapping.php @@ -24,6 +24,13 @@ namespace OCA\user_ldap\tests\mapping; use OCA\User_LDAP\Mapping\UserMapping; +/** + * Class Test_UserMapping + * + * @group DB + * + * @package OCA\user_ldap\tests\mapping + */ class Test_UserMapping extends AbstractMappingTest { public function getMapper(\OCP\IDBConnection $dbMock) { return new UserMapping($dbMock); diff --git a/apps/user_ldap/tests/user/manager.php b/apps/user_ldap/tests/user/manager.php index 98e48638d8b..d8602978a9d 100644 --- a/apps/user_ldap/tests/user/manager.php +++ b/apps/user_ldap/tests/user/manager.php @@ -26,6 +26,13 @@ namespace OCA\user_ldap\tests; use OCA\user_ldap\lib\user\Manager; +/** + * Class Test_User_Manager + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_User_Manager extends \Test\TestCase { private function getTestInstances() { diff --git a/apps/user_ldap/tests/user/user.php b/apps/user_ldap/tests/user/user.php index 19581d835d1..a5bb459d6fd 100644 --- a/apps/user_ldap/tests/user/user.php +++ b/apps/user_ldap/tests/user/user.php @@ -25,6 +25,13 @@ namespace OCA\user_ldap\tests; use OCA\user_ldap\lib\user\User; +/** + * Class Test_User_User + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_User_User extends \Test\TestCase { private function getTestInstances() { diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php index 0f70c43fc11..7593371d85d 100644 --- a/apps/user_ldap/tests/user_ldap.php +++ b/apps/user_ldap/tests/user_ldap.php @@ -31,6 +31,13 @@ use \OCA\user_ldap\lib\Access; use \OCA\user_ldap\lib\Connection; use \OCA\user_ldap\lib\ILDAPWrapper; +/** + * Class Test_User_Ldap_Direct + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_User_Ldap_Direct extends \Test\TestCase { protected $backend; protected $access; diff --git a/apps/user_ldap/tests/wizard.php b/apps/user_ldap/tests/wizard.php index 7b046187831..c29361096a1 100644 --- a/apps/user_ldap/tests/wizard.php +++ b/apps/user_ldap/tests/wizard.php @@ -31,6 +31,13 @@ use \OCA\user_ldap\lib\Wizard; // use \OCA\user_ldap\lib\Configuration; // use \OCA\user_ldap\lib\ILDAPWrapper; +/** + * Class Test_Wizard + * + * @group DB + * + * @package OCA\user_ldap\tests + */ class Test_Wizard extends \Test\TestCase { protected function setUp() { parent::setUp(); diff --git a/autotest.sh b/autotest.sh index f0efc45ccca..eb57264c953 100755 --- a/autotest.sh +++ b/autotest.sh @@ -260,14 +260,23 @@ function execute_tests { if [[ "$_XDEBUG_CONFIG" ]]; then export XDEBUG_CONFIG=$_XDEBUG_CONFIG fi + GROUP='' + if [ "$TEST_SELECTION" == "DB" ]; then + GROUP='--group DB' + fi + if [ "$TEST_SELECTION" == "NODB" ]; then + GROUP='--exclude-group DB' + fi + + COVER='' if [ -z "$NOCOVERAGE" ]; then - "${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$DB.xml" --coverage-clover "autotest-clover-$DB.xml" --coverage-html "coverage-html-$DB" "$2" "$3" - RESULT=$? + COVER='--coverage-clover "autotest-clover-$DB.xml" --coverage-html "coverage-html-$DB"' else echo "No coverage" - "${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$DB.xml" "$2" "$3" - RESULT=$? fi + echo "${PHPUNIT[@]}" --configuration phpunit-autotest.xml $GROUP $COVER --log-junit "autotest-results-$DB.xml" "$2" "$3" + "${PHPUNIT[@]}" --configuration phpunit-autotest.xml $GROUP $COVER --log-junit "autotest-results-$DB.xml" "$2" "$3" + RESULT=$? if [ "$PRIMARY_STORAGE_CONFIG" == "swift" ] ; then cd .. diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 5e13d9329f3..714525cf87e 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -4,7 +4,7 @@ <!--[if (gt IE 9)|!(IE)]><!--><html class="ng-csp" data-placeholder-focus="false" lang="<?php p($_['language']); ?>" ><!--<![endif]--> <head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>" <?php if ($_['updateAvailable']): ?> - data-update-version="<?php print($_['updateVersion']); ?>" data-update-link="<?php print_unescaped($_['updateLink']); ?>" + data-update-version="<?php p($_['updateVersion']); ?>" data-update-link="<?php p($_['updateLink']); ?>" <?php endif; ?> > <meta charset="utf-8"> diff --git a/lib/autoloader.php b/lib/autoloader.php index e41b4a08a6a..f0fbd9e9f27 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -170,11 +170,7 @@ class Autoloader { // No cache or cache miss $pathsToRequire = array(); foreach ($this->findClass($class) as $path) { - if ($path[0] === '/') { - $fullPath = file_exists($path) ? $path : false; - } else { - $fullPath = stream_resolve_include_path($path); - } + $fullPath = stream_resolve_include_path($path); if ($fullPath && $this->isValidPath($fullPath)) { $pathsToRequire[] = $fullPath; } diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php index 9147f572461..dda163e41a0 100644 --- a/lib/private/files/storage/dav.php +++ b/lib/private/files/storage/dav.php @@ -105,6 +105,7 @@ class DAV extends Common { $this->secure = false; } if ($this->secure === true) { + // inject mock for testing $certPath = \OC_User::getHome(\OC_User::getUser()) . '/files_external/rootcerts.crt'; if (file_exists($certPath)) { $this->certPath = $certPath; diff --git a/lib/private/route/cachingrouter.php b/lib/private/route/cachingrouter.php index 734aa5aea4b..2d10b8ab691 100644 --- a/lib/private/route/cachingrouter.php +++ b/lib/private/route/cachingrouter.php @@ -22,6 +22,8 @@ namespace OC\Route; +use OCP\ILogger; + class CachingRouter extends Router { /** * @var \OCP\ICache @@ -30,10 +32,11 @@ class CachingRouter extends Router { /** * @param \OCP\ICache $cache + * @param ILogger $logger */ - public function __construct($cache) { + public function __construct($cache, ILogger $logger) { $this->cache = $cache; - parent::__construct(); + parent::__construct($logger); } /** diff --git a/lib/private/route/router.php b/lib/private/route/router.php index f4abfae0f43..6d3b7c742bb 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -30,8 +30,10 @@ namespace OC\Route; +use OCP\ILogger; use OCP\Route\IRouter; use OCP\AppFramework\App; +use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\RequestContext; @@ -78,7 +80,13 @@ class Router implements IRouter { protected $loadedApps = array(); - public function __construct() { + /** + * @var ILogger + */ + protected $logger; + + public function __construct(ILogger $logger) { + $this->logger = $logger; $baseUrl = \OC_Helper::linkTo('', 'index.php'); if (!\OC::$CLI) { $method = $_SERVER['REQUEST_METHOD']; @@ -127,6 +135,7 @@ class Router implements IRouter { /** * loads the api routes + * * @return void */ public function loadRoutes($app = null) { @@ -290,6 +299,7 @@ class Router implements IRouter { /** * Get the url generator + * * @return \Symfony\Component\Routing\Generator\UrlGenerator * */ @@ -311,11 +321,17 @@ class Router implements IRouter { */ public function generate($name, $parameters = array(), $absolute = false) { $this->loadRoutes(); - return $this->getGenerator()->generate($name, $parameters, $absolute); + try { + return $this->getGenerator()->generate($name, $parameters, $absolute); + } catch (RouteNotFoundException $e) { + $this->logger->logException($e); + return ''; + } } /** * To isolate the variable scope used inside the $file it is required in it's own method + * * @param string $file the route file location to include * @param string $appName */ @@ -331,6 +347,7 @@ class Router implements IRouter { * \OCA\MyApp\AppInfo\Application. If that class does not exist, a default * App will be intialized. This makes it optional to ship an * appinfo/application.php by using the built in query resolver + * * @param array $routes the application routes * @param string $appName the name of the app. */ diff --git a/lib/private/server.php b/lib/private/server.php index ea5937dfea4..7f3e3af6994 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -297,10 +297,11 @@ class Server extends SimpleContainer implements IServerContainer { }); $this->registerService('Router', function (Server $c) { $cacheFactory = $c->getMemCacheFactory(); + $logger = $c->getLogger(); if ($cacheFactory->isAvailable()) { - $router = new \OC\Route\CachingRouter($cacheFactory->create('route')); + $router = new \OC\Route\CachingRouter($cacheFactory->create('route'), $logger); } else { - $router = new \OC\Route\Router(); + $router = new \OC\Route\Router($logger); } return $router; }); diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php index 7d16823d2a8..f5974128b73 100644 --- a/lib/private/templatelayout.php +++ b/lib/private/templatelayout.php @@ -85,7 +85,9 @@ class OC_TemplateLayout extends OC_Template { if(isset($data['version']) && $data['version'] != '' and $data['version'] !== Array()) { $this->assign('updateAvailable', true); $this->assign('updateVersion', $data['versionstring']); - $this->assign('updateLink', $data['web']); + if(substr($data['web'], 0, 8) === 'https://') { + $this->assign('updateLink', $data['web']); + } \OCP\Util::addScript('core', 'update-notification'); } else { $this->assign('updateAvailable', false); // No update available or not an admin user diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index 104cf7df596..428a222f9c7 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -62,6 +62,7 @@ class URLGenerator implements IURLGenerator { * Returns a url to the given route. */ public function linkToRoute($route, $parameters = array()) { + // TODO: mock router $urlLinkTo = \OC::$server->getRouter()->generate($route, $parameters); return $urlLinkTo; } diff --git a/settings/l10n/nl.js b/settings/l10n/nl.js index 4f8fb58f53a..f28a9f3b17e 100644 --- a/settings/l10n/nl.js +++ b/settings/l10n/nl.js @@ -12,12 +12,10 @@ OC.L10N.register( "Log" : "Log", "Tips & tricks" : "Tips & trucs", "Updates" : "Updates", - "Authentication error" : "Authenticatie fout", - "Your full name has been changed." : "Uw volledige naam is gewijzigd.", - "Unable to change full name" : "Kan de volledige naam niet wijzigen", "Couldn't remove app." : "Kon app niet verwijderen.", "Language changed" : "Taal aangepast", "Invalid request" : "Ongeldige aanvraag", + "Authentication error" : "Authenticatie fout", "Admins can't remove themself from the admin group" : "Admins kunnen zichzelf niet uit de admin groep verwijderen", "Unable to add user to group %s" : "Niet in staat om gebruiker toe te voegen aan groep %s", "Unable to remove user from group %s" : "Niet in staat om gebruiker te verwijderen uit groep %s", @@ -53,6 +51,8 @@ OC.L10N.register( "Invalid user" : "Ongeldige gebruiker", "Unable to change mail address" : "Kan e-mailadres niet wijzigen", "Email saved" : "E-mail bewaard", + "Your full name has been changed." : "Uw volledige naam is gewijzigd.", + "Unable to change full name" : "Kan de volledige naam niet wijzigen", "Are you really sure you want add \"{domain}\" as trusted domain?" : "Weet u zeker dat u \"{domain}\" als een vertrouwd domein wilt toevoegen?", "Add trusted domain" : "Vertrouwd domein toevoegen", "Migration in progress. Please wait until the migration is finished" : "Migratie bezig. Wacht tot het proces klaar is.", @@ -192,6 +192,7 @@ OC.L10N.register( "More" : "Meer", "Less" : "Minder", "The logfile is bigger than 100 MB. Downloading it may take some time!" : "Het logbestand is groter dan 100MB. Downloaden kost even tijd!", + "What to log" : "Wat loggen", "SQLite is used as database. For larger installations we recommend to switch to a different database backend." : "SQLite wordt gebruikt als database. Voor grotere installaties adviseren we om te schakelen naar een andere database engine.", "Especially when using the desktop client for file syncing the use of SQLite is discouraged." : "Vooral wanneer de desktop client wordt gebruik voor bestandssynchronisatie wordt gebruik van sqlite afgeraden.", "To migrate to another database use the command line tool: 'occ db:convert-type', or see the <a target=\"_blank\" href=\"%s\">documentation ↗</a>." : "Om te migreren naar een andere database moet u de commandoregel tool gebruiken: 'occ db:convert-type', lees de <a target=\"_blank\" href=\"%s\">documentatie ↗</a>.", diff --git a/settings/l10n/nl.json b/settings/l10n/nl.json index dc4f66e406d..b9a7baadde1 100644 --- a/settings/l10n/nl.json +++ b/settings/l10n/nl.json @@ -10,12 +10,10 @@ "Log" : "Log", "Tips & tricks" : "Tips & trucs", "Updates" : "Updates", - "Authentication error" : "Authenticatie fout", - "Your full name has been changed." : "Uw volledige naam is gewijzigd.", - "Unable to change full name" : "Kan de volledige naam niet wijzigen", "Couldn't remove app." : "Kon app niet verwijderen.", "Language changed" : "Taal aangepast", "Invalid request" : "Ongeldige aanvraag", + "Authentication error" : "Authenticatie fout", "Admins can't remove themself from the admin group" : "Admins kunnen zichzelf niet uit de admin groep verwijderen", "Unable to add user to group %s" : "Niet in staat om gebruiker toe te voegen aan groep %s", "Unable to remove user from group %s" : "Niet in staat om gebruiker te verwijderen uit groep %s", @@ -51,6 +49,8 @@ "Invalid user" : "Ongeldige gebruiker", "Unable to change mail address" : "Kan e-mailadres niet wijzigen", "Email saved" : "E-mail bewaard", + "Your full name has been changed." : "Uw volledige naam is gewijzigd.", + "Unable to change full name" : "Kan de volledige naam niet wijzigen", "Are you really sure you want add \"{domain}\" as trusted domain?" : "Weet u zeker dat u \"{domain}\" als een vertrouwd domein wilt toevoegen?", "Add trusted domain" : "Vertrouwd domein toevoegen", "Migration in progress. Please wait until the migration is finished" : "Migratie bezig. Wacht tot het proces klaar is.", @@ -190,6 +190,7 @@ "More" : "Meer", "Less" : "Minder", "The logfile is bigger than 100 MB. Downloading it may take some time!" : "Het logbestand is groter dan 100MB. Downloaden kost even tijd!", + "What to log" : "Wat loggen", "SQLite is used as database. For larger installations we recommend to switch to a different database backend." : "SQLite wordt gebruikt als database. Voor grotere installaties adviseren we om te schakelen naar een andere database engine.", "Especially when using the desktop client for file syncing the use of SQLite is discouraged." : "Vooral wanneer de desktop client wordt gebruik voor bestandssynchronisatie wordt gebruik van sqlite afgeraden.", "To migrate to another database use the command line tool: 'occ db:convert-type', or see the <a target=\"_blank\" href=\"%s\">documentation ↗</a>." : "Om te migreren naar een andere database moet u de commandoregel tool gebruiken: 'occ db:convert-type', lees de <a target=\"_blank\" href=\"%s\">documentatie ↗</a>.", diff --git a/tests/core/avatar/avatarcontrollertest.php b/tests/core/avatar/avatarcontrollertest.php index 948a432d2ed..efe41763ff7 100644 --- a/tests/core/avatar/avatarcontrollertest.php +++ b/tests/core/avatar/avatarcontrollertest.php @@ -44,6 +44,8 @@ function is_uploaded_file($filename) { /** * Class AvatarControllerTest * + * @group DB + * * @package OC\Core\Avatar */ class AvatarControllerTest extends \Test\TestCase { diff --git a/tests/lib/allconfig.php b/tests/lib/allconfig.php index 7f8ad5ec221..ca3dce12eaf 100644 --- a/tests/lib/allconfig.php +++ b/tests/lib/allconfig.php @@ -8,6 +8,13 @@ namespace Test; +/** + * Class TestAllConfig + * + * @group DB + * + * @package Test + */ class TestAllConfig extends \Test\TestCase { /** @var \OCP\IDBConnection */ diff --git a/tests/lib/app.php b/tests/lib/app.php index bb972e7cf9a..1c38a1c161f 100644 --- a/tests/lib/app.php +++ b/tests/lib/app.php @@ -1,5 +1,4 @@ <?php - /** * Copyright (c) 2012 Bernhard Posselt <dev@bernhard-posselt.com> * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com> @@ -7,6 +6,12 @@ * later. * See the COPYING-README file. */ + +/** + * Class Test_App + * + * @group DB + */ class Test_App extends \Test\TestCase { const TEST_USER1 = 'user1'; diff --git a/tests/lib/appconfig.php b/tests/lib/appconfig.php index 98420abe7bc..64f0f80e045 100644 --- a/tests/lib/appconfig.php +++ b/tests/lib/appconfig.php @@ -11,6 +11,13 @@ namespace Test\Lib; use Test\TestCase; +/** + * Class AppConfig + * + * @group DB + * + * @package Test\Lib + */ class AppConfig extends TestCase { /** @var \OCP\IAppConfig */ protected $appConfig; diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/appframework/AppTest.php index 05190ca09b5..7cba0e6db6b 100644 --- a/tests/lib/appframework/AppTest.php +++ b/tests/lib/appframework/AppTest.php @@ -128,6 +128,7 @@ class AppTest extends \Test\TestCase { protected function tearDown() { rrmdir($this->appPath); + parent::tearDown(); } diff --git a/tests/lib/appframework/dependencyinjection/DIContainerTest.php b/tests/lib/appframework/dependencyinjection/DIContainerTest.php index 0cbdddbb205..fc15b5a44ee 100644 --- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php +++ b/tests/lib/appframework/dependencyinjection/DIContainerTest.php @@ -36,7 +36,9 @@ class DIContainerTest extends \Test\TestCase { protected function setUp(){ parent::setUp(); - $this->container = new DIContainer('name'); + $this->container = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer', + ['isAdminUser'], ['name'] + ); $this->api = $this->getMock('OC\AppFramework\Core\API', array(), array('hi')); } diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php index 51c191fdfb7..b063ef32835 100644 --- a/tests/lib/appframework/routing/RoutingTest.php +++ b/tests/lib/appframework/routing/RoutingTest.php @@ -74,7 +74,7 @@ class RoutingTest extends \Test\TestCase )); // router mock - $router = $this->getMock("\OC\Route\Router", array('create')); + $router = $this->getMock("\OC\Route\Router", array('create'), [\OC::$server->getLogger()]); // load route configuration $container = new DIContainer('app1'); @@ -124,7 +124,7 @@ class RoutingTest extends \Test\TestCase $route = $this->mockRoute($container, $verb, $controllerName, $actionName, $requirements, $defaults); // router mock - $router = $this->getMock("\OC\Route\Router", array('create')); + $router = $this->getMock("\OC\Route\Router", array('create'), [\OC::$server->getLogger()]); // we expect create to be called once: $router @@ -148,7 +148,7 @@ class RoutingTest extends \Test\TestCase private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName) { // router mock - $router = $this->getMock("\OC\Route\Router", array('create')); + $router = $this->getMock("\OC\Route\Router", array('create'), [\OC::$server->getLogger()]); // route mocks $container = new DIContainer('app1'); diff --git a/tests/lib/avatar.php b/tests/lib/avatar.php index badee9f34d1..3fa7dc64547 100644 --- a/tests/lib/avatar.php +++ b/tests/lib/avatar.php @@ -9,6 +9,11 @@ use OC\Avatar; +/** + * Class Test_Avatar + * + * @group DB + */ class Test_Avatar extends \Test\TestCase { private static $trashBinStatus; diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/backgroundjob/joblist.php index b329c83009b..73b3255c079 100644 --- a/tests/lib/backgroundjob/joblist.php +++ b/tests/lib/backgroundjob/joblist.php @@ -9,8 +9,16 @@ namespace Test\BackgroundJob; use OCP\BackgroundJob\IJob; +use Test\TestCase; -class JobList extends \Test\TestCase { +/** + * Class JobList + * + * @group DB + * + * @package Test\BackgroundJob + */ +class JobList extends TestCase { /** * @var \OC\BackgroundJob\JobList */ diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php index b5f186c5416..6db5acdf13f 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/cache/file.php @@ -22,6 +22,13 @@ namespace Test\Cache; +/** + * Class FileCache + * + * @group DB + * + * @package Test\Cache + */ class FileCache extends \Test_Cache { /** * @var string diff --git a/tests/lib/db.php b/tests/lib/db.php index 5c25bfb9a5c..95eca4774b7 100644 --- a/tests/lib/db.php +++ b/tests/lib/db.php @@ -6,6 +6,11 @@ * See the COPYING-README file. */ +/** + * Class Test_DB + * + * @group DB + */ class Test_DB extends \Test\TestCase { protected $backupGlobals = FALSE; diff --git a/tests/lib/db/connection.php b/tests/lib/db/connection.php index 720b448d0fb..ab3b48b259f 100644 --- a/tests/lib/db/connection.php +++ b/tests/lib/db/connection.php @@ -12,6 +12,13 @@ namespace Test\DB; use Doctrine\DBAL\Platforms\SqlitePlatform; use OC\DB\MDB2SchemaManager; +/** + * Class Connection + * + * @group DB + * + * @package Test\DB + */ class Connection extends \Test\TestCase { /** * @var \OCP\IDBConnection diff --git a/tests/lib/db/mdb2schemamanager.php b/tests/lib/db/mdb2schemamanager.php index 8ce6febf3ac..e194e701d84 100644 --- a/tests/lib/db/mdb2schemamanager.php +++ b/tests/lib/db/mdb2schemamanager.php @@ -11,6 +11,13 @@ namespace Test\DB; use Doctrine\DBAL\Platforms\OraclePlatform; +/** + * Class MDB2SchemaManager + * + * @group DB + * + * @package Test\DB + */ class MDB2SchemaManager extends \Test\TestCase { protected function tearDown() { diff --git a/tests/lib/db/migrator.php b/tests/lib/db/migrator.php index 4d558909743..a50c5f1b864 100644 --- a/tests/lib/db/migrator.php +++ b/tests/lib/db/migrator.php @@ -15,6 +15,13 @@ use \Doctrine\DBAL\Schema\Schema; use \Doctrine\DBAL\Schema\SchemaConfig; use OCP\IConfig; +/** + * Class Migrator + * + * @group DB + * + * @package Test\DB + */ class Migrator extends \Test\TestCase { /** * @var \Doctrine\DBAL\Connection $connection diff --git a/tests/lib/db/mysqlmigration.php b/tests/lib/db/mysqlmigration.php index 6c283e6c59c..50b9d91d4ee 100644 --- a/tests/lib/db/mysqlmigration.php +++ b/tests/lib/db/mysqlmigration.php @@ -6,6 +6,11 @@ * See the COPYING-README file. */ +/** + * Class TestMySqlMigration + * + * @group DB + */ class TestMySqlMigration extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ diff --git a/tests/lib/db/querybuilder/expressionbuildertest.php b/tests/lib/db/querybuilder/expressionbuildertest.php index f041df01019..0563ff92334 100644 --- a/tests/lib/db/querybuilder/expressionbuildertest.php +++ b/tests/lib/db/querybuilder/expressionbuildertest.php @@ -24,6 +24,13 @@ namespace Test\DB\QueryBuilder; use Doctrine\DBAL\Query\Expression\ExpressionBuilder as DoctrineExpressionBuilder; use OC\DB\QueryBuilder\ExpressionBuilder; +/** + * Class ExpressionBuilderTest + * + * @group DB + * + * @package Test\DB\QueryBuilder + */ class ExpressionBuilderTest extends \Test\TestCase { /** @var ExpressionBuilder */ protected $expressionBuilder; diff --git a/tests/lib/db/querybuilder/querybuildertest.php b/tests/lib/db/querybuilder/querybuildertest.php index bbc45fc64f3..ca3901ad049 100644 --- a/tests/lib/db/querybuilder/querybuildertest.php +++ b/tests/lib/db/querybuilder/querybuildertest.php @@ -27,6 +27,13 @@ use OC\DB\QueryBuilder\Parameter; use OC\DB\QueryBuilder\QueryBuilder; use OCP\IDBConnection; +/** + * Class QueryBuilderTest + * + * @group DB + * + * @package Test\DB\QueryBuilder + */ class QueryBuilderTest extends \Test\TestCase { /** @var QueryBuilder */ protected $queryBuilder; diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/db/sqlitemigration.php index 9206381ff71..3674d452bae 100644 --- a/tests/lib/db/sqlitemigration.php +++ b/tests/lib/db/sqlitemigration.php @@ -6,6 +6,11 @@ * See the COPYING-README file. */ +/** + * Class TestSqliteMigration + * + * @group DB + */ class TestSqliteMigration extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php index 97307664b6a..46d7559acc2 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/dbschema.php @@ -9,6 +9,11 @@ use OCP\Security\ISecureRandom; +/** + * Class Test_DBSchema + * + * @group DB + */ class Test_DBSchema extends \Test\TestCase { protected $schema_file = 'static://test_db_scheme'; protected $schema_file2 = 'static://test_db_scheme2'; diff --git a/tests/lib/encryption/decryptalltest.php b/tests/lib/encryption/decryptalltest.php index ce5bcf1e5ae..85fbe3e0ed9 100644 --- a/tests/lib/encryption/decryptalltest.php +++ b/tests/lib/encryption/decryptalltest.php @@ -30,6 +30,13 @@ use OC\Files\View; use OCP\IUserManager; use Test\TestCase; +/** + * Class DecryptAllTest + * + * @group DB + * + * @package Test\Encryption + */ class DecryptAllTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject | IUserManager */ diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php index c5395a97fd4..503d25597cd 100644 --- a/tests/lib/files/cache/cache.php +++ b/tests/lib/files/cache/cache.php @@ -16,6 +16,13 @@ class LongId extends \OC\Files\Storage\Temporary { } } +/** + * Class Cache + * + * @group DB + * + * @package Test\Files\Cache + */ class Cache extends \Test\TestCase { /** * @var \OC\Files\Storage\Temporary $storage ; diff --git a/tests/lib/files/cache/changepropagator.php b/tests/lib/files/cache/changepropagator.php index 9108330eb9b..6e9d9bfae75 100644 --- a/tests/lib/files/cache/changepropagator.php +++ b/tests/lib/files/cache/changepropagator.php @@ -12,6 +12,13 @@ use OC\Files\Filesystem; use OC\Files\Storage\Temporary; use OC\Files\View; +/** + * Class ChangePropagator + * + * @group DB + * + * @package Test\Files\Cache + */ class ChangePropagator extends \Test\TestCase { /** * @var \OC\Files\Cache\ChangePropagator diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php index 7ebb053bcfa..3adb25fa9d4 100644 --- a/tests/lib/files/cache/homecache.php +++ b/tests/lib/files/cache/homecache.php @@ -43,6 +43,13 @@ class DummyUser extends \OC\User\User { } } +/** + * Class HomeCache + * + * @group DB + * + * @package Test\Files\Cache + */ class HomeCache extends \Test\TestCase { /** * @var \OC\Files\Storage\Home $storage diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php index 871b12bac3a..8186fe29493 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/files/cache/scanner.php @@ -8,6 +8,13 @@ namespace Test\Files\Cache; +/** + * Class Scanner + * + * @group DB + * + * @package Test\Files\Cache + */ class Scanner extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage $storage diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php index 807dcd596fb..cdffac464dc 100644 --- a/tests/lib/files/cache/updater.php +++ b/tests/lib/files/cache/updater.php @@ -12,6 +12,13 @@ use OC\Files\Filesystem; use OC\Files\Storage\Temporary; use OC\Files\View; +/** + * Class Updater + * + * @group DB + * + * @package Test\Files\Cache + */ class Updater extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage diff --git a/tests/lib/files/cache/updaterlegacy.php b/tests/lib/files/cache/updaterlegacy.php index c1a0d3d8230..1946913bba4 100644 --- a/tests/lib/files/cache/updaterlegacy.php +++ b/tests/lib/files/cache/updaterlegacy.php @@ -12,6 +12,13 @@ use \OC\Files\Filesystem as Filesystem; use OC\Files\Storage\Temporary; use OC\Files\View; +/** + * Class UpdaterLegacy + * + * @group DB + * + * @package Test\Files\Cache + */ class UpdaterLegacy extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage $storage diff --git a/tests/lib/files/cache/watcher.php b/tests/lib/files/cache/watcher.php index acc03cc4c77..cb90e92b477 100644 --- a/tests/lib/files/cache/watcher.php +++ b/tests/lib/files/cache/watcher.php @@ -8,6 +8,13 @@ namespace Test\Files\Cache; +/** + * Class Watcher + * + * @group DB + * + * @package Test\Files\Cache + */ class Watcher extends \Test\TestCase { /** diff --git a/tests/lib/files/cache/wrapper/cachejail.php b/tests/lib/files/cache/wrapper/cachejail.php index 13f3dc8858e..9ddf3e9c61c 100644 --- a/tests/lib/files/cache/wrapper/cachejail.php +++ b/tests/lib/files/cache/wrapper/cachejail.php @@ -10,6 +10,13 @@ namespace Test\Files\Cache\Wrapper; use Test\Files\Cache\Cache; +/** + * Class CacheJail + * + * @group DB + * + * @package Test\Files\Cache\Wrapper + */ class CacheJail extends Cache { /** * @var \OC\Files\Cache\Cache $sourceCache diff --git a/tests/lib/files/cache/wrapper/cachepermissionsmask.php b/tests/lib/files/cache/wrapper/cachepermissionsmask.php index 72fd22741d3..a4cc7edba37 100644 --- a/tests/lib/files/cache/wrapper/cachepermissionsmask.php +++ b/tests/lib/files/cache/wrapper/cachepermissionsmask.php @@ -11,6 +11,13 @@ namespace Test\Files\Cache\Wrapper; use OCP\Constants; use Test\Files\Cache\Cache; +/** + * Class CachePermissionsMask + * + * @group DB + * + * @package Test\Files\Cache\Wrapper + */ class CachePermissionsMask extends Cache { /** * @var \OC\Files\Cache\Cache $sourceCache diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php index 1b51030d4a3..7fbeae88820 100644 --- a/tests/lib/files/etagtest.php +++ b/tests/lib/files/etagtest.php @@ -11,6 +11,13 @@ namespace Test\Files; use OC\Files\Filesystem; use OCP\Share; +/** + * Class EtagTest + * + * @group DB + * + * @package Test\Files + */ class EtagTest extends \Test\TestCase { private $datadir; diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php index 15a7c235405..7829eb9d706 100644 --- a/tests/lib/files/filesystem.php +++ b/tests/lib/files/filesystem.php @@ -51,6 +51,13 @@ class DummyMountProvider implements IMountProvider { } } +/** + * Class Filesystem + * + * @group DB + * + * @package Test\Files + */ class Filesystem extends \Test\TestCase { const TEST_FILESYSTEM_USER1 = "test-filesystem-user1"; diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php index 8c98256575e..2c9339bb6dc 100644 --- a/tests/lib/files/node/folder.php +++ b/tests/lib/files/node/folder.php @@ -16,6 +16,13 @@ use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OC\Files\View; +/** + * Class Folder + * + * @group DB + * + * @package Test\Files\Node + */ class Folder extends \Test\TestCase { private $user; diff --git a/tests/lib/files/node/hookconnector.php b/tests/lib/files/node/hookconnector.php index 10566cf5fb1..646e3952a38 100644 --- a/tests/lib/files/node/hookconnector.php +++ b/tests/lib/files/node/hookconnector.php @@ -17,6 +17,13 @@ use Test\TestCase; use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; +/** + * Class HookConnector + * + * @group DB + * + * @package Test\Files\Node + */ class HookConnector extends TestCase { use UserTrait; use MountProviderTrait; diff --git a/tests/lib/files/node/integration.php b/tests/lib/files/node/integration.php index 5580b40a126..addc7e98f48 100644 --- a/tests/lib/files/node/integration.php +++ b/tests/lib/files/node/integration.php @@ -13,6 +13,13 @@ use OC\Files\Storage\Temporary; use OC\Files\View; use OC\User\User; +/** + * Class IntegrationTests + * + * @group DB + * + * @package Test\Files\Node + */ class IntegrationTests extends \Test\TestCase { /** * @var \OC\Files\Node\Root $root diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php index 6d59078aa7c..63332af68da 100644 --- a/tests/lib/files/objectstore/swift.php +++ b/tests/lib/files/objectstore/swift.php @@ -23,6 +23,13 @@ namespace OCA\ObjectStore\Tests\Unit; use OC\Files\ObjectStore\ObjectStoreStorage; use OC\Files\ObjectStore\Swift as ObjectStoreToTest; +/** + * Class Swift + * + * @group DB + * + * @package OCA\ObjectStore\Tests\Unit + */ class Swift extends \Test\Files\Storage\Storage { /** diff --git a/tests/lib/files/pathverificationtest.php b/tests/lib/files/pathverificationtest.php index 13fccd310f3..db393ce5e51 100644 --- a/tests/lib/files/pathverificationtest.php +++ b/tests/lib/files/pathverificationtest.php @@ -10,6 +10,13 @@ namespace Test\Files; use OC\Files\Storage\Local; use OC\Files\View; +/** + * Class PathVerification + * + * @group DB + * + * @package Test\Files + */ class PathVerification extends \Test\TestCase { /** diff --git a/tests/lib/files/storage/commontest.php b/tests/lib/files/storage/commontest.php index 2b70dc8713e..bbe6f2a73e2 100644 --- a/tests/lib/files/storage/commontest.php +++ b/tests/lib/files/storage/commontest.php @@ -22,6 +22,13 @@ namespace Test\Files\Storage; +/** + * Class CommonTest + * + * @group DB + * + * @package Test\Files\Storage + */ class CommonTest extends Storage { /** * @var string tmpDir diff --git a/tests/lib/files/storage/copydirectory.php b/tests/lib/files/storage/copydirectory.php index 3338747f49b..bc066268cda 100644 --- a/tests/lib/files/storage/copydirectory.php +++ b/tests/lib/files/storage/copydirectory.php @@ -36,6 +36,13 @@ class CopyDirectoryStorage extends StorageNoRecursiveCopy { use \OC\Files\Storage\PolyFill\CopyDirectory; } +/** + * Class CopyDirectory + * + * @group DB + * + * @package Test\Files\Storage + */ class CopyDirectory extends Storage { protected function setUp() { diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php index b0670a22892..a51912ca1b2 100644 --- a/tests/lib/files/storage/home.php +++ b/tests/lib/files/storage/home.php @@ -47,6 +47,13 @@ class DummyUser extends User { } } +/** + * Class Home + * + * @group DB + * + * @package Test\Files\Storage + */ class Home extends Storage { /** * @var string tmpDir diff --git a/tests/lib/files/storage/homestoragequota.php b/tests/lib/files/storage/homestoragequota.php new file mode 100644 index 00000000000..49e8f499efd --- /dev/null +++ b/tests/lib/files/storage/homestoragequota.php @@ -0,0 +1,79 @@ +<?php +/** + * @author Thomas Müller <thomas.mueller@tmit.eu> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace Test\Files\Storage; + +/** + * Class HomeStorageQuota + * + * @group DB + */ +class HomeStorageQuota extends \Test\TestCase { + /** + * Tests that the home storage is not wrapped when no quota exists. + */ + function testHomeStorageWrapperWithoutQuota() { + $user1 = $this->getUniqueID(); + \OC_User::createUser($user1, 'test'); + \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', 'none'); + \OC_User::setUserId($user1); + + \OC_Util::setupFS($user1); + + $userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/'); + $this->assertNotNull($userMount); + $this->assertNotInstanceOf('\OC\Files\Storage\Wrapper\Quota', $userMount->getStorage()); + + // clean up + \OC_User::setUserId(''); + \OC_User::deleteUser($user1); + \OC::$server->getConfig()->deleteAllUserValues($user1); + \OC_Util::tearDownFS(); + } + + /** + * Tests that the home storage is not wrapped when no quota exists. + */ + function testHomeStorageWrapperWithQuota() { + $user1 = $this->getUniqueID(); + \OC_User::createUser($user1, 'test'); + \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', '1024'); + \OC_User::setUserId($user1); + + \OC_Util::setupFS($user1); + + $userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/'); + $this->assertNotNull($userMount); + $this->assertTrue($userMount->getStorage()->instanceOfStorage('\OC\Files\Storage\Wrapper\Quota')); + + // ensure that root wasn't wrapped + $rootMount = \OC\Files\Filesystem::getMountManager()->find('/'); + $this->assertNotNull($rootMount); + $this->assertNotInstanceOf('\OC\Files\Storage\Wrapper\Quota', $rootMount->getStorage()); + + // clean up + \OC_User::setUserId(''); + \OC_User::deleteUser($user1); + \OC::$server->getConfig()->deleteAllUserValues($user1); + \OC_Util::tearDownFS(); + } + +} diff --git a/tests/lib/files/storage/local.php b/tests/lib/files/storage/local.php index d2b27117c3b..36267dc6605 100644 --- a/tests/lib/files/storage/local.php +++ b/tests/lib/files/storage/local.php @@ -22,6 +22,13 @@ namespace Test\Files\Storage; +/** + * Class Local + * + * @group DB + * + * @package Test\Files\Storage + */ class Local extends Storage { /** * @var string tmpDir diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php index 441f3a39d32..b0a06b0d898 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/files/storage/wrapper/quota.php @@ -11,6 +11,13 @@ namespace Test\Files\Storage\Wrapper; //ensure the constants are loaded \OC::$loader->load('\OC\Files\Filesystem'); +/** + * Class Quota + * + * @group DB + * + * @package Test\Files\Storage\Wrapper + */ class Quota extends \Test\Files\Storage\Storage { /** * @var string tmpDir diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/files/utils/scanner.php index b731c6992e8..2a50c2a6222 100644 --- a/tests/lib/files/utils/scanner.php +++ b/tests/lib/files/utils/scanner.php @@ -40,6 +40,13 @@ class TestScanner extends \OC\Files\Utils\Scanner { } } +/** + * Class Scanner + * + * @group DB + * + * @package Test\Files\Utils + */ class Scanner extends \Test\TestCase { /** * @var \Test\Util\User\Dummy diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index f0bad5abd18..186cf28d7c3 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -40,6 +40,13 @@ class TemporaryNoLocal extends \OC\Files\Storage\Temporary { } } +/** + * Class View + * + * @group DB + * + * @package Test\Files + */ class View extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage[] $storages diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php index 62c189489d7..ce41a6c6359 100644 --- a/tests/lib/group/backend.php +++ b/tests/lib/group/backend.php @@ -20,6 +20,11 @@ * */ +/** + * Class Test_Group_Backend + * + * @group DB + */ abstract class Test_Group_Backend extends \Test\TestCase { /** * @var OC_Group_Backend $backend diff --git a/tests/lib/group/database.php b/tests/lib/group/database.php index 10958a6ccdc..3997ff8bba5 100644 --- a/tests/lib/group/database.php +++ b/tests/lib/group/database.php @@ -20,6 +20,11 @@ * */ +/** + * Class Test_Group_Database + * + * @group DB + */ class Test_Group_Database extends Test_Group_Backend { private $groups=array(); diff --git a/tests/lib/group/dummy.php b/tests/lib/group/dummy.php index b4456c8f7e1..6836f89d3fe 100644 --- a/tests/lib/group/dummy.php +++ b/tests/lib/group/dummy.php @@ -20,6 +20,11 @@ * */ +/** + * Class Test_Group_Dummy + * + * @group DB + */ class Test_Group_Dummy extends Test_Group_Backend { protected function setUp() { parent::setUp(); diff --git a/tests/lib/helperstorage.php b/tests/lib/helperstorage.php index 8b5f41fc94c..d41bc68a7b1 100644 --- a/tests/lib/helperstorage.php +++ b/tests/lib/helperstorage.php @@ -8,8 +8,9 @@ /** * Test the storage functions of OC_Helper + * + * @group DB */ - class Test_Helper_Storage extends \Test\TestCase { /** @var string */ private $user; diff --git a/tests/lib/lock/dblockingprovider.php b/tests/lib/lock/dblockingprovider.php index 2360052b4a0..d679b1ea677 100644 --- a/tests/lib/lock/dblockingprovider.php +++ b/tests/lib/lock/dblockingprovider.php @@ -23,6 +23,13 @@ namespace Test\Lock; use OCP\Lock\ILockingProvider; +/** + * Class DBLockingProvider + * + * @group DB + * + * @package Test\Lock + */ class DBLockingProvider extends LockingProvider { /** * @var \OC\Lock\DBLockingProvider diff --git a/tests/lib/log/owncloud.php b/tests/lib/log/owncloud.php index d977583612b..8cc6aa9d57a 100644 --- a/tests/lib/log/owncloud.php +++ b/tests/lib/log/owncloud.php @@ -15,6 +15,11 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ +/** + * Class Test_Log_Owncloud + * + * @group DB + */ class Test_Log_Owncloud extends Test\TestCase { private $restore_logfile; @@ -22,8 +27,8 @@ class Test_Log_Owncloud extends Test\TestCase protected function setUp() { parent::setUp(); - $restore_logfile = OC_Config::getValue("logfile"); - $restore_logdateformat = OC_Config::getValue('logdateformat'); + $this->restore_logfile = OC_Config::getValue("logfile"); + $this->restore_logdateformat = OC_Config::getValue('logdateformat'); OC_Config::setValue("logfile", OC_Config::getValue('datadirectory') . "/logtest"); OC_Log_Owncloud::init(); diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php index a9300f5beac..ce153bf07d6 100644 --- a/tests/lib/ocs/privatedata.php +++ b/tests/lib/ocs/privatedata.php @@ -20,6 +20,11 @@ * */ +/** + * Class Test_OC_OCS_Privatedata + * + * @group DB + */ class Test_OC_OCS_Privatedata extends \Test\TestCase { private $appKey; diff --git a/tests/lib/preview.php b/tests/lib/preview.php index e4c599c66cf..bc6f849cbe8 100644 --- a/tests/lib/preview.php +++ b/tests/lib/preview.php @@ -28,6 +28,13 @@ use OC\Files\View; use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; +/** + * Class Preview + * + * @group DB + * + * @package Test + */ class Preview extends TestCase { use UserTrait; use MountProviderTrait; diff --git a/tests/lib/preview/bitmap.php b/tests/lib/preview/bitmap.php index 49112852e29..1e135ceb083 100644 --- a/tests/lib/preview/bitmap.php +++ b/tests/lib/preview/bitmap.php @@ -21,6 +21,13 @@ namespace Test\Preview; +/** + * Class Bitmap + * + * @group DB + * + * @package Test\Preview + */ class Bitmap extends Provider { public function setUp() { diff --git a/tests/lib/preview/image.php b/tests/lib/preview/image.php index af46f4e4a66..6c82ff85723 100644 --- a/tests/lib/preview/image.php +++ b/tests/lib/preview/image.php @@ -21,6 +21,13 @@ namespace Test\Preview; +/** + * Class Image + * + * @group DB + * + * @package Test\Preview + */ class Image extends Provider { public function setUp() { diff --git a/tests/lib/preview/mp3.php b/tests/lib/preview/mp3.php index ac3ab07a2bd..f6875a88ebd 100644 --- a/tests/lib/preview/mp3.php +++ b/tests/lib/preview/mp3.php @@ -21,6 +21,13 @@ namespace Test\Preview; +/** + * Class MP3 + * + * @group DB + * + * @package Test\Preview + */ class MP3 extends Provider { public function setUp() { diff --git a/tests/lib/preview/svg.php b/tests/lib/preview/svg.php index 768569c72ed..ef5f4cff80f 100644 --- a/tests/lib/preview/svg.php +++ b/tests/lib/preview/svg.php @@ -21,6 +21,13 @@ namespace Test\Preview; +/** + * Class SVG + * + * @group DB + * + * @package Test\Preview + */ class SVG extends Provider { public function setUp() { diff --git a/tests/lib/preview/txt.php b/tests/lib/preview/txt.php index 8bda86f25e3..219b850be95 100644 --- a/tests/lib/preview/txt.php +++ b/tests/lib/preview/txt.php @@ -21,6 +21,13 @@ namespace Test\Preview; +/** + * Class TXT + * + * @group DB + * + * @package Test\Preview + */ class TXT extends Provider { public function setUp() { diff --git a/tests/lib/repair/cleantags.php b/tests/lib/repair/cleantags.php index 896dd333cc2..9773a591777 100644 --- a/tests/lib/repair/cleantags.php +++ b/tests/lib/repair/cleantags.php @@ -11,6 +11,8 @@ namespace Test\Repair; /** * Tests for the cleaning the tags tables * + * @group DB + * * @see \OC\Repair\CleanTags */ class CleanTags extends \Test\TestCase { diff --git a/tests/lib/repair/dropoldjobs.php b/tests/lib/repair/dropoldjobs.php index 27d7860c63d..a85c6506dbb 100644 --- a/tests/lib/repair/dropoldjobs.php +++ b/tests/lib/repair/dropoldjobs.php @@ -13,6 +13,8 @@ use OCP\BackgroundJob\IJobList; /** * Tests for the dropping old tables * + * @group DB + * * @see \OC\Repair\DropOldTables */ class DropOldJobs extends \Test\TestCase { diff --git a/tests/lib/repair/dropoldtables.php b/tests/lib/repair/dropoldtables.php index 244d8837949..6ece8cf04d5 100644 --- a/tests/lib/repair/dropoldtables.php +++ b/tests/lib/repair/dropoldtables.php @@ -11,6 +11,8 @@ namespace Test\Repair; /** * Tests for the dropping old tables * + * @group DB + * * @see \OC\Repair\DropOldTables */ class DropOldTables extends \Test\TestCase { diff --git a/tests/lib/repair/oldgroupmembershipsharestest.php b/tests/lib/repair/oldgroupmembershipsharestest.php index 272e1ef09c4..f02babab21d 100644 --- a/tests/lib/repair/oldgroupmembershipsharestest.php +++ b/tests/lib/repair/oldgroupmembershipsharestest.php @@ -11,6 +11,13 @@ namespace Test\Repair; use OC\Repair\OldGroupMembershipShares; use OC\Share\Constants; +/** + * Class OldGroupMembershipSharesTest + * + * @group DB + * + * @package Test\Repair + */ class OldGroupMembershipSharesTest extends \Test\TestCase { /** @var OldGroupMembershipShares */ diff --git a/tests/lib/repair/removegetetagentriestest.php b/tests/lib/repair/removegetetagentriestest.php index 43b7bf323c0..12f0ae8a8d6 100644 --- a/tests/lib/repair/removegetetagentriestest.php +++ b/tests/lib/repair/removegetetagentriestest.php @@ -24,6 +24,13 @@ namespace Test\Repair; use OC\Repair\RemoveGetETagEntries; use Test\TestCase; +/** + * Class RemoveGetETagEntriesTest + * + * @group DB + * + * @package Test\Repair + */ class RemoveGetETagEntriesTest extends TestCase { /** @var \OCP\IDBConnection */ protected $connection; diff --git a/tests/lib/repair/repaircollation.php b/tests/lib/repair/repaircollation.php index 29dad190008..f9d921e88a4 100644 --- a/tests/lib/repair/repaircollation.php +++ b/tests/lib/repair/repaircollation.php @@ -19,6 +19,8 @@ class TestCollationRepair extends \OC\Repair\Collation { /** * Tests for the converting of MySQL tables to InnoDB engine * + * @group DB + * * @see \OC\Repair\RepairMimeTypes */ class TestRepairCollation extends \Test\TestCase { diff --git a/tests/lib/repair/repairinnodb.php b/tests/lib/repair/repairinnodb.php index 33f7a0e2136..e7d2b83c224 100644 --- a/tests/lib/repair/repairinnodb.php +++ b/tests/lib/repair/repairinnodb.php @@ -10,6 +10,8 @@ namespace Test\Repair; /** * Tests for the converting of MySQL tables to InnoDB engine * + * @group DB + * * @see \OC\Repair\RepairMimeTypes */ class RepairInnoDB extends \Test\TestCase { diff --git a/tests/lib/repair/repairinvalidsharestest.php b/tests/lib/repair/repairinvalidsharestest.php index e8dcaa4da97..9655e0eacbc 100644 --- a/tests/lib/repair/repairinvalidsharestest.php +++ b/tests/lib/repair/repairinvalidsharestest.php @@ -16,6 +16,8 @@ use Test\TestCase; /** * Tests for repairing invalid shares * + * @group DB + * * @see \OC\Repair\RepairInvalidShares */ class RepairInvalidSharesTest extends TestCase { diff --git a/tests/lib/repair/repairlegacystorage.php b/tests/lib/repair/repairlegacystorage.php index e1edf704424..44afd6125ab 100644 --- a/tests/lib/repair/repairlegacystorage.php +++ b/tests/lib/repair/repairlegacystorage.php @@ -15,6 +15,8 @@ use Test\TestCase; /** * Tests for the converting of legacy storages to home storages. * + * @group DB + * * @see \OC\Repair\RepairLegacyStorages */ class RepairLegacyStorages extends TestCase { diff --git a/tests/lib/repair/repairmimetypes.php b/tests/lib/repair/repairmimetypes.php index a0697776e73..1bdaa9a2dbf 100644 --- a/tests/lib/repair/repairmimetypes.php +++ b/tests/lib/repair/repairmimetypes.php @@ -11,6 +11,8 @@ namespace Test\Repair; /** * Tests for the converting of legacy storages to home storages. * + * @group DB + * * @see \OC\Repair\RepairMimeTypes */ class RepairMimeTypes extends \Test\TestCase { diff --git a/tests/lib/repair/repairsqliteautoincrement.php b/tests/lib/repair/repairsqliteautoincrement.php index 375319bb64a..e3bb110191b 100644 --- a/tests/lib/repair/repairsqliteautoincrement.php +++ b/tests/lib/repair/repairsqliteautoincrement.php @@ -10,6 +10,8 @@ namespace Test\Repair; /** * Tests for fixing the SQLite id recycling + * + * @group DB */ class RepairSqliteAutoincrement extends \Test\TestCase { diff --git a/tests/lib/security/certificatemanager.php b/tests/lib/security/certificatemanager.php index 092f9efdd18..43b2f1cf980 100644 --- a/tests/lib/security/certificatemanager.php +++ b/tests/lib/security/certificatemanager.php @@ -8,6 +8,11 @@ use \OC\Security\CertificateManager; +/** + * Class CertificateManagerTest + * + * @group DB + */ class CertificateManagerTest extends \Test\TestCase { /** @var CertificateManager */ diff --git a/tests/lib/server.php b/tests/lib/server.php index 96a476bd4d1..b72bef82036 100644 --- a/tests/lib/server.php +++ b/tests/lib/server.php @@ -24,6 +24,13 @@ namespace Test; +/** + * Class Server + * + * @group DB + * + * @package Test + */ class Server extends \Test\TestCase { /** @var \OC\Server */ protected $server; diff --git a/tests/lib/share/hooktests.php b/tests/lib/share/hooktests.php index f980baf3574..7e6aaa259f2 100644 --- a/tests/lib/share/hooktests.php +++ b/tests/lib/share/hooktests.php @@ -25,6 +25,13 @@ namespace OC\Tests\Share; use Test\TestCase; +/** + * Class HookTests + * + * @group DB + * + * @package OC\Tests\Share + */ class HookTests extends TestCase { protected function setUp() { diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index e8127aefe8e..fa19577cb72 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -19,6 +19,11 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ +/** + * Class Test_Share + * + * @group DB + */ class Test_Share extends \Test\TestCase { protected $itemType; diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php index 6216c5a4be8..9b097535280 100644 --- a/tests/lib/streamwrappers.php +++ b/tests/lib/streamwrappers.php @@ -20,6 +20,11 @@ * */ +/** + * Class Test_StreamWrappers + * + * @group DB + */ class Test_StreamWrappers extends \Test\TestCase { private static $trashBinStatus; diff --git a/tests/lib/tags.php b/tests/lib/tags.php index 1a13d64679d..a8f59ff16e4 100644 --- a/tests/lib/tags.php +++ b/tests/lib/tags.php @@ -20,12 +20,17 @@ * */ +/** + * Class Test_Tags + * + * @group DB + */ class Test_Tags extends \Test\TestCase { protected $objectType; - /** @var \OC\IUser */ + /** @var \OCP\IUser */ protected $user; - /** @var \OC\IUserSession */ + /** @var \OCP\IUserSession */ protected $userSession; protected $backupGlobals = FALSE; /** @var \OC\Tagging\TagMapper */ diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php index 8cfa2a72598..5d88fa08a6d 100644 --- a/tests/lib/testcase.php +++ b/tests/lib/testcase.php @@ -25,14 +25,16 @@ namespace Test; use OC\Command\QueueBus; use OC\Files\Filesystem; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\IDBConnection; use OCP\Security\ISecureRandom; abstract class TestCase extends \PHPUnit_Framework_TestCase { - /** - * @var \OC\Command\QueueBus - */ + /** @var \OC\Command\QueueBus */ private $commandBus; + /** @var IDBConnection */ + static private $realDatabase; + protected function getTestTraits() { $traits = []; $class = $this; @@ -49,6 +51,16 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { } protected function setUp() { + // detect database access + if (!$this->IsDatabaseAccessAllowed()) { + if (is_null(self::$realDatabase)) { + self::$realDatabase = \OC::$server->getDatabaseConnection(); + } + \OC::$server->registerService('DatabaseConnection', function () { + $this->fail('Your test case is not allowed to access the database.'); + }); + } + // overwrite the command bus with one we can run ourselves $this->commandBus = new QueueBus(); \OC::$server->registerService('AsyncCommandBus', function () { @@ -65,6 +77,14 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { } protected function tearDown() { + // restore database connection + if (!$this->IsDatabaseAccessAllowed()) { + \OC::$server->registerService('DatabaseConnection', function () { + return self::$realDatabase; + }); + } + + // further cleanup $hookExceptions = \OC_Hook::$thrownExceptions; \OC_Hook::$thrownExceptions = []; \OC::$server->getLockingProvider()->releaseAll(); @@ -316,4 +336,18 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { return true; } } + + private function IsDatabaseAccessAllowed() { + // on travis-ci.org we allow database access in any case - otherwise + // this will break all apps right away + if (true == getenv('TRAVIS')) { + return true; + } + $annotations = $this->getAnnotations(); + if (isset($annotations['class']['group']) && in_array('DB', $annotations['class']['group'])) { + return true; + } + + return false; + } } diff --git a/tests/lib/urlgenerator.php b/tests/lib/urlGenerator.php index a5ab483109f..07103225baa 100644 --- a/tests/lib/urlgenerator.php +++ b/tests/lib/urlGenerator.php @@ -6,7 +6,12 @@ * See the COPYING-README file. */ -class Test_Urlgenerator extends \Test\TestCase { +/** + * Class Test_UrlGenerator + * + * @group DB + */ +class Test_UrlGenerator extends \Test\TestCase { /** * @small diff --git a/tests/lib/user.php b/tests/lib/user.php index 3c068be2826..bc1ba063c8f 100644 --- a/tests/lib/user.php +++ b/tests/lib/user.php @@ -9,6 +9,13 @@ namespace Test; +/** + * Class User + * + * @group DB + * + * @package Test + */ class User extends TestCase { /** * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend @@ -70,4 +77,4 @@ class User extends TestCase { $this->assertEquals('newuser', $user->getUid()); } -}
\ No newline at end of file +} diff --git a/tests/lib/user/database.php b/tests/lib/user/database.php index 3a6be1ceee5..ba44d333a8c 100644 --- a/tests/lib/user/database.php +++ b/tests/lib/user/database.php @@ -20,6 +20,11 @@ * */ +/** + * Class Test_User_Database + * + * @group DB + */ class Test_User_Database extends Test_User_Backend { /** @var array */ private $users; diff --git a/tests/lib/user/manager.php b/tests/lib/user/manager.php index df673f581c4..90e2f67c995 100644 --- a/tests/lib/user/manager.php +++ b/tests/lib/user/manager.php @@ -9,6 +9,13 @@ namespace Test\User; +/** + * Class Manager + * + * @group DB + * + * @package Test\User + */ class Manager extends \Test\TestCase { public function testGetBackends() { $userDummyBackend = $this->getMock('\Test\Util\User\Dummy'); @@ -441,11 +448,25 @@ class Manager extends \Test\TestCase { } public function testDeleteUser() { - $manager = new \OC\User\Manager(); + $config = $this->getMockBuilder('OCP\IConfig') + ->disableOriginalConstructor() + ->getMock(); + $config + ->expects($this->at(0)) + ->method('getUserValue') + ->with('foo', 'core', 'enabled') + ->will($this->returnValue(true)); + $config + ->expects($this->at(1)) + ->method('getUserValue') + ->with('foo', 'login', 'lastLogin') + ->will($this->returnValue(0)); + + $manager = new \OC\User\Manager($config); $backend = new \Test\Util\User\Dummy(); - $backend->createUser('foo', 'bar'); $manager->registerBackend($backend); + $backend->createUser('foo', 'bar'); $this->assertTrue($manager->userExists('foo')); $manager->get('foo')->delete(); $this->assertFalse($manager->userExists('foo')); diff --git a/tests/lib/util.php b/tests/lib/util.php index a328b1923e9..608c5f0c501 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -167,55 +167,6 @@ class Test_Util extends \Test\TestCase { } /** - * Tests that the home storage is not wrapped when no quota exists. - */ - function testHomeStorageWrapperWithoutQuota() { - $user1 = $this->getUniqueID(); - \OC_User::createUser($user1, 'test'); - \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', 'none'); - \OC_User::setUserId($user1); - - \OC_Util::setupFS($user1); - - $userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/'); - $this->assertNotNull($userMount); - $this->assertNotInstanceOf('\OC\Files\Storage\Wrapper\Quota', $userMount->getStorage()); - - // clean up - \OC_User::setUserId(''); - \OC_User::deleteUser($user1); - \OC::$server->getConfig()->deleteAllUserValues($user1); - \OC_Util::tearDownFS(); - } - - /** - * Tests that the home storage is not wrapped when no quota exists. - */ - function testHomeStorageWrapperWithQuota() { - $user1 = $this->getUniqueID(); - \OC_User::createUser($user1, 'test'); - \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', '1024'); - \OC_User::setUserId($user1); - - \OC_Util::setupFS($user1); - - $userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/'); - $this->assertNotNull($userMount); - $this->assertTrue($userMount->getStorage()->instanceOfStorage('\OC\Files\Storage\Wrapper\Quota')); - - // ensure that root wasn't wrapped - $rootMount = \OC\Files\Filesystem::getMountManager()->find('/'); - $this->assertNotNull($rootMount); - $this->assertNotInstanceOf('\OC\Files\Storage\Wrapper\Quota', $rootMount->getStorage()); - - // clean up - \OC_User::setUserId(''); - \OC_User::deleteUser($user1); - \OC::$server->getConfig()->deleteAllUserValues($user1); - \OC_Util::tearDownFS(); - } - - /** * @dataProvider baseNameProvider */ public function testBaseName($expected, $file) { diff --git a/tests/lib/utilcheckserver.php b/tests/lib/utilcheckserver.php index bb9b7a24452..a5ec529ff85 100644 --- a/tests/lib/utilcheckserver.php +++ b/tests/lib/utilcheckserver.php @@ -8,6 +8,8 @@ /** * Tests for server check functions + * + * @group DB */ class Test_Util_CheckServer extends \Test\TestCase { |