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:
authorThomas Müller <thomas.mueller@tmit.eu>2015-04-15 12:08:59 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-15 12:08:59 +0300
commit73bef85b0f4420b0f233c105aa4cd138b840328f (patch)
tree58b25db1ef02a815b0d4a25f37b40512c4548ad6
parentb5d04aa5c0b83be85813478b6de96c7e1bc1a693 (diff)
Starting functional tests against a GMail account
-rw-r--r--.travis.yml58
-rw-r--r--tests/imap/abstracttest.php51
-rw-r--r--tests/imap/accounttests.php11
3 files changed, 87 insertions, 33 deletions
diff --git a/.travis.yml b/.travis.yml
index 46351a17c..16c8458ce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,46 +1,38 @@
language: php
php:
- - 5.4
- - 5.5
- - 5.6
-
+- 5.4
+- 5.5
+- 5.6
env:
global:
- - CORE_BRANCH=master
+ - CORE_BRANCH=master
+ - secure: AaTeRG3kL/LeMOcMgul08EUBM7Kdtrkz9EAGPauKdxXbxggP0j5SxN8ciYxc8CiVni0CYJofW07YjG6tXqhvHeMINHx8Q+5KUUfiLwNrLgl1sMkh7vPR9EA5Z1Y8Nz4N1Qt7zxpqWKPHUsjUNFWxP2TPHEq2FEOGeKbsI7GOYas=
+ - secure: S5agbWaWSLgbujsVhZB9WkCAM0ris8uh9hPnspYw48bolkMhknJ7JxOWGV4rOcJ52kdOgifFRE9XYi65RFLL8zuaZDBU2zFoXO3fpatziYEiIWnxVrkogw1pnh/FeRnrUld+QDykFyUcfSGdFRw5R5FuZHrxe+Q5bHfiEjh4hlE=
matrix:
- - DB=sqlite
-
+ - DB=sqlite
branches:
only:
- - master
- - stable7
-
+ - master
+ - stable7
before_install:
- - composer install
- - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
- - bash ./before_install.sh mail $CORE_BRANCH $DB
- - cd ../core
- - php occ app:enable mail
-
+- composer install
+- wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
+- bash ./before_install.sh mail $CORE_BRANCH $DB
+- cd ../core
+- php occ app:enable mail
script:
- # Test lint
- - cd apps/mail
- - sh -c "if [ '$DB' = 'sqlite' ]; then ant test; fi"
-
- # Run phpunit tests
- - cd tests
- - phpunit --configuration phpunit.xml
-
- # Create coverage report
- - wget https://scrutinizer-ci.com/ocular.phar
- - php ocular.phar code-coverage:upload --format=php-clover clover.xml
-
+- cd apps/mail
+- sh -c "if [ '$DB' = 'sqlite' ]; then ant test; fi"
+- cd tests
+- phpunit --configuration phpunit.xml
+- wget https://scrutinizer-ci.com/ocular.phar
+- php ocular.phar code-coverage:upload --format=php-clover clover.xml
matrix:
include:
- - php: 5.4
- env: DB=mysql
- - php: 5.4
- env: DB=pgsql
+ - php: 5.4
+ env: DB=mysql
+ - php: 5.4
+ env: DB=pgsql
allow_failures:
- - php: hhvm
+ - php: hhvm
fast_finish: true
diff --git a/tests/imap/abstracttest.php b/tests/imap/abstracttest.php
new file mode 100644
index 000000000..4aa343cf5
--- /dev/null
+++ b/tests/imap/abstracttest.php
@@ -0,0 +1,51 @@
+<?php
+namespace OCA\Mail\Tests\Imap;
+
+use OCA\Mail\Account;
+use OCA\Mail\Db\MailAccount;
+
+abstract class AbstractTest extends \PHPUnit_Framework_TestCase
+{
+ private static $account;
+
+ public static function setUpBeforeClass() {
+ if (false === \getenv('EMAIL_USERNAME')) {
+ throw new \RuntimeException(
+ 'Please set environment variable EMAIL_USERNAME before running functional tests'
+ );
+ }
+
+ if (false === \getenv('EMAIL_PASSWORD')) {
+ throw new \RuntimeException(
+ 'Please set environment variable EMAIL_PASSWORD before running functional tests'
+ );
+ }
+ $user = \getenv('EMAIL_USERNAME');
+ $password = \getenv('EMAIL_PASSWORD');
+ $a = new MailAccount();
+ $a->setId(-1);
+ $a->setName('ownCloudMail');
+ $a->setInboundHost('imap.gmail.com');
+ $a->setInboundPort(993);
+ $a->setInboundUser($user);
+ $a->setInboundPassword($password);
+ $a->setInboundSslMode('ssl');
+ $a->setEmail($user);
+ $a->setOutboundHost('smtp.gmail.com');
+ $a->setOutboundPort(465);
+ $a->setOutboundUser($user);
+ $a->setOutboundPassword($password);
+ $a->setOutboundSslMode('ssl');
+
+ self::$account = new Account($a);
+ self::$account->getImapConnection();
+ }
+
+ /**
+ * @return Account
+ */
+ protected function getTestAccount() {
+ return self::$account;
+ }
+
+}
diff --git a/tests/imap/accounttests.php b/tests/imap/accounttests.php
new file mode 100644
index 000000000..bb7a53448
--- /dev/null
+++ b/tests/imap/accounttests.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace OCA\Mail\Tests\Imap;
+
+class AccountTests extends AbstractTest {
+
+ public function testListMailBoxes() {
+ $mailBoxes = $this->getTestAccount()->getListArray();
+ $this->assertInternalType('array', $mailBoxes);
+ }
+} \ No newline at end of file