Add tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>master-with-stable11-compat
parent
1a3d2f7e8e
commit
5ca41b2b2b
@ -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
|
@ -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
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
|
||||
*
|
||||
* @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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
|
||||
*
|
||||
* @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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
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();
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<phpunit bootstrap="bootstrap.php"
|
||||
strict="true"
|
||||
verbose="true"
|
||||
timeoutForSmallTests="900"
|
||||
timeoutForMediumTests="900"
|
||||
timeoutForLargeTests="900"
|
||||
>
|
||||
<testsuite name='User_SAML App Tests'>
|
||||
<directory suffix='Test.php'>.</directory>
|
||||
</testsuite>
|
||||
<!-- filters for code coverage -->
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">../../user_saml/appinfo</directory>
|
||||
<directory suffix=".php">../../user_saml/lib</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<!-- and this is where your report will be written -->
|
||||
<log type="coverage-clover" target="./clover.xml"/>
|
||||
</logging>
|
||||
</phpunit>
|
Loading…
Reference in New Issue