Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/AppInfo/ApplicationTest.php (renamed from tests/applicationtest.php)9
-rw-r--r--tests/Command/CreateAccountTest.php (renamed from tests/command/createaccounttest.php)0
-rw-r--r--tests/Controller/AccountsControllerTest.php (renamed from tests/controller/accountscontrollertest.php)13
-rw-r--r--tests/Controller/AliasesControllerTest.php (renamed from tests/controller/aliasescontrollertest.php)8
-rw-r--r--tests/Controller/AutoconfigControllerTest.php (renamed from tests/controller/autoconfigcontrollertest.php)4
-rw-r--r--tests/Controller/FoldersControllerTest.php (renamed from tests/controller/folderscontrollertest.php)5
-rw-r--r--tests/Controller/MessagesControllerTest.php (renamed from tests/controller/messagescontrollertest.php)17
-rw-r--r--tests/Controller/PageControllerTest.php (renamed from tests/controller/pagecontrollertest.php)4
-rw-r--r--tests/Controller/ProxyControllerTest.php (renamed from tests/controller/proxycontrollertest.php)8
-rw-r--r--tests/Db/AliasMapperTest.php (renamed from tests/db/aliasmappertest.php)9
-rw-r--r--tests/Db/CollectedAddressMapperTest.php (renamed from tests/db/collectedaddressmappertest.php)20
-rw-r--r--tests/Db/MailAccountMapperTest.php (renamed from tests/db/mailaccountmappertest.php)9
-rw-r--r--tests/Db/MailAccountTest.php (renamed from tests/db/mailaccounttest.php)6
-rw-r--r--tests/HordeTranslationHandlerTest.php (renamed from tests/hordetranslationhandlertest.php)0
-rw-r--r--tests/Http/AttachmentDownloadResponseTest.php (renamed from tests/http/attachmentdownloadresponsetest.php)10
-rw-r--r--tests/Http/HtmlResponseTest.php (renamed from tests/http/htmlresponsetest.php)12
-rw-r--r--tests/Http/ProxyDownloadResponseTest.php (renamed from tests/http/proxydownloadresponsetest.php)12
-rw-r--r--tests/Imap/AbstractTest.php (renamed from tests/imap/abstracttest.php)37
-rw-r--r--tests/Imap/AccountTest.php (renamed from tests/imap/accounttest.php)0
-rw-r--r--tests/Model/ImapMessageTest.php (renamed from tests/model/imapmessagetest.php)7
-rw-r--r--tests/Model/MessageTest.php (renamed from tests/model/messagetest.php)4
-rw-r--r--tests/Model/ReplyMessageTest.php (renamed from tests/model/replymessagetest.php)0
-rw-r--r--tests/Service/AccoutServiceTest.php (renamed from tests/service/accoutservicetest.php)7
-rw-r--r--tests/Service/AliasesServiceTest.php (renamed from tests/service/aliasesservicetest.php)4
-rw-r--r--tests/Service/Autocompletion/AddressCollectorTest.php (renamed from tests/service/autocompletion/addresscollectortest.php)0
-rw-r--r--tests/Service/Autocompletion/AutoCompleteServiceTest.php (renamed from tests/service/autocompletion/autocompleteservicetest.php)0
-rw-r--r--tests/Service/Autoconfig/IspDbTest.php (renamed from tests/service/autoconfig/ispdbtest.php)4
-rw-r--r--tests/Service/ContactsIntegrationTest.php (renamed from tests/service/contactsintegrationtest.php)4
-rw-r--r--tests/Service/HtmlTest.php87
-rw-r--r--tests/Service/LoggerTest.php (renamed from tests/service/loggertest.php)4
-rw-r--r--tests/phpunit.xml1
-rw-r--r--tests/service/htmltest.php84
32 files changed, 200 insertions, 189 deletions
diff --git a/tests/applicationtest.php b/tests/AppInfo/ApplicationTest.php
index f97f0f1fe..36c54e674 100644
--- a/tests/applicationtest.php
+++ b/tests/AppInfo/ApplicationTest.php
@@ -18,14 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use Test\TestCase;
+
+namespace OCA\Mail\Tests\AppInfo;
+
use OCA\Mail\AppInfo\Application;
+use PHPUnit_Framework_TestCase;
-class ApplicationTest extends TestCase {
+class ApplicationTest extends PHPUnit_Framework_TestCase {
public function testConstrucor() {
// Not really a test – it's just about code coverage
- $app = new Application();
+ new Application();
}
}
diff --git a/tests/command/createaccounttest.php b/tests/Command/CreateAccountTest.php
index 57ffa22d0..57ffa22d0 100644
--- a/tests/command/createaccounttest.php
+++ b/tests/Command/CreateAccountTest.php
diff --git a/tests/controller/accountscontrollertest.php b/tests/Controller/AccountsControllerTest.php
index c9a63b434..c3e7075ca 100644
--- a/tests/controller/accountscontrollertest.php
+++ b/tests/Controller/AccountsControllerTest.php
@@ -19,13 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
+use OC\AppFramework\Http;
use OCA\Mail\Controller\AccountsController;
use OCA\Mail\Model\Message;
-use OC\AppFramework\Http;
+use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http\JSONResponse;
-use OCA\Mail\Service\AliasesService;
-class AccountsControllerTest extends \Test\TestCase {
+class AccountsControllerTest extends PHPUnit_Framework_TestCase {
private $appName;
private $request;
@@ -137,7 +138,7 @@ class AccountsControllerTest extends \Test\TestCase {
->will($this->returnValue($this->account));
$this->account->expects($this->once())
->method('getConfiguration')
- ->will($this->throwException(new OCP\AppFramework\Db\DoesNotExistException('test123')));
+ ->will($this->throwException(new DoesNotExistException('test123')));
$response = $this->controller->show($this->accountId);
@@ -161,7 +162,7 @@ class AccountsControllerTest extends \Test\TestCase {
$this->accountService->expects($this->once())
->method('delete')
->with($this->equalTo($this->userId), $this->equalTo($this->accountId))
- ->will($this->throwException(new \OCP\AppFramework\Db\DoesNotExistException('test')));
+ ->will($this->throwException(new DoesNotExistException('test')));
$response = $this->controller->destroy($this->accountId);
@@ -341,7 +342,7 @@ class AccountsControllerTest extends \Test\TestCase {
if ($addressCollectorError) {
$this->collector->expects($this->once())
->method('addAddresses')
- ->will($this->throwException(new \Exception('some error')));
+ ->will($this->throwException(new Exception('some error')));
} else {
$this->collector->expects($this->once())
->method('addAddresses');
diff --git a/tests/controller/aliasescontrollertest.php b/tests/Controller/AliasesControllerTest.php
index 2fd57cbe1..403f59c6d 100644
--- a/tests/controller/aliasescontrollertest.php
+++ b/tests/Controller/AliasesControllerTest.php
@@ -19,14 +19,10 @@
*
*/
-use OC\AppFramework\Http;
-use OCP\AppFramework\Db\DoesNotExistException;
-use OCP\AppFramework\Http\JSONResponse;
use OCA\Mail\Controller\AliasesController;
-use OCP\IUserSession;
-use Test\TestCase;
+use OCP\AppFramework\Http\JSONResponse;
-class AliasesControllerTest extends TestCase {
+class AliasesControllerTest extends PHPUnit_Framework_TestCase {
private $controller;
private $appName = 'mail';
private $request;
diff --git a/tests/controller/autoconfigcontrollertest.php b/tests/Controller/AutoconfigControllerTest.php
index a44e2058c..77abd6677 100644
--- a/tests/controller/autoconfigcontrollertest.php
+++ b/tests/Controller/AutoconfigControllerTest.php
@@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use Test\TestCase;
+
use OCA\Mail\Controller\AutoCompleteController;
-class AutoConfigControllerTest extends TestCase {
+class AutoConfigControllerTest extends PHPUnit_Framework_TestCase {
private $request;
private $service;
diff --git a/tests/controller/folderscontrollertest.php b/tests/Controller/FoldersControllerTest.php
index dc72550ee..73467e365 100644
--- a/tests/controller/folderscontrollertest.php
+++ b/tests/Controller/FoldersControllerTest.php
@@ -18,10 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
use OC\AppFramework\Http;
+use OCA\Mail\Controller\FoldersController;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http\JSONResponse;
-use OCA\Mail\Controller\FoldersController;
class FoldersControllerTest extends PHPUnit_Framework_TestCase {
@@ -183,7 +184,7 @@ class FoldersControllerTest extends PHPUnit_Framework_TestCase {
$imapConnection->expects($this->once())
->method('createMailbox')
->with($folderId)
- ->will($this->throwException(new \Horde_Imap_Client_Exception()));
+ ->will($this->throwException(new Horde_Imap_Client_Exception()));
$response = $this->controller->create($accountId, $folderId);
diff --git a/tests/controller/messagescontrollertest.php b/tests/Controller/MessagesControllerTest.php
index 46e14f5d1..e10dfce4a 100644
--- a/tests/controller/messagescontrollertest.php
+++ b/tests/Controller/MessagesControllerTest.php
@@ -20,18 +20,15 @@
*
*/
+use OCA\Mail\Controller\MessagesController;
+use OCA\Mail\Http\AttachmentDownloadResponse;
+use OCA\Mail\Http\HtmlResponse;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\JSONResponse;
-use OCA\Mail\Controller\MessagesController;
-use OCA\Mail\Http\AttachmentDownloadResponse;
-/**
- * Tests for lib/controller/messagescontroller
- *
- * @author Christoph Wurst
- */
-class MessagesControllerTest extends \Test\TestCase {
+class MessagesControllerTest extends PHPUnit_Framework_TestCase {
private $appName;
private $request;
@@ -130,11 +127,11 @@ class MessagesControllerTest extends \Test\TestCase {
->with($this->equalTo($messageId), $this->equalTo(true))
->will($this->returnValue($this->message));
- $expectedResponse = new \OCA\Mail\Http\HtmlResponse(null);
+ $expectedResponse = new HtmlResponse(null);
$expectedResponse->cacheFor(3600);
$expectedResponse->addHeader('Pragma', 'cache');
if(class_exists('\OCP\AppFramework\Http\ContentSecurityPolicy')) {
- $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy();
+ $policy = new ContentSecurityPolicy();
$policy->allowEvalScript(false);
$policy->disallowScriptDomain('\'self\'');
$policy->disallowConnectDomain('\'self\'');
diff --git a/tests/controller/pagecontrollertest.php b/tests/Controller/PageControllerTest.php
index dbdea00be..68fd7b956 100644
--- a/tests/controller/pagecontrollertest.php
+++ b/tests/Controller/PageControllerTest.php
@@ -18,13 +18,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
use OCA\Mail\Controller\PageController;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
-use Test\TestCase;
-class PageControllerTest extends TestCase {
+class PageControllerTest extends PHPUnit_Framework_TestCase {
private $appName;
private $request;
diff --git a/tests/controller/proxycontrollertest.php b/tests/Controller/ProxyControllerTest.php
index 508f35a4b..e5ee40a73 100644
--- a/tests/controller/proxycontrollertest.php
+++ b/tests/Controller/ProxyControllerTest.php
@@ -18,12 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use OCP\AppFramework\Http\TemplateResponse;
-use Test\TestCase;
+
use OCA\Mail\Controller\ProxyController;
use OCA\Mail\Http\ProxyDownloadResponse;
+use OCP\AppFramework\Http\TemplateResponse;
-class ProxyControllerTest extends TestCase {
+class ProxyControllerTest extends PHPUnit_Framework_TestCase {
private $appName;
private $request;
@@ -96,7 +96,7 @@ class ProxyControllerTest extends TestCase {
}
/**
- * @expectedException \Exception
+ * @expectedException Exception
*/
public function testRedirectInvalidUrl() {
$this->controller = new ProxyController($this->appName, $this->request,
diff --git a/tests/db/aliasmappertest.php b/tests/Db/AliasMapperTest.php
index b39de76e1..ba5fcae72 100644
--- a/tests/db/aliasmappertest.php
+++ b/tests/Db/AliasMapperTest.php
@@ -21,15 +21,18 @@
namespace OCA\Mail\Db;
+use OC;
use OC\AppFramework\Db\Db;
+use OC\DB\Connection;
+use PHPUnit_Framework_TestCase;
-class AliasMapperTest extends \PHPUnit_Framework_TestCase {
+class AliasMapperTest extends PHPUnit_Framework_TestCase {
/**
* @var AliasMapper
*/
private $mapper;
/**
- * @var \OC\DB\Connection
+ * @var Connection
*/
private $db;
/**
@@ -40,7 +43,7 @@ class AliasMapperTest extends \PHPUnit_Framework_TestCase {
* Initialize Mapper
*/
public function setup(){
- $db = \OC::$server->getDatabaseConnection();
+ $db = OC::$server->getDatabaseConnection();
$this->db = new Db($db);
$this->mapper = new AliasMapper($this->db);
}
diff --git a/tests/db/collectedaddressmappertest.php b/tests/Db/CollectedAddressMapperTest.php
index e6f164fad..b4ed92bdf 100644
--- a/tests/db/collectedaddressmappertest.php
+++ b/tests/Db/CollectedAddressMapperTest.php
@@ -22,22 +22,18 @@
namespace OCA\Mail\Tests\Db;
+use OC;
use OC\AppFramework\Db\Db;
-use Test\TestCase;
-use OCA\Mail\Db\CollectedAddressMapper;
use OCA\Mail\Db\CollectedAddress;
+use OCA\Mail\Db\CollectedAddressMapper;
+use OCP\IDBConnection;
+use PHPUnit_Framework_TestCase;
-/**
- * Class CollectedAddressMapperTest
- *
- * @group DB
- *
- * @package OCA\Mail\Tests\Db
- */
-class CollectedAddressMapperTest extends TestCase {
+class CollectedAddressMapperTest extends PHPUnit_Framework_TestCase {
- /** @var \OCP\IDBConnection */
+ /** @var IDBConnection */
private $db;
+ /** @var string */
private $userId = 'testuser';
/** @var CollectedAddressMapper */
private $mapper;
@@ -49,7 +45,7 @@ class CollectedAddressMapperTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->db = \OC::$server->getDatabaseConnection();
+ $this->db = OC::$server->getDatabaseConnection();
$this->mapper = new CollectedAddressMapper(new Db($this->db));
$this->address1 = new CollectedAddress();
diff --git a/tests/db/mailaccountmappertest.php b/tests/Db/MailAccountMapperTest.php
index 8cc52f11d..c68d97025 100644
--- a/tests/db/mailaccountmappertest.php
+++ b/tests/Db/MailAccountMapperTest.php
@@ -21,9 +21,12 @@
namespace OCA\Mail\Db;
+use OC;
use OC\AppFramework\Db\Db;
+use OC\DB\Connection;
+use PHPUnit_Framework_TestCase;
-class MailAccountMapperTest extends \PHPUnit_Framework_TestCase {
+class MailAccountMapperTest extends PHPUnit_Framework_TestCase {
/**
* @var MailAccountMapper
@@ -31,7 +34,7 @@ class MailAccountMapperTest extends \PHPUnit_Framework_TestCase {
private $mapper;
/**
- * @var \OC\DB\Connection
+ * @var Connection
*/
private $db;
@@ -44,7 +47,7 @@ class MailAccountMapperTest extends \PHPUnit_Framework_TestCase {
* Initialize Mapper
*/
public function setup(){
- $db = \OC::$server->getDatabaseConnection();
+ $db = OC::$server->getDatabaseConnection();
$this->db = new Db($db);
$this->mapper = new MailAccountMapper($this->db);
diff --git a/tests/db/mailaccounttest.php b/tests/Db/MailAccountTest.php
index 3be136868..65e7cca70 100644
--- a/tests/db/mailaccounttest.php
+++ b/tests/Db/MailAccountTest.php
@@ -21,8 +21,9 @@
namespace OCA\Mail\Db;
+use PHPUnit_Framework_TestCase;
-class TestMailAccount extends \PHPUnit_Framework_TestCase {
+class TestMailAccount extends PHPUnit_Framework_TestCase {
public function testToAPI() {
$a = new MailAccount();
@@ -53,7 +54,7 @@ class TestMailAccount extends \PHPUnit_Framework_TestCase {
'smtpPort' => 458,
'smtpUser' => 'spiderman',
'smtpSslMode' => 'ssl'
- ), $a->toJson());
+ ), $a->toJson());
}
public function testMailAccountConstruct() {
@@ -76,4 +77,5 @@ class TestMailAccount extends \PHPUnit_Framework_TestCase {
unset($expected['accountName']);
$this->assertEquals($expected, $a->toJson());
}
+
}
diff --git a/tests/hordetranslationhandlertest.php b/tests/HordeTranslationHandlerTest.php
index c0c9a246b..c0c9a246b 100644
--- a/tests/hordetranslationhandlertest.php
+++ b/tests/HordeTranslationHandlerTest.php
diff --git a/tests/http/attachmentdownloadresponsetest.php b/tests/Http/AttachmentDownloadResponseTest.php
index 1b0665314..4c9666a0d 100644
--- a/tests/http/attachmentdownloadresponsetest.php
+++ b/tests/Http/AttachmentDownloadResponseTest.php
@@ -19,12 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-namespace OCA\Mail\Tests\Http;
+namespace OCA\Mail\Tests\Http;
use OCA\Mail\Http\AttachmentDownloadResponse;
+use PHPUnit_Framework_TestCase;
-class AttachmentDownloadResponseTest extends \PHPUnit_Framework_TestCase {
+class AttachmentDownloadResponseTest extends PHPUnit_Framework_TestCase {
/**
* @dataProvider providesResponseData
@@ -41,11 +42,12 @@ class AttachmentDownloadResponseTest extends \PHPUnit_Framework_TestCase {
$this->assertArrayHasKey('Content-Disposition', $headers);
$pos = strpos($headers['Content-Disposition'], $filename);
$this->assertTrue($pos > 0);
- }
+ }
public function providesResponseData() {
return [
- ['1234567890', 'test.txt', 'text/plain']
+ ['1234567890', 'test.txt', 'text/plain']
];
}
+
}
diff --git a/tests/http/htmlresponsetest.php b/tests/Http/HtmlResponseTest.php
index dc1e9a28e..0d326f3a3 100644
--- a/tests/http/htmlresponsetest.php
+++ b/tests/Http/HtmlResponseTest.php
@@ -19,12 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-namespace OCA\Mail\Tests\Http;
+namespace OCA\Mail\Tests\Http;
use OCA\Mail\Http\HtmlResponse;
+use PHPUnit_Framework_TestCase;
-class HtmlResponseTest extends \PHPUnit_Framework_TestCase {
+class HtmlResponseTest extends PHPUnit_Framework_TestCase {
/**
* @dataProvider providesResponseData
@@ -32,15 +33,16 @@ class HtmlResponseTest extends \PHPUnit_Framework_TestCase {
* @param $filename
* @param $contentType
*/
- public function testIt($content){
+ public function testIt($content) {
$resp = new HtmlResponse($content);
$this->assertEquals($content, $resp->render());
- }
+ }
public function providesResponseData() {
return [
- ['1234567890']
+ ['1234567890']
];
}
+
}
diff --git a/tests/http/proxydownloadresponsetest.php b/tests/Http/ProxyDownloadResponseTest.php
index 447d46710..2d57ef727 100644
--- a/tests/http/proxydownloadresponsetest.php
+++ b/tests/Http/ProxyDownloadResponseTest.php
@@ -19,12 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-namespace OCA\Mail\Tests\Http;
+namespace OCA\Mail\Tests\Http;
use OCA\Mail\Http\ProxyDownloadResponse;
+use PHPUnit_Framework_TestCase;
-class ProxyDownloadResponseTest extends \PHPUnit_Framework_TestCase {
+class ProxyDownloadResponseTest extends PHPUnit_Framework_TestCase {
/**
* @dataProvider providesResponseData
@@ -32,7 +33,7 @@ class ProxyDownloadResponseTest extends \PHPUnit_Framework_TestCase {
* @param $filename
* @param $contentType
*/
- public function testIt($content, $filename, $contentType){
+ public function testIt($content, $filename, $contentType) {
$resp = new ProxyDownloadResponse($content, $filename, $contentType);
$headers = $resp->getHeaders();
$this->assertEquals($content, $resp->render());
@@ -41,11 +42,12 @@ class ProxyDownloadResponseTest extends \PHPUnit_Framework_TestCase {
$this->assertArrayHasKey('Content-Disposition', $headers);
$pos = strpos($headers['Content-Disposition'], $filename);
$this->assertTrue($pos > 0);
- }
+ }
public function providesResponseData() {
return [
- ['1234567890', 'test.txt', 'text/plain']
+ ['1234567890', 'test.txt', 'text/plain']
];
}
+
}
diff --git a/tests/imap/abstracttest.php b/tests/Imap/AbstractTest.php
index 484b90d95..0102d1fc9 100644
--- a/tests/imap/abstracttest.php
+++ b/tests/Imap/AbstractTest.php
@@ -20,28 +20,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
namespace OCA\Mail\Tests\Imap;
+use Exception;
+use OC;
use OCA\Mail\Account;
use OCA\Mail\Db\MailAccount;
use OCA\Mail\Mailbox;
+use PHPUnit_Framework_TestCase;
-abstract class AbstractTest extends \PHPUnit_Framework_TestCase {
+abstract class AbstractTest extends PHPUnit_Framework_TestCase {
- /**
- * @var Account
- */
+ /** @var Account */
private static $account;
- /**
- * @var string[]
- */
+ /** @var string[] */
private static $createdMailboxes = [];
public static function setUpBeforeClass() {
$user = 'user@domain.tld';
$password = 'mypassword';
- $password = \OC::$server->getCrypto()->encrypt($password);
+ $password = OC::$server->getCrypto()->encrypt($password);
$a = new MailAccount();
$a->setId(-1);
$a->setName('Mail');
@@ -62,29 +62,29 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase {
}
public static function tearDownAfterClass() {
- foreach(self::$createdMailboxes as $createdMailbox) {
+ foreach (self::$createdMailboxes as $createdMailbox) {
try {
self::deleteMailbox($createdMailbox);
- } catch(\Exception $ex) {
-
+ } catch (Exception $ex) {
+
}
}
}
/**
* @param string $name
- * @return \OCA\Mail\Mailbox
+ * @return Mailbox
*/
public function createMailBox($name) {
try {
$this->getTestAccount()->getMailbox($name);
$this->deleteMailbox($name);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
// Ignore mailbox not found
}
$mailbox = $this->getTestAccount()->createMailbox($name);
- self::$createdMailboxes[$name]= $mailbox;
+ self::$createdMailboxes[$name] = $mailbox;
return $mailbox;
}
@@ -110,12 +110,11 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase {
try {
$mb->getStatus();
return true;
- } catch (\Exception $ex) {
+ } catch (Exception $ex) {
return false;
}
}
-
/**
* @param string $name
*/
@@ -131,10 +130,8 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase {
}
protected function createTestMessage(
- Mailbox $mailbox,
- $subject = 'Don\'t panic!',
- $contents = 'Don\'t forget your towel',
- $from = 'someone@there.com',
+ Mailbox $mailbox, $subject = 'Don\'t panic!',
+ $contents = 'Don\'t forget your towel', $from = 'someone@there.com',
$to = 'me@here.com'
) {
$message = "From: $from
diff --git a/tests/imap/accounttest.php b/tests/Imap/AccountTest.php
index bf240b166..bf240b166 100644
--- a/tests/imap/accounttest.php
+++ b/tests/Imap/AccountTest.php
diff --git a/tests/model/imapmessagetest.php b/tests/Model/ImapMessageTest.php
index 9f2d85fb5..20df7b370 100644
--- a/tests/model/imapmessagetest.php
+++ b/tests/Model/ImapMessageTest.php
@@ -25,9 +25,10 @@ use Horde_Imap_Client_Data_Fetch;
use Horde_Imap_Client_Fetch_Results;
use Horde_Mime_Part;
use OCA\Mail\Model\IMAPMessage;
-use Test\TestCase;
+use OCA\Mail\Service\Html;
+use PHPUnit_Framework_TestCase;
-class ImapMessageTest extends TestCase {
+class ImapMessageTest extends PHPUnit_Framework_TestCase {
public function testNoFrom() {
$data = new Horde_Imap_Client_Data_Fetch();
@@ -76,7 +77,7 @@ class ImapMessageTest extends TestCase {
->will($this->returnCallback(function ($url) {
return "https://docs.example.com/server/go.php?to=$url";
}));
- $htmlService = new \OCA\Mail\Service\Html($urlGenerator, $request);
+ $htmlService = new Html($urlGenerator, $request);
// mock first fetch
$firstFetch = new Horde_Imap_Client_Data_Fetch();
diff --git a/tests/model/messagetest.php b/tests/Model/MessageTest.php
index 4a20d4385..020a79243 100644
--- a/tests/model/messagetest.php
+++ b/tests/Model/MessageTest.php
@@ -20,11 +20,11 @@
*/
namespace OCA\Mail\Tests\Model;
-use Test\TestCase;
use Horde_Mime_Part;
use OCA\Mail\Model\Message;
+use PHPUnit_Framework_TestCase;
-class MessageTest extends TestCase {
+class MessageTest extends PHPUnit_Framework_TestCase {
protected $message;
diff --git a/tests/model/replymessagetest.php b/tests/Model/ReplyMessageTest.php
index 692be03eb..692be03eb 100644
--- a/tests/model/replymessagetest.php
+++ b/tests/Model/ReplyMessageTest.php
diff --git a/tests/service/accoutservicetest.php b/tests/Service/AccoutServiceTest.php
index 8fef44fee..9fac101ee 100644
--- a/tests/service/accoutservicetest.php
+++ b/tests/Service/AccoutServiceTest.php
@@ -18,11 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use Test\TestCase;
+
use OCA\Mail\Account;
+use OCA\Mail\Db\MailAccount;
use OCA\Mail\Service\AccountService;
-class AccountServiceTest extends TestCase {
+class AccountServiceTest extends PHPUnit_Framework_TestCase {
private $user = 'herbert';
private $mapper;
@@ -131,7 +132,7 @@ class AccountServiceTest extends TestCase {
}
public function testSave() {
- $account = new OCA\Mail\Db\MailAccount();
+ $account = new MailAccount();
$expected = 42;
$this->mapper->expects($this->once())
diff --git a/tests/service/aliasesservicetest.php b/tests/Service/AliasesServiceTest.php
index 0330789a1..da48d5e15 100644
--- a/tests/service/aliasesservicetest.php
+++ b/tests/Service/AliasesServiceTest.php
@@ -20,10 +20,10 @@
*/
use OCA\Mail\Db\Alias;
-use Test\TestCase;
use OCA\Mail\Service\AliasesService;
-class AliasesServiceTest extends TestCase {
+class AliasesServiceTest extends PHPUnit_Framework_TestCase {
+
private $service;
private $user = 'herbert';
private $mapper;
diff --git a/tests/service/autocompletion/addresscollectortest.php b/tests/Service/Autocompletion/AddressCollectorTest.php
index e7d1147cd..e7d1147cd 100644
--- a/tests/service/autocompletion/addresscollectortest.php
+++ b/tests/Service/Autocompletion/AddressCollectorTest.php
diff --git a/tests/service/autocompletion/autocompleteservicetest.php b/tests/Service/Autocompletion/AutoCompleteServiceTest.php
index 27c054ed2..27c054ed2 100644
--- a/tests/service/autocompletion/autocompleteservicetest.php
+++ b/tests/Service/Autocompletion/AutoCompleteServiceTest.php
diff --git a/tests/service/autoconfig/ispdbtest.php b/tests/Service/Autoconfig/IspDbTest.php
index 9eac5620c..43f6647f9 100644
--- a/tests/service/autoconfig/ispdbtest.php
+++ b/tests/Service/Autoconfig/IspDbTest.php
@@ -23,9 +23,9 @@
namespace OCA\Mail\Tests\Service\Autoconfig;
use OCA\Mail\Service\AutoConfig\IspDb;
-use Test\TestCase;
+use PHPUnit_Framework_TestCase;
-class IspDbtest extends TestCase {
+class IspDbtest extends PHPUnit_Framework_TestCase {
private $logger;
diff --git a/tests/service/contactsintegrationtest.php b/tests/Service/ContactsIntegrationTest.php
index 3c85aed83..1fd1f7d7c 100644
--- a/tests/service/contactsintegrationtest.php
+++ b/tests/Service/ContactsIntegrationTest.php
@@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use Test\TestCase;
+
use OCA\Mail\Service\ContactsIntegration;
-class ContactsIntegrationTest extends TestCase {
+class ContactsIntegrationTest extends PHPUnit_Framework_TestCase {
private $contactsManager;
private $contactsIntegration;
diff --git a/tests/Service/HtmlTest.php b/tests/Service/HtmlTest.php
new file mode 100644
index 000000000..1ef726e44
--- /dev/null
+++ b/tests/Service/HtmlTest.php
@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * 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\Service;
+
+use OC;
+use OCA\Mail\Service\Html;
+use PHPUnit_Framework_TestCase;
+
+class HtmlTest extends PHPUnit_Framework_TestCase {
+
+ /**
+ * @dataProvider linkDetectionProvider
+ * @param $expected
+ * @param $text
+ */
+ public function testLinkDetection($expected, $text) {
+ $urlGenerator = OC::$server->getURLGenerator();
+ $request = OC::$server->getRequest();
+ $html = new Html($urlGenerator, $request);
+ $withLinks = $html->convertLinks($text);
+ $this->assertSame($expected, $withLinks);
+ }
+
+ public function linkDetectionProvider() {
+ return [
+ ['abc', 'abc'],
+ ['&lt;&gt;', '&lt;&gt;'],
+ ['<a href="http://google.com" rel="noreferrer" target="_blank">google.com</a>', 'http://google.com'],
+ ['<a href="https://google.com" rel="noreferrer" target="_blank">google.com</a>', 'https://google.com'],
+ ['<a href="ftp://google.com" rel="noreferrer" target="_blank">google.com</a>', 'ftp://google.com'],
+ ['<a href="http://www.themukt.com/2014/07/23/take-control-cloud-owncloud-7/" rel="noreferrer" target="_blank">www.themukt.com/2014/07/23/take-control-cloud-owncloud-7/</a>', 'http://www.themukt.com/2014/07/23/take-control-cloud-owncloud-7/'],
+ ['<a href="https://travis-ci.org/owncloud/music/builds/22037091" rel="noreferrer" target="_blank">travis-ci.org/owncloud/music/builds/22037091</a>', 'https://travis-ci.org/owncloud/music/builds/22037091'],
+ ['(<a href="ftp://google.com" rel="noreferrer" target="_blank">google.com</a>)', '(ftp://google.com)'],
+ ['<a href="https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1" rel="noreferrer" target="_blank">build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog</a>', 'https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1'],
+ ['(<a href="https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1" rel="noreferrer" target="_blank">build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog</a>)', '(https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1)'],
+ ['<a href="http://apps.owncloud.com/content/show.php/Music?content=160485" rel="noreferrer" target="_blank">apps.owncloud.com/content/show.php/Music</a>', 'http://apps.owncloud.com/content/show.php/Music?content=160485'],
+ ['<a href="https://groups.google.com/forum/#!forum/ctpug" rel="noreferrer" target="_blank">groups.google.com/forum/</a>', 'https://groups.google.com/forum/#!forum/ctpug'],
+// array('<a href="http://www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Da/ps&field-keywords=Fax%2C+Kopierer+scanner+Laser&rh=i%3Aaps%2Ck%3AFax%5Cc+Kopierer+scanner+Laser">www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Daps&field-keywords=Fax%2C+Kopierer+scanner+Laser&rh=i%3Aaps%2Ck%3AFax%5Cc+Kopierer+scanner+Laser</a>', 'http://www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Daps&field-keywords=Fax%2C+Kopierer+scanner+Laser&rh=i%3Aaps%2Ck%3AFax%5Cc+Kopierer+scanner+Laser'),
+ ['<a href="https://ci.owncloud.org/job/ownCloud-Documentation(7.0)/504/changes" rel="noreferrer" target="_blank">ci.owncloud.org/job/ownCloud-Documentation(7.0)/504/changes</a>', 'https://ci.owncloud.org/job/ownCloud-Documentation(7.0)/504/changes'],
+ ['<a href="https://communities.coverity.com/community/scan-(open-source)/content" rel="noreferrer" target="_blank">communities.coverity.com/community/scan-(open-source)/content</a>', 'https://communities.coverity.com/community/scan-(open-source)/content'],
+ ['<a href="https://ma.ellak.gr/events/5%CE%BF%CF%82-%CE%B5%CE%BA%CF%80%CE%B1%CE%B9%CE%B4%CE%B5%CF%85%CF%84%CE%B9%CE%BA%CF%8C%CF%82-%CE%BA%CF%8D%CE%BA%CE%BB%CE%BF%CF%82-%CF%83%CE%B5%CE%BC%CE%B9%CE%BD%CE%B1%CF%81%CE%AF%CF%89%CE%BD-%CE%B5-5/" rel="noreferrer" target="_blank">ma.ellak.gr/events/5ος-εκπαιδευτικός-κύκλος-σεμιναρίων-ε-5/</a>', 'https://ma.ellak.gr/events/5ος-εκπαιδευτικός-κύκλος-σεμιναρίων-ε-5/'],
+ ];
+ }
+
+ /**
+ * @dataProvider parseMailBodyProvider
+ * @param $expected
+ * @param $text
+ */
+ public function testParseMailBody($expectedBody, $expectedSignature, $text) {
+ $urlGenerator = OC::$server->getURLGenerator();
+ $request = OC::$server->getRequest();
+ $html = new Html($urlGenerator, $request);
+ list($b, $s) = $html->parseMailBody($text);
+ $this->assertSame($expectedBody, $b);
+ $this->assertSame($expectedSignature, $s);
+ }
+
+ public function parseMailBodyProvider() {
+ return [
+ ['abc', null, 'abc'],
+ ['abc', 'def', "abc-- \r\ndef"],
+ ["abc-- \r\ndef", 'ghi', "abc-- \r\ndef-- \r\nghi"],
+ ];
+ }
+
+}
diff --git a/tests/service/loggertest.php b/tests/Service/LoggerTest.php
index aed360609..387bc7065 100644
--- a/tests/service/loggertest.php
+++ b/tests/Service/LoggerTest.php
@@ -24,9 +24,9 @@ namespace OCA\Mail\Tests\Service;
use Exception;
use OCA\Mail\Service\Logger;
-use Test\TestCase;
+use PHPUnit_Framework_TestCase;
-class LoggerTest extends TestCase {
+class LoggerTest extends PHPUnit_Framework_TestCase {
/**
* @dataProvider providesLoggerMethods
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index f2fb53a2d..d3f97a64b 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -7,6 +7,7 @@
>
<testsuite name='Mail app tests'>
<directory suffix='test.php'>.</directory>
+ <directory suffix='Test.php'>.</directory>
</testsuite>
<!-- filters for code coverage -->
<filter>
diff --git a/tests/service/htmltest.php b/tests/service/htmltest.php
deleted file mode 100644
index 759de5828..000000000
--- a/tests/service/htmltest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * 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\Service;
-
-use OCA\Mail\Service\Html;
-
-class HtmlTest extends \PHPUnit_Framework_TestCase {
-
- /**
- * @dataProvider linkDetectionProvider
- * @param $expected
- * @param $text
- */
- public function testLinkDetection($expected, $text){
- $urlGenerator = \OC::$server->getURLGenerator();
- $request = \OC::$server->getRequest();
- $html = new Html($urlGenerator, $request);
- $withLinks = $html->convertLinks($text);
- $this->assertSame($expected, $withLinks);
- }
-
- public function linkDetectionProvider() {
- return [
- ['abc', 'abc'],
- ['&lt;&gt;', '&lt;&gt;'],
- ['<a href="http://google.com" rel="noreferrer" target="_blank">google.com</a>', 'http://google.com'],
- ['<a href="https://google.com" rel="noreferrer" target="_blank">google.com</a>', 'https://google.com'],
- ['<a href="ftp://google.com" rel="noreferrer" target="_blank">google.com</a>', 'ftp://google.com'],
- ['<a href="http://www.themukt.com/2014/07/23/take-control-cloud-owncloud-7/" rel="noreferrer" target="_blank">www.themukt.com/2014/07/23/take-control-cloud-owncloud-7/</a>', 'http://www.themukt.com/2014/07/23/take-control-cloud-owncloud-7/'],
- ['<a href="https://travis-ci.org/owncloud/music/builds/22037091" rel="noreferrer" target="_blank">travis-ci.org/owncloud/music/builds/22037091</a>', 'https://travis-ci.org/owncloud/music/builds/22037091'],
- ['(<a href="ftp://google.com" rel="noreferrer" target="_blank">google.com</a>)', '(ftp://google.com)'],
- ['<a href="https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1" rel="noreferrer" target="_blank">build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog</a>', 'https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1'],
- ['(<a href="https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1" rel="noreferrer" target="_blank">build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog</a>)', '(https://build.opensuse.org/package/view_file/isv:ownCloud:community:7.0/owncloud/debian.changelog?expand=1)'],
- ['<a href="http://apps.owncloud.com/content/show.php/Music?content=160485" rel="noreferrer" target="_blank">apps.owncloud.com/content/show.php/Music</a>', 'http://apps.owncloud.com/content/show.php/Music?content=160485'],
- ['<a href="https://groups.google.com/forum/#!forum/ctpug" rel="noreferrer" target="_blank">groups.google.com/forum/</a>', 'https://groups.google.com/forum/#!forum/ctpug'],
-// array('<a href="http://www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Da/ps&field-keywords=Fax%2C+Kopierer+scanner+Laser&rh=i%3Aaps%2Ck%3AFax%5Cc+Kopierer+scanner+Laser">www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Daps&field-keywords=Fax%2C+Kopierer+scanner+Laser&rh=i%3Aaps%2Ck%3AFax%5Cc+Kopierer+scanner+Laser</a>', 'http://www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Daps&field-keywords=Fax%2C+Kopierer+scanner+Laser&rh=i%3Aaps%2Ck%3AFax%5Cc+Kopierer+scanner+Laser'),
- ['<a href="https://ci.owncloud.org/job/ownCloud-Documentation(7.0)/504/changes" rel="noreferrer" target="_blank">ci.owncloud.org/job/ownCloud-Documentation(7.0)/504/changes</a>', 'https://ci.owncloud.org/job/ownCloud-Documentation(7.0)/504/changes'],
- ['<a href="https://communities.coverity.com/community/scan-(open-source)/content" rel="noreferrer" target="_blank">communities.coverity.com/community/scan-(open-source)/content</a>', 'https://communities.coverity.com/community/scan-(open-source)/content'],
- ['<a href="https://ma.ellak.gr/events/5%CE%BF%CF%82-%CE%B5%CE%BA%CF%80%CE%B1%CE%B9%CE%B4%CE%B5%CF%85%CF%84%CE%B9%CE%BA%CF%8C%CF%82-%CE%BA%CF%8D%CE%BA%CE%BB%CE%BF%CF%82-%CF%83%CE%B5%CE%BC%CE%B9%CE%BD%CE%B1%CF%81%CE%AF%CF%89%CE%BD-%CE%B5-5/" rel="noreferrer" target="_blank">ma.ellak.gr/events/5ος-εκπαιδευτικός-κύκλος-σεμιναρίων-ε-5/</a>', 'https://ma.ellak.gr/events/5ος-εκπαιδευτικός-κύκλος-σεμιναρίων-ε-5/'],
- ];
- }
-
- /**
- * @dataProvider parseMailBodyProvider
- * @param $expected
- * @param $text
- */
- public function testParseMailBody($expectedBody, $expectedSignature, $text){
- $urlGenerator = \OC::$server->getURLGenerator();
- $request = \OC::$server->getRequest();
- $html = new Html($urlGenerator, $request);
- list($b, $s) = $html->parseMailBody($text);
- $this->assertSame($expectedBody, $b);
- $this->assertSame($expectedSignature, $s);
- }
-
- public function parseMailBodyProvider() {
- return [
- ['abc', null, 'abc'],
- ['abc', 'def', "abc-- \r\ndef"],
- ["abc-- \r\ndef", 'ghi', "abc-- \r\ndef-- \r\nghi"],
- ];
- }
-}