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

github.com/nextcloud/tasks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml124
-rw-r--r--Makefile8
-rw-r--r--README.md3
-rw-r--r--package.json5
-rw-r--r--phpunit.integration.xml22
-rw-r--r--phpunit.xml22
-rw-r--r--tests/bootstrap.php12
-rw-r--r--tests/unit/Controller/PageControllerTest.php39
8 files changed, 225 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index a91a398f..75fdef9d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,18 +1,128 @@
dist: trusty
-language: php
-php:
- - 7.0
- - 7.1
- - 7.2
+
+addons:
+ apt:
+ packages:
+ - mysql-server-5.6
+ - mysql-client-core-5.6
+ - mysql-client-5.6
+ - libxml2-utils
branches:
only:
- master
- /^stable\d+(\.\d+)?$/
+cache:
+ directories:
+ - "$HOME/.composer/cache/files"
+ - "$HOME/.npm"
+
+
+env:
+ global:
+ - CORE_BRANCH=master
+ - PHP_COVERAGE=FALSE
+ - DB=mysql
+
+before_install:
+ - php --info
+
+ # Set up DB
+ - if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; fi
+ - if [[ "$DB" == 'mysql' ]]; then mysql -u root -e 'create database oc_autotest;'; fi
+ - if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"; fi
+ - if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "GRANT ALL ON oc_autotest.* TO 'oc_autotest'@'localhost';"; fi
+ - cd ..
+ - git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_BRANCH core
+ - mv tasks core/apps/
+
+before_script:
+ # Set up core
+ - php -f core/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
+
+ # Set up app
+ - php -f core/occ app:enable tasks
+
+ # Enable app twice to check occ errors of registered commands
+ - php -f core/occ app:enable tasks
+ - cd core/apps/tasks
+
+ # Run JS tests
+ - npm install -g npm@latest
+ - make dev-setup
+
+ # XDebug is only needed if we report coverage -> speeds up other builds
+ - if [[ "$PHP_COVERAGE" = "FALSE" ]];
+ then phpenv config-rm xdebug.ini;
+ fi
+
script:
- - make
- - make test
+ # Check info.xml schema validity
+ - wget https://apps.nextcloud.com/schema/apps/info.xsd
+ - xmllint appinfo/info.xml --schema info.xsd --noout
+ - rm info.xsd
+
+ # Check PHP syntax errors
+ - find . -name \*.php -not -path './vendor/*' -exec php -l "{}" \;
+
+ # Run server's app code checker
+ - php ../../occ app:check-code tasks
+
+ # Test php
+ - make test-php
+ - if [[ "$PHP_COVERAGE" = "TRUE" ]];
+ then make test-php-coverage;
+ else make test-php;
+ fi
+
+after_success:
+ - if [[ "$PHP_COVERAGE" = "TRUE" ]];
+ then bash <(curl -s https://codecov.io/bash) -cF php;
+ fi
+
+after_failure:
+ - cat ../../data/nextcloud.log
matrix:
+ include:
+ - stage: build
+ language: node_js
+ node_js:
+ - "10"
+ before_install:
+ before_script:
+ script:
+ - make
+ after_failure:
+ after_success:
+
+ - stage: test
+ language: node_js
+ node_js:
+ - "10"
+
+ before_install:
+ before_script:
+
+ install:
+ - npm install -g codecov
+
+ script:
+ - make dev-setup
+ - make test
+ - bash <(curl -s https://codecov.io/bash) -cF javascript;
+
+ after_failure:
+ after_success:
+
+ - language: php
+ php: 7.1
+
+ - language: php
+ php: 7.2
+
+ - language: php
+ php: 7.3
+ env: "DB=mysql CORE_BRANCH=master PHP_COVERAGE=TRUE"
fast_finish: true
diff --git a/Makefile b/Makefile
index 56e4bbe4..3ba4ab27 100644
--- a/Makefile
+++ b/Makefile
@@ -168,3 +168,11 @@ endif
.PHONY: test
test:
$(npm) run test
+
+test-php:
+ phpunit -c phpunit.xml
+ phpunit -c phpunit.integration.xml
+
+test-php-coverage:
+ phpunit -c phpunit.xml --coverage-clover=coverage-unit.xml
+ phpunit -c phpunit.integration.xml --coverage-clover=coverage-integration.xml
diff --git a/README.md b/README.md
index 0bd0d45f..4a06acb2 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
# Tasks
-
-[![Build Status](https://scrutinizer-ci.com/g/nextcloud/tasks/badges/build.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/tasks/build-status/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nextcloud/tasks/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/tasks/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/nextcloud/tasks/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/tasks/?branch=master)
+![Downloads](https://img.shields.io/github/downloads/nextcloud/tasks/total.svg) [![Build Status](https://scrutinizer-ci.com/g/nextcloud/tasks/badges/build.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/tasks/build-status/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nextcloud/tasks/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/tasks/?branch=master) [![Code coverage](https://img.shields.io/codecov/c/github/nextcloud/tasks.svg)](https://codecov.io/gh/nextcloud/tasks/) [![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&logo=dependabot)](https://dependabot.com)
**A tasks app for [Nextcloud](http://nextcloud.com). Easily sync tasks from various devices with your Nextcloud and edit them online.**
diff --git a/package.json b/package.json
index 87581764..c3686461 100644
--- a/package.json
+++ b/package.json
@@ -109,6 +109,7 @@
"snapshotSerializers": [
"<rootDir>/node_modules/jest-serializer-vue"
],
+ "coverageDirectory": "./coverage/",
"collectCoverage": true,
"collectCoverageFrom": [
"<rootDir>/src/**/*.{js,vue}",
@@ -117,7 +118,9 @@
"coverageReporters": [
"json",
"text",
- "html"
+ "html",
+ "lcov",
+ "clover"
]
}
}
diff --git a/phpunit.integration.xml b/phpunit.integration.xml
new file mode 100644
index 00000000..5e89f0e9
--- /dev/null
+++ b/phpunit.integration.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<phpunit bootstrap="tests/bootstrap.php"
+ verbose="true"
+ colors="true"
+ timeoutForSmallTests="900"
+ timeoutForMediumTests="900"
+ timeoutForLargeTests="900">
+ <testsuite name='Contacts app integration tests'>
+ <directory>./tests/integration</directory>
+ </testsuite>
+ <!-- filters for code coverage -->
+ <filter>
+ <whitelist>
+ <directory suffix=".php">./</directory>
+ <exclude>
+ <directory suffix=".php">./l10n</directory>
+ <directory suffix=".php">./templates</directory>
+ <directory suffix=".php">./tests</directory>
+ </exclude>
+ </whitelist>
+ </filter>
+</phpunit> \ No newline at end of file
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 00000000..9c1553a4
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<phpunit bootstrap="tests/bootstrap.php"
+ verbose="true"
+ colors="true"
+ timeoutForSmallTests="900"
+ timeoutForMediumTests="900"
+ timeoutForLargeTests="900">
+ <testsuite name='Contacts app tests'>
+ <directory>./tests/unit</directory>
+ </testsuite>
+ <!-- filters for code coverage -->
+ <filter>
+ <whitelist>
+ <directory suffix=".php">./</directory>
+ <exclude>
+ <directory suffix=".php">./l10n</directory>
+ <directory suffix=".php">./templates</directory>
+ <directory suffix=".php">./tests</directory>
+ </exclude>
+ </whitelist>
+ </filter>
+</phpunit> \ No newline at end of file
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644
index 00000000..eb3bddc9
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Nextcloud - Tasks
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2016
+ */
+
+require_once __DIR__ . '/../../../tests/bootstrap.php';
diff --git a/tests/unit/Controller/PageControllerTest.php b/tests/unit/Controller/PageControllerTest.php
new file mode 100644
index 00000000..e74a934f
--- /dev/null
+++ b/tests/unit/Controller/PageControllerTest.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Nextcloud - Tasks
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Hendrik Leppelsack <hendrik@leppelsack.de>
+ * @copyright Hendrik Leppelsack 2015
+ */
+
+namespace OCA\Tasks\Controller;
+
+use OCP\AppFramework\Http\TemplateResponse;
+use PHPUnit\Framework\TestCase as Base;
+
+
+class PageControllerTest extends Base {
+
+ private $controller;
+
+ public function setUp(): void {
+ $request = $this->getMockBuilder('OCP\IRequest')->getMock();
+
+ $this->controller = new PageController(
+ 'tasks',
+ $request
+ );
+ }
+
+
+ public function testIndex() {
+ $result = $this->controller->index();
+
+ $this->assertEquals('main', $result->getTemplateName());
+ $this->assertEquals('user', $result->getRenderAs());
+ $this->assertTrue($result instanceof TemplateResponse);
+ }
+}