diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..de4d20c
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,109 @@
+pipeline:
+ clone:
+ image: plugins/git
+ depth: 1
+ check-app-compatbility:
+ image: nextcloudci/php5.6:php5.6-3
+ environment:
+ - APP_NAME=user_saml
+ - CORE_BRANCH=master
+ - DB=sqlite
+ commands:
+ # Pre-setup steps
+ - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
+ - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
+ - cd ../server
+
+ # Code checker
+ - ./occ app:check-code $APP_NAME -c strong-comparison
+ - ./occ app:check-code $APP_NAME -c deprecation
+ - cd apps/$APP_NAME/
+ when:
+ matrix:
+ TESTS: check-app-compatbility
+ signed-off-check:
+ image: nextcloudci/php7.0:php7.0-2
+ environment:
+ - APP_NAME=user_saml
+ - CORE_BRANCH=master
+ - DB=sqlite
+ commands:
+ # Pre-setup steps
+ - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
+ - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
+ - cd ../server
+ - php ./build/signed-off-checker.php
+ when:
+ matrix:
+ TESTS: signed-off-check
+ php5.6:
+ image: nextcloudci/php5.6:php5.6-3
+ environment:
+ - APP_NAME=user_saml
+ - CORE_BRANCH=master
+ - DB=sqlite
+ commands:
+ - apt update && apt-get -y install php5-xdebug
+
+ # Pre-setup steps
+ - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
+ - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
+ - cd ../server/apps/$APP_NAME
+
+ # 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
+ when:
+ matrix:
+ TESTS: php5.6
+ php7.0:
+ image: nextcloudci/php7.0:php7.0-2
+ environment:
+ - APP_NAME=user_saml
+ - CORE_BRANCH=master
+ - DB=sqlite
+ commands:
+ # Pre-setup steps
+ - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
+ - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
+ - cd ../server/apps/$APP_NAME
+
+ # Run phpunit tests
+ - cd tests/
+ - phpunit --configuration phpunit.xml
+ when:
+ matrix:
+ TESTS: php7.0
+ php7.1:
+ image: nextcloudci/php7.1:php7.1-3
+ environment:
+ - APP_NAME=user_saml
+ - CORE_BRANCH=master
+ - DB=sqlite
+ commands:
+ # FIXME: Move into Docker image
+ - yum -y install wget
+
+ # Pre-setup steps
+ - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
+ - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
+ - cd ../server/apps/$APP_NAME
+
+ # Run phpunit tests
+ - cd tests/
+ - phpunit --configuration phpunit.xml
+ when:
+ matrix:
+ TESTS: php7.1
+
+matrix:
+ include:
+ - TESTS: php5.6
+ - TESTS: php7.0
+ - TESTS: php7.1
+ - TESTS: check-app-compatbility
+ - TESTS: signed-off-check
\ No newline at end of file
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 0000000..bc1bdbe
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,14 @@
+filter:
+ excluded_paths:
+ - '3rdparty/*'
+ - 'js/jquery*'
+ - 'l10n/*'
+ - 'tests/*'
+
+imports:
+ - javascript
+ - php
+
+tools:
+ external_code_coverage:
+ timeout: 7200 # Timeout in seconds: 2 hours
diff --git a/tests/Settings/SectionTest.php b/tests/Settings/SectionTest.php
new file mode 100644
index 0000000..cb2a822
--- /dev/null
+++ b/tests/Settings/SectionTest.php
@@ -0,0 +1,56 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCA\User_SAML\Tests\Settings;
+
+class SectionTest extends \Test\TestCase {
+ /** @var \OCA\User_SAML\Settings\Section */
+ private $section;
+ /** @var \OCP\IL10N */
+ private $l10n;
+
+ public function setUp() {
+ $this->l10n = $this->createMock(\OCP\IL10N::class);
+ $this->section = new \OCA\User_SAML\Settings\Section(
+ $this->l10n
+ );
+
+ return parent::setUp();
+ }
+
+ public function testGetId() {
+ $this->assertSame('saml', $this->section->getID());
+ }
+
+ public function testGetName() {
+ $this->l10n
+ ->expects($this->once())
+ ->method('t')
+ ->with('SAML authentication')
+ ->willReturn('SAML authentication');
+
+ $this->assertSame('SAML authentication', $this->section->getName());
+ }
+
+ public function testGetPriority() {
+ $this->assertSame(75, $this->section->getPriority());
+ }
+}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644
index 0000000..a2d4a5b
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1,31 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see .
+ *
+ */
+
+if (!defined('PHPUNIT_RUN')) {
+ define('PHPUNIT_RUN', 1);
+}
+require_once __DIR__.'/../../../lib/base.php';
+\OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests');
+\OC_App::loadApp('user_saml');
+if(!class_exists('PHPUnit_Framework_TestCase')) {
+ require_once('PHPUnit/Autoload.php');
+}
+OC_Hook::clear();
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
new file mode 100644
index 0000000..52c359a
--- /dev/null
+++ b/tests/phpunit.xml
@@ -0,0 +1,23 @@
+
+
+
+ .
+
+
+
+
+ ../../user_saml/appinfo
+ ../../user_saml/lib
+
+
+
+
+
+
+