diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-02-12 14:41:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-02-12 14:41:56 +0300 |
commit | 805c5f01a0465e48b6c7287cd443f86a5a1a9dbe (patch) | |
tree | df13306961b635001e6ac6e7c90877cdde2ff438 /tests | |
parent | 64fb41a6ec7869fe9a17580d3da8f8ae0572e6ef (diff) |
Extract testing framework for other apps; fix base classes
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests')
81 files changed, 149 insertions, 276 deletions
diff --git a/tests/AddressListTest.php b/tests/AddressListTest.php index d362d4ce3..80a783dd4 100644 --- a/tests/AddressListTest.php +++ b/tests/AddressListTest.php @@ -24,6 +24,7 @@ namespace OCA\Mail\Tests; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Mail_Rfc822_Address; use Horde_Mail_Rfc822_Group; use Horde_Mail_Rfc822_List; diff --git a/tests/AddressTest.php b/tests/AddressTest.php index 84038ca0a..bce2c9cd5 100644 --- a/tests/AddressTest.php +++ b/tests/AddressTest.php @@ -24,7 +24,7 @@ namespace OCA\Mail\Tests; -use Horde_Mail_Rfc822_Address; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Address; class AddressTest extends TestCase { diff --git a/tests/AppInfo/ApplicationTest.php b/tests/AppInfo/ApplicationTest.php index 36c54e674..2df213ad7 100644 --- a/tests/AppInfo/ApplicationTest.php +++ b/tests/AppInfo/ApplicationTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\AppInfo; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\AppInfo\Application; -use PHPUnit_Framework_TestCase; -class ApplicationTest extends PHPUnit_Framework_TestCase { +class ApplicationTest extends TestCase { public function testConstrucor() { // Not really a test – it's just about code coverage diff --git a/tests/Command/CreateAccountTest.php b/tests/Command/CreateAccountTest.php index b9f0ba379..b2bb24008 100644 --- a/tests/Command/CreateAccountTest.php +++ b/tests/Command/CreateAccountTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\Command; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Command\CreateAccount; -use PHPUnit_Framework_TestCase; -class CreateAccountTest extends PHPUnit_Framework_TestCase { +class CreateAccountTest extends TestCase { private $service; private $crypto; diff --git a/tests/Controller/AccountsControllerTest.php b/tests/Controller/AccountsControllerTest.php index eff3ed446..f16fb406c 100644 --- a/tests/Controller/AccountsControllerTest.php +++ b/tests/Controller/AccountsControllerTest.php @@ -22,6 +22,7 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Exception; use OCA\Mail\Account; use OCA\Mail\Contracts\IMailTransmission; @@ -40,9 +41,8 @@ use OCP\IL10N; use OCP\IRequest; use OCP\Security\ICrypto; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class AccountsControllerTest extends PHPUnit_Framework_TestCase { +class AccountsControllerTest extends TestCase { /** @var string */ private $appName; diff --git a/tests/Controller/AliasesControllerTest.php b/tests/Controller/AliasesControllerTest.php index 422af8861..c75dd91af 100644 --- a/tests/Controller/AliasesControllerTest.php +++ b/tests/Controller/AliasesControllerTest.php @@ -21,11 +21,11 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Controller\AliasesController; use OCP\AppFramework\Http\JSONResponse; -use PHPUnit_Framework_TestCase; -class AliasesControllerTest extends PHPUnit_Framework_TestCase { +class AliasesControllerTest extends TestCase { private $controller; private $appName = 'mail'; private $request; diff --git a/tests/Controller/AutoconfigControllerTest.php b/tests/Controller/AutoconfigControllerTest.php index 6743426a9..3cf1e67b1 100644 --- a/tests/Controller/AutoconfigControllerTest.php +++ b/tests/Controller/AutoconfigControllerTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Controller\AutoCompleteController; -use PHPUnit_Framework_TestCase; -class AutoConfigControllerTest extends PHPUnit_Framework_TestCase { +class AutoConfigControllerTest extends TestCase { private $request; private $service; diff --git a/tests/Controller/AvatarControllerTest.php b/tests/Controller/AvatarControllerTest.php index 0026e2c56..1577297da 100644 --- a/tests/Controller/AvatarControllerTest.php +++ b/tests/Controller/AvatarControllerTest.php @@ -29,7 +29,7 @@ use OCA\Mail\Controller\AvatarsController; use OCA\Mail\Http\AvatarDownloadResponse; use OCA\Mail\Http\JSONResponse; use OCA\Mail\Service\Avatar\Avatar; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Utility\ITimeFactory; diff --git a/tests/Controller/FoldersControllerTest.php b/tests/Controller/FoldersControllerTest.php index 9d7f7ae43..75d03762d 100644 --- a/tests/Controller/FoldersControllerTest.php +++ b/tests/Controller/FoldersControllerTest.php @@ -28,7 +28,7 @@ use OCA\Mail\Contracts\IMailManager; use OCA\Mail\Controller\FoldersController; use OCA\Mail\Folder; use OCA\Mail\Service\AccountService; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; diff --git a/tests/Controller/LocalAttachmentsControllerTest.php b/tests/Controller/LocalAttachmentsControllerTest.php index 0e8381a0a..f75d068e4 100644 --- a/tests/Controller/LocalAttachmentsControllerTest.php +++ b/tests/Controller/LocalAttachmentsControllerTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Contracts\IAttachmentService; use OCA\Mail\Controller\LocalAttachmentsController; use OCA\Mail\Db\LocalAttachment; @@ -28,9 +29,8 @@ use OCA\Mail\Service\Attachment\UploadedFile; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class LocalAttachmentsControllerTest extends PHPUnit_Framework_TestCase { +class LocalAttachmentsControllerTest extends TestCase { /** @var IRequest|PHPUnit_Framework_MockObject_MockObject */ private $request; diff --git a/tests/Controller/MessagesControllerTest.php b/tests/Controller/MessagesControllerTest.php index a33bec049..7dc787cce 100644 --- a/tests/Controller/MessagesControllerTest.php +++ b/tests/Controller/MessagesControllerTest.php @@ -22,6 +22,7 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use OC\AppFramework\Http\Request; use OCA\Mail\Account; use OCA\Mail\Attachment; @@ -43,9 +44,8 @@ use OCP\Files\IMimeTypeDetector; use OCP\IL10N; use OCP\IRequest; use OCP\IURLGenerator; -use PHPUnit_Framework_TestCase; -class MessagesControllerTest extends PHPUnit_Framework_TestCase { +class MessagesControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/Controller/PageControllerTest.php b/tests/Controller/PageControllerTest.php index 55431d7b1..d8e6326f1 100644 --- a/tests/Controller/PageControllerTest.php +++ b/tests/Controller/PageControllerTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Account; use OCA\Mail\Contracts\IUserPreferences; use OCA\Mail\Controller\PageController; @@ -35,9 +36,8 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserSession; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class PageControllerTest extends PHPUnit_Framework_TestCase { +class PageControllerTest extends TestCase { /** @var string */ private $appName; diff --git a/tests/Controller/PreferencesControllerTest.php b/tests/Controller/PreferencesControllerTest.php index a8bd9845c..17100ebd5 100644 --- a/tests/Controller/PreferencesControllerTest.php +++ b/tests/Controller/PreferencesControllerTest.php @@ -27,7 +27,7 @@ namespace OCA\Mail\Tests\Controller; use OCA\Mail\Contracts\IUserPreferences; use OCA\Mail\Controller\PreferencesController; use OCA\Mail\Http\JSONResponse; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IRequest; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/Controller/ProxyControllerTest.php b/tests/Controller/ProxyControllerTest.php index 11c32bc60..0181677d1 100644 --- a/tests/Controller/ProxyControllerTest.php +++ b/tests/Controller/ProxyControllerTest.php @@ -21,13 +21,13 @@ namespace OCA\Mail\Tests\Controller; +use ChristophWurst\Nextcloud\Testing\TestCase; use Exception; use OCA\Mail\Controller\ProxyController; use OCA\Mail\Http\ProxyDownloadResponse; use OCP\AppFramework\Http\TemplateResponse; -use PHPUnit_Framework_TestCase; -class ProxyControllerTest extends PHPUnit_Framework_TestCase { +class ProxyControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/Db/AliasMapperTest.php b/tests/Db/AliasMapperTest.php index a932e76db..e35e10980 100644 --- a/tests/Db/AliasMapperTest.php +++ b/tests/Db/AliasMapperTest.php @@ -22,7 +22,8 @@ namespace OCA\Mail\Db; use OC; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\DatabaseTransaction; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IDBConnection; /** @@ -33,6 +34,8 @@ use OCP\IDBConnection; * @package OCA\Mail\Db */ class AliasMapperTest extends TestCase { + + use DatabaseTransaction; /** @var AliasMapper */ private $mapper; @@ -93,19 +96,4 @@ class AliasMapperTest extends TestCase { ); } - protected function tearDown() { - parent::tearDown(); - - $sql = 'DELETE FROM *PREFIX*mail_aliases WHERE `id` = ?'; - $stmt = $this->db->prepare($sql); - if (!empty($this->alias)) { - $stmt->execute([$this->alias->getId()]); - } - $sql = 'DELETE FROM *PREFIX*mail_accounts WHERE `user_id` = ?'; - $stmt = $this->db->prepare($sql); - if (!empty($this->alias)) { - $stmt->execute(['user12345']); - } - } - } diff --git a/tests/Db/CollectedAddressMapperTest.php b/tests/Db/CollectedAddressMapperTest.php index 88995a157..66a06c21d 100644 --- a/tests/Db/CollectedAddressMapperTest.php +++ b/tests/Db/CollectedAddressMapperTest.php @@ -25,7 +25,8 @@ namespace OCA\Mail\Tests\Db; use OC; use OCA\Mail\Db\CollectedAddress; use OCA\Mail\Db\CollectedAddressMapper; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\DatabaseTransaction;; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IDBConnection; /** @@ -37,6 +38,8 @@ use OCP\IDBConnection; */ class CollectedAddressMapperTest extends TestCase { + use DatabaseTransaction; + /** @var IDBConnection */ private $db; @@ -105,22 +108,6 @@ class CollectedAddressMapperTest extends TestCase { $this->address3->setId($this->db->lastInsertId('PREFIX*mail_collected_addresses')); } - protected function tearDown() { - parent::tearDown(); - - $sql = 'DELETE FROM *PREFIX*mail_collected_addresses WHERE `id` = ?'; - $stmt = $this->db->prepare($sql); - if (!empty($this->address1)) { - $stmt->execute([$this->address1->getId()]); - } - if (!empty($this->address2)) { - $stmt->execute([$this->address2->getId()]); - } - if (!empty($this->address3)) { - $stmt->execute([$this->address3->getId()]); - } - } - public function matchingData() { return [ ['user1@example.com', ['user1@example.com']], diff --git a/tests/Db/MailAccountMapperTest.php b/tests/Db/MailAccountMapperTest.php index 1bfa25953..0609579ab 100644 --- a/tests/Db/MailAccountMapperTest.php +++ b/tests/Db/MailAccountMapperTest.php @@ -22,7 +22,8 @@ namespace OCA\Mail\Db; use OC; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\DatabaseTransaction; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IDBConnection; /** @@ -34,19 +35,15 @@ use OCP\IDBConnection; */ class MailAccountMapperTest extends TestCase { - /** - * @var MailAccountMapper - */ + use DatabaseTransaction; + + /** @var MailAccountMapper */ private $mapper; - /** - * @var IDBConnection - */ + /** @var IDBConnection */ private $db; - /** - * @var MailAccount - */ + /** @var MailAccount */ private $account; /** @@ -74,7 +71,6 @@ class MailAccountMapperTest extends TestCase { } public function testFind(){ - /** @var MailAccount $b */ $b = $this->mapper->insert($this->account); @@ -91,7 +87,6 @@ class MailAccountMapperTest extends TestCase { } public function testSave() { - $a = $this->account; // test insert diff --git a/tests/Db/MailAccountTest.php b/tests/Db/MailAccountTest.php index 65e7cca70..d9606dad3 100644 --- a/tests/Db/MailAccountTest.php +++ b/tests/Db/MailAccountTest.php @@ -21,9 +21,9 @@ namespace OCA\Mail\Db; -use PHPUnit_Framework_TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; -class TestMailAccount extends PHPUnit_Framework_TestCase { +class TestMailAccount extends TestCase { public function testToAPI() { $a = new MailAccount(); diff --git a/tests/FolderTest.php b/tests/FolderTest.php index 00103e772..dcc95790a 100644 --- a/tests/FolderTest.php +++ b/tests/FolderTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Mailbox; use OCA\Mail\Account; use OCA\Mail\Folder; diff --git a/tests/HordeTranslationHandlerTest.php b/tests/HordeTranslationHandlerTest.php index c0c9a246b..e87320d5a 100644 --- a/tests/HordeTranslationHandlerTest.php +++ b/tests/HordeTranslationHandlerTest.php @@ -20,10 +20,10 @@ */ namespace OCA\Mail\Tests; -use PHPUnit_Framework_TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\HordeTranslationHandler; -class HordeTranslationHandlerTest extends PHPUnit_Framework_TestCase { +class HordeTranslationHandlerTest extends TestCase { private $handler; diff --git a/tests/Http/AttachmentDownloadResponseTest.php b/tests/Http/AttachmentDownloadResponseTest.php index 4c9666a0d..f6f7d3030 100644 --- a/tests/Http/AttachmentDownloadResponseTest.php +++ b/tests/Http/AttachmentDownloadResponseTest.php @@ -22,10 +22,10 @@ namespace OCA\Mail\Tests\Http; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Http\AttachmentDownloadResponse; -use PHPUnit_Framework_TestCase; -class AttachmentDownloadResponseTest extends PHPUnit_Framework_TestCase { +class AttachmentDownloadResponseTest extends TestCase { /** * @dataProvider providesResponseData diff --git a/tests/Http/AvatarDownloadResponseTest.php b/tests/Http/AvatarDownloadResponseTest.php index 07b7a3b20..a4c6adb43 100644 --- a/tests/Http/AvatarDownloadResponseTest.php +++ b/tests/Http/AvatarDownloadResponseTest.php @@ -25,7 +25,7 @@ namespace OCA\Mail\Tests\Http; use OCA\Mail\Http\AvatarDownloadResponse; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; class AvatarDownloadResponseTest extends TestCase { diff --git a/tests/Http/HtmlResponseTest.php b/tests/Http/HtmlResponseTest.php index 0d326f3a3..b9f72ec1a 100644 --- a/tests/Http/HtmlResponseTest.php +++ b/tests/Http/HtmlResponseTest.php @@ -22,10 +22,10 @@ namespace OCA\Mail\Tests\Http; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Http\HtmlResponse; -use PHPUnit_Framework_TestCase; -class HtmlResponseTest extends PHPUnit_Framework_TestCase { +class HtmlResponseTest extends TestCase { /** * @dataProvider providesResponseData diff --git a/tests/Http/ProxyDownloadResponseTest.php b/tests/Http/ProxyDownloadResponseTest.php index 2d57ef727..0350df11e 100644 --- a/tests/Http/ProxyDownloadResponseTest.php +++ b/tests/Http/ProxyDownloadResponseTest.php @@ -22,10 +22,10 @@ namespace OCA\Mail\Tests\Http; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Http\ProxyDownloadResponse; -use PHPUnit_Framework_TestCase; -class ProxyDownloadResponseTest extends PHPUnit_Framework_TestCase { +class ProxyDownloadResponseTest extends TestCase { /** * @dataProvider providesResponseData diff --git a/tests/IMAP/AbstractTest.php b/tests/IMAP/AbstractTest.php index 127b2251b..733fde7dc 100644 --- a/tests/IMAP/AbstractTest.php +++ b/tests/IMAP/AbstractTest.php @@ -23,17 +23,17 @@ namespace OCA\Mail\Tests\IMAP; +use ChristophWurst\Nextcloud\Testing\TestCase; use Exception; use OC; use OCA\Mail\Account; use OCA\Mail\Db\MailAccount; use OCA\Mail\Mailbox; -use PHPUnit_Framework_TestCase; /** * @group IMAP */ -abstract class AbstractTest extends PHPUnit_Framework_TestCase { +abstract class AbstractTest extends TestCase { /** @var Account */ private static $account; diff --git a/tests/IMAP/IMAPClientFactoryTest.php b/tests/IMAP/IMAPClientFactoryTest.php index eb7d85b8a..a6d28118b 100644 --- a/tests/IMAP/IMAPClientFactoryTest.php +++ b/tests/IMAP/IMAPClientFactoryTest.php @@ -26,7 +26,7 @@ use OC; use OCA\Mail\Account; use OCA\Mail\Db\MailAccount; use OCA\Mail\IMAP\IMAPClientFactory; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\ICacheFactory; use OCP\IConfig; use OCP\Security\ICrypto; diff --git a/tests/IMAP/MessageMapperTest.php b/tests/IMAP/MessageMapperTest.php index b5529deed..09db9b26d 100644 --- a/tests/IMAP/MessageMapperTest.php +++ b/tests/IMAP/MessageMapperTest.php @@ -21,14 +21,14 @@ namespace OCA\Mail\Tests\IMAP; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Base; use Horde_Imap_Client_Data_Fetch; use Horde_Imap_Client_Fetch_Results; use OCA\Mail\IMAP\MessageMapper; use OCA\Mail\Model\IMAPMessage; -use PHPUnit_Framework_TestCase; -class MessageMapperTest extends PHPUnit_Framework_TestCase { +class MessageMapperTest extends TestCase { /** @var MessageMapper */ private $mapper; diff --git a/tests/IMAP/Sync/FavouritesMailboxSyncTest.php b/tests/IMAP/Sync/FavouritesMailboxSyncTest.php index a87d38b50..f1e608d64 100644 --- a/tests/IMAP/Sync/FavouritesMailboxSyncTest.php +++ b/tests/IMAP/Sync/FavouritesMailboxSyncTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\IMAP\Sync; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Base; use Horde_Imap_Client_Data_Sync; use Horde_Imap_Client_Ids; @@ -29,9 +30,8 @@ use OCA\Mail\IMAP\Sync\FavouritesMailboxSync; use OCA\Mail\IMAP\Sync\Request; use OCA\Mail\Model\IMAPMessage; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class FavouritesMailboxSyncTest extends PHPUnit_Framework_TestCase { +class FavouritesMailboxSyncTest extends TestCase { /** @var MessageMapper|PHPUnit_Framework_MockObject_MockObject */ private $mapper; diff --git a/tests/IMAP/Sync/RequestTest.php b/tests/IMAP/Sync/RequestTest.php index 45bcf4bde..312ee7711 100644 --- a/tests/IMAP/Sync/RequestTest.php +++ b/tests/IMAP/Sync/RequestTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\IMAP\Sync; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\IMAP\Sync\Request; -use PHPUnit_Framework_TestCase; -class RequestTest extends PHPUnit_Framework_TestCase { +class RequestTest extends TestCase { /** @var string */ private $mailbox; diff --git a/tests/IMAP/Sync/ResponseTest.php b/tests/IMAP/Sync/ResponseTest.php index d9b4741ce..6d74c75e2 100644 --- a/tests/IMAP/Sync/ResponseTest.php +++ b/tests/IMAP/Sync/ResponseTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\IMAP\Sync; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\IMAP\Sync\Response; -use PHPUnit_Framework_TestCase; -class ResponseTest extends PHPUnit_Framework_TestCase { +class ResponseTest extends TestCase { public function testJsonSerialize() { $newMessages = []; diff --git a/tests/IMAP/Sync/SimpleMailboxSyncTest.php b/tests/IMAP/Sync/SimpleMailboxSyncTest.php index 4afb9bf8e..d069d904d 100644 --- a/tests/IMAP/Sync/SimpleMailboxSyncTest.php +++ b/tests/IMAP/Sync/SimpleMailboxSyncTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\IMAP\Sync; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Base; use Horde_Imap_Client_Data_Sync; use Horde_Imap_Client_Ids; @@ -29,9 +30,8 @@ use OCA\Mail\IMAP\Sync\Request; use OCA\Mail\IMAP\Sync\SimpleMailboxSync; use OCA\Mail\Model\IMAPMessage; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class SimpleMailboxSyncTest extends PHPUnit_Framework_TestCase { +class SimpleMailboxSyncTest extends TestCase { /** @var MessageMapper|PHPUnit_Framework_MockObject_MockObject */ private $mapper; diff --git a/tests/IMAP/Sync/SynchronizerTest.php b/tests/IMAP/Sync/SynchronizerTest.php index bf597df61..4380f4153 100644 --- a/tests/IMAP/Sync/SynchronizerTest.php +++ b/tests/IMAP/Sync/SynchronizerTest.php @@ -21,9 +21,9 @@ namespace OCA\Mail\Tests\IMAP\Sync; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Base; use Horde_Imap_Client_Data_Sync; -use Horde_Imap_Client_Ids; use Horde_Imap_Client_Mailbox; use OCA\Mail\IMAP\Sync\FavouritesMailboxSync; use OCA\Mail\IMAP\Sync\Request; @@ -31,9 +31,8 @@ use OCA\Mail\IMAP\Sync\Response; use OCA\Mail\IMAP\Sync\SimpleMailboxSync; use OCA\Mail\IMAP\Sync\Synchronizer; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class SynchronizerTest extends PHPUnit_Framework_TestCase { +class SynchronizerTest extends TestCase { /** @var SimpleMailboxSync|PHPUnit_Framework_MockObject_MockObject */ private $simpleSync; diff --git a/tests/Integration/Framework/TestUser.php b/tests/Integration/Framework/TestUser.php deleted file mode 100644 index d5ec6280e..000000000 --- a/tests/Integration/Framework/TestUser.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -/** - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * - * Mail - * - * 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 OCA\Mail\Tests\Integration\Framework; - -use OC; -use OCP\IUser; -use OCP\IUserManager; -use SebastianBergmann\RecursionContext\Exception; - -trait TestUser { - - /** \OCP\IUserManager */ - private $userManager; - - /** - * @return IUserManager - */ - private function getUserManager() { - if (is_null($this->userManager)) { - $this->userManager = OC::$server->getUserManager(); - } - return $this->userManager; - } - - private function getRandomUid() { - return 'testuser' . rand(0, PHP_INT_MAX); - } - - /** - * @return IUser - * @throws Exception - */ - protected function createTestUser() { - $userManager = $this->getUserManager(); - $uid = $this->getRandomUid(); - while ($userManager->userExists($uid)) { - $uid = $this->getRandomUid(); - } - - $user = $userManager->createUser($uid, 'password'); - if ($user === false) { - throw new Exception('could not create test user'); - } - - return $user; - } - -} diff --git a/tests/Integration/Service/AvatarServiceIntegrationTest.php b/tests/Integration/Service/AvatarServiceIntegrationTest.php index 563a35820..1630f7642 100644 --- a/tests/Integration/Service/AvatarServiceIntegrationTest.php +++ b/tests/Integration/Service/AvatarServiceIntegrationTest.php @@ -26,7 +26,7 @@ namespace OCA\Mail\Tests\Integration\Service; use OC; use OCA\Mail\Contracts\IAvatarService; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\ICache; use OCP\ICacheFactory; diff --git a/tests/Integration/Service/FolderMapperIntegrationTest.php b/tests/Integration/Service/FolderMapperIntegrationTest.php index f113246f8..cfce6cf4c 100644 --- a/tests/Integration/Service/FolderMapperIntegrationTest.php +++ b/tests/Integration/Service/FolderMapperIntegrationTest.php @@ -25,9 +25,9 @@ use Horde_Imap_Client_Socket; use OCA\Mail\Account; use OCA\Mail\Folder; use OCA\Mail\IMAP\FolderMapper; -use PHPUnit_Framework_TestCase; +use OCA\Mail\Tests\Integration\TestCase; -class FolderMapperIntegrationTest extends PHPUnit_Framework_TestCase { +class FolderMapperIntegrationTest extends TestCase { /** @var FolderMapper */ private $mapper; diff --git a/tests/Integration/Service/MailTransmissionIntegrationTest.php b/tests/Integration/Service/MailTransmissionIntegrationTest.php index 0408370d0..49ec6de86 100644 --- a/tests/Integration/Service/MailTransmissionIntegrationTest.php +++ b/tests/Integration/Service/MailTransmissionIntegrationTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Integration\Service; +use ChristophWurst\Nextcloud\Testing\TestUser; use OC; use OCA\Mail\Account; use OCA\Mail\Contracts\IAttachmentService; @@ -34,7 +35,6 @@ use OCA\Mail\Service\Logger; use OCA\Mail\Service\MailTransmission; use OCA\Mail\SMTP\SmtpClientFactory; use OCA\Mail\Tests\Integration\Framework\ImapTest; -use OCA\Mail\Tests\Integration\Framework\TestUser; use OCA\Mail\Tests\Integration\TestCase; use OCP\IUser; diff --git a/tests/Integration/TestCase.php b/tests/Integration/TestCase.php index d380bf006..85b2fdbbb 100644 --- a/tests/Integration/TestCase.php +++ b/tests/Integration/TestCase.php @@ -22,7 +22,7 @@ namespace OCA\Mail\Tests\Integration; use OCA\Mail\Tests\Integration\Framework\ImapTest; -use OCA\Mail\Tests\TestCase as Base; +use ChristophWurst\Nextcloud\Testing\TestCase as Base; class TestCase extends Base { diff --git a/tests/Migration/FixCollectedAddressesTest.php b/tests/Migration/FixCollectedAddressesTest.php index 5be4e9bb0..42a616288 100644 --- a/tests/Migration/FixCollectedAddressesTest.php +++ b/tests/Migration/FixCollectedAddressesTest.php @@ -21,16 +21,16 @@ namespace OCA\Mail\Tests\Migration; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Db\CollectedAddress; use OCA\Mail\Db\CollectedAddressMapper; use OCA\Mail\Migration\FixCollectedAddresses; use OCP\Migration\IOutput; -use PHPUnit_Framework_TestCase; /** * @group DB */ -class FixCollectedAddressesTest extends PHPUnit_Framework_TestCase { +class FixCollectedAddressesTest extends TestCase { /** @var CollectedAddressMapper */ private $mapper; diff --git a/tests/Model/ImapMessageTest.php b/tests/Model/ImapMessageTest.php index b46f26ced..d7220ba01 100644 --- a/tests/Model/ImapMessageTest.php +++ b/tests/Model/ImapMessageTest.php @@ -21,15 +21,15 @@ */ namespace OCA\Mail\Tests\Model; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Data_Fetch; use Horde_Imap_Client_Fetch_Results; use Horde_Mime_Part; use OCA\Mail\AddressList; use OCA\Mail\Model\IMAPMessage; use OCA\Mail\Service\Html; -use PHPUnit_Framework_TestCase; -class ImapMessageTest extends PHPUnit_Framework_TestCase { +class ImapMessageTest extends TestCase { public function testNoFrom() { $data = new Horde_Imap_Client_Data_Fetch(); diff --git a/tests/Model/MessageTest.php b/tests/Model/MessageTest.php index bbdfb191e..f0216e00e 100644 --- a/tests/Model/MessageTest.php +++ b/tests/Model/MessageTest.php @@ -21,13 +21,13 @@ namespace OCA\Mail\Tests\Model; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Mime_Part; use OCA\Mail\Address; use OCA\Mail\AddressList; use OCA\Mail\Model\Message; -use PHPUnit_Framework_TestCase; -class MessageTest extends PHPUnit_Framework_TestCase { +class MessageTest extends TestCase { protected $message; diff --git a/tests/Model/NewMessageDataTest.php b/tests/Model/NewMessageDataTest.php index 176cfbc39..d40cab207 100644 --- a/tests/Model/NewMessageDataTest.php +++ b/tests/Model/NewMessageDataTest.php @@ -21,12 +21,12 @@ namespace OCA\Mail\Tests\Model; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Account; use OCA\Mail\AddressList; use OCA\Mail\Model\NewMessageData; -use PHPUnit_Framework_TestCase; -class NewMessageDataTest extends PHPUnit_Framework_TestCase { +class NewMessageDataTest extends TestCase { public function testConstructionFromSimpleRequestData() { $account = $this->createMock(Account::class); diff --git a/tests/Model/RepliedMessageTest.php b/tests/Model/RepliedMessageTest.php index 9f94928fe..be23ac27a 100644 --- a/tests/Model/RepliedMessageTest.php +++ b/tests/Model/RepliedMessageTest.php @@ -21,11 +21,11 @@ namespace OCA\Mail\Tests\Model; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Account; use OCA\Mail\Model\RepliedMessageData; -use PHPUnit_Framework_TestCase; -class RepliedMessageTest extends PHPUnit_Framework_TestCase { +class RepliedMessageTest extends TestCase { public function testGetAccount() { $account = $this->createMock(Account::class); diff --git a/tests/SMTP/SmtpClientFactoryTest.php b/tests/SMTP/SmtpClientFactoryTest.php index 2651d3287..01cb6d9db 100644 --- a/tests/SMTP/SmtpClientFactoryTest.php +++ b/tests/SMTP/SmtpClientFactoryTest.php @@ -29,7 +29,7 @@ use Horde_Mail_Transport_Smtphorde; use OCA\Mail\Account; use OCA\Mail\Db\MailAccount; use OCA\Mail\SMTP\SmtpClientFactory; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IConfig; use OCP\Security\ICrypto; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/SearchFolderTest.php b/tests/SearchFolderTest.php index 70eece139..2a7630a77 100644 --- a/tests/SearchFolderTest.php +++ b/tests/SearchFolderTest.php @@ -21,9 +21,11 @@ namespace OCA\Mail\Tests; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Mailbox; use OCA\Mail\Account; use OCA\Mail\SearchFolder; +use PHPUnit_Framework_MockObject_MockObject; class SearchFolderTest extends TestCase { diff --git a/tests/Service/AccoutServiceTest.php b/tests/Service/AccoutServiceTest.php index 699841f95..e784a086a 100644 --- a/tests/Service/AccoutServiceTest.php +++ b/tests/Service/AccoutServiceTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Account; use OCA\Mail\Db\MailAccount; use OCA\Mail\Db\MailAccountMapper; @@ -28,9 +29,8 @@ use OCA\Mail\Service\AccountService; use OCA\Mail\Service\DefaultAccount\Manager; use OCP\IL10N; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class AccountServiceTest extends PHPUnit_Framework_TestCase { +class AccountServiceTest extends TestCase { /** @var string */ private $user = 'herbert'; diff --git a/tests/Service/AliasesServiceTest.php b/tests/Service/AliasesServiceTest.php index 0aebacdaf..0beb2187a 100644 --- a/tests/Service/AliasesServiceTest.php +++ b/tests/Service/AliasesServiceTest.php @@ -21,14 +21,13 @@ namespace OCA\Mail\Tests\Service; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Db\Alias; use OCA\Mail\Db\AliasMapper; use OCA\Mail\Service\AliasesService; -use OCA\Mail\Service\DefaultAccount\Manager; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class AliasesServiceTest extends PHPUnit_Framework_TestCase { +class AliasesServiceTest extends TestCase { /** @var AliasesService|PHPUnit_Framework_MockObject_MockObject */ private $service; diff --git a/tests/Service/Attachment/AttachmentServiceTest.php b/tests/Service/Attachment/AttachmentServiceTest.php index 99a92b442..18a59642d 100644 --- a/tests/Service/Attachment/AttachmentServiceTest.php +++ b/tests/Service/Attachment/AttachmentServiceTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service\Attachment; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Db\LocalAttachment; use OCA\Mail\Db\LocalAttachmentMapper; use OCA\Mail\Exception\UploadException; @@ -28,9 +29,8 @@ use OCA\Mail\Service\Attachment\AttachmentService; use OCA\Mail\Service\Attachment\AttachmentStorage; use OCA\Mail\Service\Attachment\UploadedFile; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class AttachmentServiceTest extends PHPUnit_Framework_TestCase { +class AttachmentServiceTest extends TestCase { /** @var LocalAttachmentMapper|PHPUnit_Framework_MockObject_MockObject */ private $mapper; diff --git a/tests/Service/Attachment/AttachmentStorageTest.php b/tests/Service/Attachment/AttachmentStorageTest.php index 4bebeff0f..f86aef646 100644 --- a/tests/Service/Attachment/AttachmentStorageTest.php +++ b/tests/Service/Attachment/AttachmentStorageTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service\Attachment; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Exception\UploadException; use OCA\Mail\Service\Attachment\AttachmentStorage; use OCA\Mail\Service\Attachment\UploadedFile; @@ -30,9 +31,8 @@ use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class AttachmentStorageTest extends PHPUnit_Framework_TestCase { +class AttachmentStorageTest extends TestCase { private $tmpFilePath = '/tmp/nc_mail_attachment_test'; diff --git a/tests/Service/Attachment/UploadedFileTest.php b/tests/Service/Attachment/UploadedFileTest.php index 5ac1220d5..d7172a00a 100644 --- a/tests/Service/Attachment/UploadedFileTest.php +++ b/tests/Service/Attachment/UploadedFileTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\Service\Attachment; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Service\Attachment\UploadedFile; -use PHPUnit_Framework_TestCase; -class UploadedFileTest extends PHPUnit_Framework_TestCase { +class UploadedFileTest extends TestCase { public function testGetFileNameNotExisting() { $file = new UploadedFile([]); diff --git a/tests/Service/Autocompletion/AddressCollectorTest.php b/tests/Service/Autocompletion/AddressCollectorTest.php index 57b9fb588..fcebaf883 100644 --- a/tests/Service/Autocompletion/AddressCollectorTest.php +++ b/tests/Service/Autocompletion/AddressCollectorTest.php @@ -21,13 +21,12 @@ namespace OCA\Mail\Tests\Service\Autocompletion; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\AddressList; use OCA\Mail\Db\CollectedAddress; -use OCA\Mail\Model\Message; use OCA\Mail\Service\AutoCompletion\AddressCollector; -use PHPUnit_Framework_TestCase; -class AddressCollectorTest extends PHPUnit_Framework_TestCase { +class AddressCollectorTest extends TestCase { private $mapper; private $userId = 'testuser'; diff --git a/tests/Service/Autocompletion/AutoCompleteServiceTest.php b/tests/Service/Autocompletion/AutoCompleteServiceTest.php index b79791ff7..256469b0b 100644 --- a/tests/Service/Autocompletion/AutoCompleteServiceTest.php +++ b/tests/Service/Autocompletion/AutoCompleteServiceTest.php @@ -21,11 +21,11 @@ namespace OCA\Mail\Tests\Service\Autocompletion; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Db\CollectedAddress; use OCA\Mail\Service\AutoCompletion\AutoCompleteService; -use PHPUnit_Framework_TestCase; -class AutoCompleteServiceTest extends PHPUnit_Framework_TestCase { +class AutoCompleteServiceTest extends TestCase { private $contactsIntegration; private $addressCollector; diff --git a/tests/Service/Autoconfig/AutoConfigTest.php b/tests/Service/Autoconfig/AutoConfigTest.php index fe73a6019..102515eb0 100644 --- a/tests/Service/Autoconfig/AutoConfigTest.php +++ b/tests/Service/Autoconfig/AutoConfigTest.php @@ -28,7 +28,7 @@ use OCA\Mail\Db\MailAccount; use OCA\Mail\Service\AutoConfig\AutoConfig; use OCA\Mail\Service\AutoConfig\ConfigurationDetector; use OCA\Mail\Service\AutoConfig\IspDbConfigurationDetector; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use PHPUnit_Framework_MockObject_MockObject; class AutoConfigTest extends TestCase { diff --git a/tests/Service/Autoconfig/ConfigurationDetectorTest.php b/tests/Service/Autoconfig/ConfigurationDetectorTest.php index 07bb55dd0..6b7bbd564 100644 --- a/tests/Service/Autoconfig/ConfigurationDetectorTest.php +++ b/tests/Service/Autoconfig/ConfigurationDetectorTest.php @@ -28,7 +28,7 @@ use OCA\Mail\Db\MailAccount; use OCA\Mail\Service\AutoConfig\ConfigurationDetector; use OCA\Mail\Service\AutoConfig\ImapServerDetector; use OCA\Mail\Service\AutoConfig\SmtpServerDetector; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use PHPUnit_Framework_MockObject_MockObject; class ConfigurationDetectorTest extends TestCase { diff --git a/tests/Service/Autoconfig/ConnectivityTesterTest.php b/tests/Service/Autoconfig/ConnectivityTesterTest.php index e3133951e..d18444638 100644 --- a/tests/Service/Autoconfig/ConnectivityTesterTest.php +++ b/tests/Service/Autoconfig/ConnectivityTesterTest.php @@ -21,15 +21,14 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Service\AutoConfig\ConnectivityTester; use OCA\Mail\Service\Logger; -use OpenCloud\Common\Log\Logger as Logger2; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class ConnectivityTesterTest extends PHPUnit_Framework_TestCase { +class ConnectivityTesterTest extends TestCase { - /** @var Logger2|PHPUnit_Framework_MockObject_MockObject */ + /** @var Logger|PHPUnit_Framework_MockObject_MockObject */ private $logger; /** @var ConnectivityTester */ diff --git a/tests/Service/Autoconfig/ImapConnectivityTesterTest.php b/tests/Service/Autoconfig/ImapConnectivityTesterTest.php index ebc7cc932..f4d4d3813 100644 --- a/tests/Service/Autoconfig/ImapConnectivityTesterTest.php +++ b/tests/Service/Autoconfig/ImapConnectivityTesterTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Exception; use OCA\Mail\Service\AutoConfig\ConnectivityTester; use OCA\Mail\Service\AutoConfig\ImapConnectivityTester; @@ -28,9 +29,8 @@ use OCA\Mail\Service\AutoConfig\ImapConnector; use OCA\Mail\Service\Logger; use OpenCloud\Common\Log\Logger as Logger2; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class ImapConnectivityTesterTest extends PHPUnit_Framework_TestCase { +class ImapConnectivityTesterTest extends TestCase { /** @var ImapConnector|PHPUnit_Framework_MockObject_MockObject */ private $imapConnector; diff --git a/tests/Service/Autoconfig/ImapConnectorTest.php b/tests/Service/Autoconfig/ImapConnectorTest.php index 54f4e3f8e..f4ebab547 100644 --- a/tests/Service/Autoconfig/ImapConnectorTest.php +++ b/tests/Service/Autoconfig/ImapConnectorTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Exception; use OC; use OCA\Mail\Db\MailAccount; @@ -28,9 +29,8 @@ use OCA\Mail\Service\AutoConfig\ImapConnector; use OCA\Mail\Service\Logger; use OCP\Security\ICrypto; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class ImapConnectorTest extends PHPUnit_Framework_TestCase { +class ImapConnectorTest extends TestCase { /** @var ICrypto */ private $crypto; diff --git a/tests/Service/Autoconfig/ImapServerDetectorTest.php b/tests/Service/Autoconfig/ImapServerDetectorTest.php index d23c8a7a2..ba242d930 100644 --- a/tests/Service/Autoconfig/ImapServerDetectorTest.php +++ b/tests/Service/Autoconfig/ImapServerDetectorTest.php @@ -21,14 +21,14 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Db\MailAccount; use OCA\Mail\Service\AutoConfig\ImapConnectivityTester; use OCA\Mail\Service\AutoConfig\ImapServerDetector; use OCA\Mail\Service\AutoConfig\MxRecord; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class ImapServerDetectorTest extends PHPUnit_Framework_TestCase { +class ImapServerDetectorTest extends TestCase { /** @var MxRecord|PHPUnit_Framework_MockObject_MockObject */ private $mxRecord; diff --git a/tests/Service/Autoconfig/IspDbTest.php b/tests/Service/Autoconfig/IspDbTest.php index 43f6647f9..80924be6f 100644 --- a/tests/Service/Autoconfig/IspDbTest.php +++ b/tests/Service/Autoconfig/IspDbTest.php @@ -22,10 +22,10 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Service\AutoConfig\IspDb; -use PHPUnit_Framework_TestCase; -class IspDbtest extends PHPUnit_Framework_TestCase { +class IspDbtest extends TestCase { private $logger; diff --git a/tests/Service/Autoconfig/MxRecordTest.php b/tests/Service/Autoconfig/MxRecordTest.php index 13e5e288f..9f83f918d 100644 --- a/tests/Service/Autoconfig/MxRecordTest.php +++ b/tests/Service/Autoconfig/MxRecordTest.php @@ -21,11 +21,11 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Service\AutoConfig\MxRecord; use OCA\Mail\Service\Logger; -use PHPUnit_Framework_TestCase; -class MxRecordTest extends PHPUnit_Framework_TestCase { +class MxRecordTest extends TestCase { /** @var MxRecord */ private $record; diff --git a/tests/Service/Autoconfig/SmtpConnectivityTesterTest.php b/tests/Service/Autoconfig/SmtpConnectivityTesterTest.php index 952c37858..41fa8bb54 100644 --- a/tests/Service/Autoconfig/SmtpConnectivityTesterTest.php +++ b/tests/Service/Autoconfig/SmtpConnectivityTesterTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use Exception; use Horde_Mail_Transport_Smtphorde; use OCA\Mail\Db\MailAccount; @@ -30,9 +31,8 @@ use OCA\Mail\Service\Logger; use OCA\Mail\SMTP\SmtpClientFactory; use OCP\Security\ICrypto; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class SmtpConnectivityTesterTest extends PHPUnit_Framework_TestCase { +class SmtpConnectivityTesterTest extends TestCase { /** @var ConnectivityTester|PHPUnit_Framework_MockObject_MockObject */ private $connectivityTester; diff --git a/tests/Service/Autoconfig/SmtpServerDetectorTest.php b/tests/Service/Autoconfig/SmtpServerDetectorTest.php index 7b3d8c5be..9c1fe6e1a 100644 --- a/tests/Service/Autoconfig/SmtpServerDetectorTest.php +++ b/tests/Service/Autoconfig/SmtpServerDetectorTest.php @@ -21,14 +21,14 @@ namespace OCA\Mail\Tests\Service\Autoconfig; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Db\MailAccount; use OCA\Mail\Service\AutoConfig\MxRecord; use OCA\Mail\Service\AutoConfig\SmtpConnectivityTester; use OCA\Mail\Service\AutoConfig\SmtpServerDetector; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class SmtpServerDetectorTest extends PHPUnit_Framework_TestCase { +class SmtpServerDetectorTest extends TestCase { /** @var MxRecord|PHPUnit_Framework_MockObject_MockObject */ private $mxRecord; diff --git a/tests/Service/Avatar/AddressbookSourceTest.php b/tests/Service/Avatar/AddressbookSourceTest.php index 8ca6a1ef8..675c36907 100644 --- a/tests/Service/Avatar/AddressbookSourceTest.php +++ b/tests/Service/Avatar/AddressbookSourceTest.php @@ -28,7 +28,7 @@ use OCA\Mail\Service\Avatar\AddressbookSource; use OCA\Mail\Service\Avatar\Avatar; use OCA\Mail\Service\Avatar\AvatarFactory; use OCA\Mail\Service\ContactsIntegration; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use PHPUnit_Framework_MockObject_MockObject; class AddressbookSourceTest extends TestCase { diff --git a/tests/Service/Avatar/CacheTest.php b/tests/Service/Avatar/CacheTest.php index f542431c3..4ba32b377 100644 --- a/tests/Service/Avatar/CacheTest.php +++ b/tests/Service/Avatar/CacheTest.php @@ -27,7 +27,7 @@ namespace OCA\Mail\Tests\Service\Avatar; use OCA\Mail\Service\Avatar\Avatar; use OCA\Mail\Service\Avatar\AvatarFactory; use OCA\Mail\Service\Avatar\Cache; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\ICache; use OCP\ICacheFactory; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/Service/Avatar/CompositeAvatarSourceTest.php b/tests/Service/Avatar/CompositeAvatarSourceTest.php index 37088b20d..a83193734 100644 --- a/tests/Service/Avatar/CompositeAvatarSourceTest.php +++ b/tests/Service/Avatar/CompositeAvatarSourceTest.php @@ -30,7 +30,7 @@ use OCA\Mail\Service\Avatar\AvatarFactory; use OCA\Mail\Service\Avatar\CompositeAvatarSource; use OCA\Mail\Service\Avatar\FaviconSource; use OCA\Mail\Service\Avatar\GravatarSource; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use PHPUnit_Framework_MockObject_MockObject; class CompositeAvatarSourceTest extends TestCase { diff --git a/tests/Service/Avatar/DownloaderTest.php b/tests/Service/Avatar/DownloaderTest.php index c6a3f2784..e696dddbc 100644 --- a/tests/Service/Avatar/DownloaderTest.php +++ b/tests/Service/Avatar/DownloaderTest.php @@ -26,7 +26,7 @@ namespace OCA\Mail\Tests\Service\Avatar; use Exception; use OCA\Mail\Service\Avatar\Downloader; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; diff --git a/tests/Service/Avatar/FaviconSourceTest.php b/tests/Service/Avatar/FaviconSourceTest.php index e3509e0c0..6866ef5a2 100644 --- a/tests/Service/Avatar/FaviconSourceTest.php +++ b/tests/Service/Avatar/FaviconSourceTest.php @@ -29,7 +29,7 @@ use Mpclarkson\IconScraper\Icon; use OCA\Mail\Service\Avatar\Avatar; use OCA\Mail\Service\Avatar\AvatarFactory; use OCA\Mail\Service\Avatar\FaviconSource; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\Files\IMimeTypeDetector; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; diff --git a/tests/Service/Avatar/GravatarSouceTest.php b/tests/Service/Avatar/GravatarSouceTest.php index db4274e5e..60a013cbf 100644 --- a/tests/Service/Avatar/GravatarSouceTest.php +++ b/tests/Service/Avatar/GravatarSouceTest.php @@ -28,7 +28,7 @@ use Exception; use OCA\Mail\Service\Avatar\Avatar; use OCA\Mail\Service\Avatar\AvatarFactory; use OCA\Mail\Service\Avatar\GravatarSource; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; diff --git a/tests/Service/AvatarServiceTest.php b/tests/Service/AvatarServiceTest.php index 348efe287..504f1cfd4 100644 --- a/tests/Service/AvatarServiceTest.php +++ b/tests/Service/AvatarServiceTest.php @@ -32,7 +32,7 @@ use OCA\Mail\Service\Avatar\CompositeAvatarSource; use OCA\Mail\Service\Avatar\Downloader; use OCA\Mail\Service\Avatar\IAvatarSource; use OCA\Mail\Service\AvatarService; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IURLGenerator; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/Service/ContactsIntegrationTest.php b/tests/Service/ContactsIntegrationTest.php index d67c7600d..736858491 100644 --- a/tests/Service/ContactsIntegrationTest.php +++ b/tests/Service/ContactsIntegrationTest.php @@ -21,10 +21,10 @@ namespace OCA\Mail\Tests\Service; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Service\ContactsIntegration; -use PHPUnit_Framework_TestCase; -class ContactsIntegrationTest extends PHPUnit_Framework_TestCase { +class ContactsIntegrationTest extends TestCase { private $contactsManager; private $contactsIntegration; diff --git a/tests/Service/DefaultAccount/ConfigTest.php b/tests/Service/DefaultAccount/ConfigTest.php index 2ffc9c924..358d201ce 100644 --- a/tests/Service/DefaultAccount/ConfigTest.php +++ b/tests/Service/DefaultAccount/ConfigTest.php @@ -21,11 +21,11 @@ namespace OCA\Mail\Tests\Service\DefaultAccount; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Service\DefaultAccount\Config; use OCP\IUser; -use PHPUnit_Framework_TestCase; -class ConfigTest extends PHPUnit_Framework_TestCase { +class ConfigTest extends TestCase { public function testBuildEmailWithUserId() { $user = $this->createMock(IUser::class); diff --git a/tests/Service/DefaultAccount/ManagerTest.php b/tests/Service/DefaultAccount/ManagerTest.php index 6b71dd60e..b8ecb9c92 100644 --- a/tests/Service/DefaultAccount/ManagerTest.php +++ b/tests/Service/DefaultAccount/ManagerTest.php @@ -21,18 +21,20 @@ namespace OCA\Mail\Tests\Service\DefaultAccount; +use ChristophWurst\Nextcloud\Testing\TestCase; +use OCA\Mail\Db\MailAccount; use OCA\Mail\Service\DefaultAccount\Manager; use OCA\Mail\Service\Logger; use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\LoginCredentials\ICredentials; use OCP\Authentication\LoginCredentials\IStore; use OCP\IConfig; +use OCP\IUser; use OCP\IUserSession; use OCP\Security\ICrypto; use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; -class ManagerTest extends PHPUnit_Framework_TestCase { +class ManagerTest extends TestCase { /** @var IConfig|PHPUnit_Framework_MockObject_MockObject */ private $config; @@ -105,7 +107,7 @@ class ManagerTest extends PHPUnit_Framework_TestCase { 'smtpSslMode' => 'tls', ]); $credentials = $this->createMock(ICredentials::class); - $user = $this->createMock(\OCP\IUser::class); + $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') ->willReturn($user); @@ -119,7 +121,7 @@ class ManagerTest extends PHPUnit_Framework_TestCase { ->method('encrypt') ->with($this->equalTo('123456')) ->willReturn('encrypted'); - $expected = new \OCA\Mail\Db\MailAccount(); + $expected = new MailAccount(); $expected->setId(Manager::ACCOUNT_ID); $user->expects($this->any()) ->method('getUID') diff --git a/tests/Service/FolderMapperTest.php b/tests/Service/FolderMapperTest.php index c97c5422c..e9c0647ac 100644 --- a/tests/Service/FolderMapperTest.php +++ b/tests/Service/FolderMapperTest.php @@ -28,7 +28,7 @@ use OCA\Mail\Account; use OCA\Mail\Folder; use OCA\Mail\IMAP\FolderMapper; use OCA\Mail\SearchFolder; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; class FolderMapperTest extends TestCase { diff --git a/tests/Service/FolderNameTranslatorTest.php b/tests/Service/FolderNameTranslatorTest.php index 4de151c7d..e905ec5e2 100644 --- a/tests/Service/FolderNameTranslatorTest.php +++ b/tests/Service/FolderNameTranslatorTest.php @@ -23,7 +23,7 @@ namespace OCA\Mail\Tests\Service; use OCA\Mail\Folder; use OCA\Mail\Service\FolderNameTranslator; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IL10N; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/Service/HtmlTest.php b/tests/Service/HtmlTest.php index 8a8eb8b04..2f58790c8 100644 --- a/tests/Service/HtmlTest.php +++ b/tests/Service/HtmlTest.php @@ -22,11 +22,11 @@ namespace OCA\Mail\Tests\Service; +use ChristophWurst\Nextcloud\Testing\TestCase; use OC; use OCA\Mail\Service\Html; -use PHPUnit_Framework_TestCase; -class HtmlTest extends PHPUnit_Framework_TestCase { +class HtmlTest extends TestCase { /** * @dataProvider linkDetectionProvider diff --git a/tests/Service/LoggerTest.php b/tests/Service/LoggerTest.php index 59b16a316..6f882c0f3 100644 --- a/tests/Service/LoggerTest.php +++ b/tests/Service/LoggerTest.php @@ -22,12 +22,12 @@ namespace OCA\Mail\Tests\Service; +use ChristophWurst\Nextcloud\Testing\TestCase; use Exception; use OCA\Mail\Service\Logger; use OCP\ILogger; -use PHPUnit_Framework_TestCase; -class LoggerTest extends PHPUnit_Framework_TestCase { +class LoggerTest extends TestCase { /** * @dataProvider providesLoggerMethods diff --git a/tests/Service/MailManagerTest.php b/tests/Service/MailManagerTest.php index 1b55cd708..3d785b414 100644 --- a/tests/Service/MailManagerTest.php +++ b/tests/Service/MailManagerTest.php @@ -21,6 +21,7 @@ namespace OCA\Mail\Tests\Service; +use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Imap_Client_Socket; use OCA\Mail\Account; use OCA\Mail\IMAP\FolderMapper; @@ -30,25 +31,24 @@ use OCA\Mail\IMAP\Sync\Request; use OCA\Mail\IMAP\Sync\Synchronizer; use OCA\Mail\Service\FolderNameTranslator; use OCA\Mail\Service\MailManager; -use OCA\Mail\Tests\TestCase; use OCP\Files\Folder; -use PHPUnit_Framework_TestCase; +use PHPUnit_Framework_MockObject_MockObject; class MailManagerTest extends TestCase { - /** @var IMAPClientFactory|PHPUnit_Framework_TestCase */ + /** @var IMAPClientFactory|PHPUnit_Framework_MockObject_MockObject */ private $imapClientFactory; - /** @var FolderMapper|PHPUnit_Framework_TestCase */ + /** @var FolderMapper|PHPUnit_Framework_MockObject_MockObject */ private $folderMapper; - /** @var MessageMapper|PHPUnit_Framework_TestCase */ + /** @var MessageMapper|PHPUnit_Framework_MockObject_MockObject */ private $messageMapper; - /** @var FolderNameTranslator|PHPUnit_Framework_TestCase */ + /** @var FolderNameTranslator|PHPUnit_Framework_MockObject_MockObject */ private $translator; - /** @var Synchronizer|PHPUnit_Framework_TestCase */ + /** @var Synchronizer|PHPUnit_Framework_MockObject_MockObject */ private $sync; /** @varr MailManager */ diff --git a/tests/Service/MailTransmissionTest.php b/tests/Service/MailTransmissionTest.php index 9395bc3c5..7b92e36f7 100644 --- a/tests/Service/MailTransmissionTest.php +++ b/tests/Service/MailTransmissionTest.php @@ -38,7 +38,7 @@ use OCA\Mail\Service\AutoCompletion\AddressCollector; use OCA\Mail\Service\Logger; use OCA\Mail\Service\MailTransmission; use OCA\Mail\SMTP\SmtpClientFactory; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\Files\Folder; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/Service/SetupServiceTest.php b/tests/Service/SetupServiceTest.php index 227d34788..342ac62dd 100644 --- a/tests/Service/SetupServiceTest.php +++ b/tests/Service/SetupServiceTest.php @@ -31,7 +31,7 @@ use OCA\Mail\Service\AutoConfig\AutoConfig; use OCA\Mail\Service\Logger; use OCA\Mail\Service\SetupService; use OCA\Mail\SMTP\SmtpClientFactory; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\Security\ICrypto; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/Service/UserPreferenceServiceTest.php b/tests/Service/UserPreferenceServiceTest.php index 4e5a0e079..6fabd0227 100644 --- a/tests/Service/UserPreferenceServiceTest.php +++ b/tests/Service/UserPreferenceServiceTest.php @@ -25,7 +25,7 @@ namespace OCA\Mail\Tests\Service; use OCA\Mail\Service\UserPreferenceSevice; -use OCA\Mail\Tests\TestCase; +use ChristophWurst\Nextcloud\Testing\TestCase; use OCP\IConfig; class UserPreferenceServiceTest extends TestCase { diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index 227b83927..000000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/** - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * - * Mail - * - * 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 OCA\Mail\Tests; - -use PHPUnit_Framework_TestCase; - -abstract class TestCase extends PHPUnit_Framework_TestCase { - -} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 120b7fa15..d2447a487 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -28,8 +28,4 @@ require_once __DIR__.'/../vendor/autoload.php'; \OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); \OC_App::loadApp('mail'); -if(!class_exists('PHPUnit_Framework_TestCase')) { - require_once('PHPUnit/Autoload.php'); -} - OC_Hook::clear(); |