diff --git a/.gitignore b/.gitignore index 581430076b..a5c0fa0f9b 100644 --- a/.gitignore +++ b/.gitignore @@ -94,7 +94,5 @@ RCS/* coverage/ -js/vendor - js/public css/public diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 0d8ef05da6..9b5be0ba17 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,6 +1,5 @@ filter: excluded_paths: - - 'js/vendor/*' - 'js/public/*' - 'l10n/*' @@ -16,4 +15,4 @@ tools: build: tests: override: - - jshint-run --config js/.jshintrc \ No newline at end of file + - jshint-run --config js/.jshintrc diff --git a/.travis.yml b/.travis.yml index bfa722b7a0..a1501c2c33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ before_script: script: - make - - phpunit --version + - make composer || true - make test - make dist # Upload nightly diff --git a/Makefile b/Makefile index a0a2385321..056610b079 100644 --- a/Makefile +++ b/Makefile @@ -31,13 +31,13 @@ # build tools and additional package managers should be installed locally in # your project, since this won't pollute people's global namespace. # -# The following npm scripts in your package.json install and update the bower -# and npm dependencies and use gulp as build system (notice how everything is +# The following npm scripts in your package.json install and update the npm +# dependencies and use gulp as build system (notice how everything is # run from the node_modules folder): # # "scripts": { # "test": "node node_modules/gulp-cli/bin/gulp.js karma", -# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update", +# "prebuild": "npm install", # "build": "node node_modules/gulp-cli/bin/gulp.js" # }, @@ -51,6 +51,10 @@ appstore_artifact_directory=$(CURDIR)/build/artifacts/appstore appstore_package_name=$(appstore_artifact_directory)/$(app_name) yarn=$(shell which yarn 2> /dev/null) gcp=$(shell which gcp 2> /dev/null) +composer:=$(shell which composer 2> /dev/null) +ifeq (,$(composer)) + composer:=php $(build_tools_directory)/composer.phar +endif ifeq (, $(gcp)) copy_command=cp @@ -85,6 +89,18 @@ all: build build: make yarn +# Installs and updates the composer dependencies. If composer is not installed +# a copy is fetched from the web +.PHONY: composer +composer: +ifeq (, $(shell which composer 2> /dev/null)) + @echo "No composer command available, downloading a copy from the web" + mkdir -p $(build_tools_directory) + curl -sS https://getcomposer.org/installer | php + mv composer.phar $(build_tools_directory) +endif + $(composer) install --prefer-dist + # Installs yarn dependencies .PHONY: yarn yarn: @@ -97,13 +113,11 @@ clean: rm -rf css/public rm -rf js/public -# Same as clean but also removes dependencies installed by composer, bower and -# npm +# Same as clean but also removes dependencies installed by composer and npm .PHONY: distclean distclean: clean rm -rf vendor rm -rf node_modules - rm -rf js/vendor rm -rf js/node_modules # Builds the source and appstore package @@ -161,14 +175,8 @@ endif # from the internet .PHONY: test test: - cd js && $(yarn) run test -ifeq (, $(shell which phpunit 2> /dev/null)) - @echo "No phpunit command available, downloading a copy from the web" - mkdir -p $(build_tools_directory) - curl -sSL https://phar.phpunit.de/phpunit.phar -o $(build_tools_directory)/phpunit.phar - php $(build_tools_directory)/phpunit.phar -c phpunit.xml --coverage-clover coverage.clover - # php $(build_tools_directory)/phpunit.phar -c phpunit.integration.xml --coverage-clover build/php-integration.clover -else - phpunit -c phpunit.xml --coverage-clover coverage.clover - # phpunit -c phpunit.integration.xml --coverage-clover build/php-unit.clover +ifndef TRAVIS + make composer endif + cd js && $(yarn) run test && cd ../ + export PATH="$$PWD/vendor/bin:$$PATH" && phpunit -c phpunit.xml --coverage-clover coverage.clover diff --git a/composer.json b/composer.json new file mode 100644 index 0000000000..0bfa069f93 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "phpunit/phpunit": "^6.5" + } +} diff --git a/js/.bowerrc b/js/.bowerrc deleted file mode 100644 index b579418bf6..0000000000 --- a/js/.bowerrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "directory": "vendor", - "ignoredDependencies": [ - "jquery", - "moment" - ] -} diff --git a/js/bower.json b/js/bower.json deleted file mode 100644 index ffff57f3d5..0000000000 --- a/js/bower.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "nextcloud-calendar", - "dependencies": { - "angular": "1.7.2", - "angular-bootstrap": "2.5.0", - "jquery-timepicker": "883bb2cd94", - "jstzdetect": "https://github.com/georgehrke/jstimezonedetect.git", - "ical.js": "1.2.2", - "fullcalendar": "3.9.0", - "hsl_rgb_converter": "https://github.com/kayellpeee/hsl_rgb_converter.git" - }, - "devDependencies": { - "angular-mocks": "1.7.2" - } -} diff --git a/js/gulpfile.js b/js/gulpfile.js index d21ff2a438..f45a6e2441 100644 --- a/js/gulpfile.js +++ b/js/gulpfile.js @@ -56,21 +56,21 @@ const cssSources = [ '../css/app/*.scss' ]; const vendorSources = [ - 'vendor/angular/angular.js', - 'vendor/angular-bootstrap/ui-bootstrap-tpls.js', - 'vendor/fullcalendar/dist/fullcalendar.js', - 'vendor/fullcalendar/dist/locale-all.js', + 'node_modules/angular/angular.js', + 'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js', + 'node_modules/fullcalendar/dist/fullcalendar.js', + 'node_modules/fullcalendar/dist/locale-all.js', 'licenses/hsl_rgb_converter.js', - 'vendor/hsl_rgb_converter/converter.js', - 'vendor/ical.js/build/ical.js', - 'vendor/jquery-timepicker/jquery.ui.timepicker.js', - 'vendor/jstzdetect/dist/jstz.js', + 'node_modules/hsl_rgb_converter/converter.js', + 'node_modules/ical.js/build/ical.js', + 'node_modules/jquery-timepicker/jquery.ui.timepicker.js', + 'node_modules/jstzdetect/dist/jstz.js', ]; const vendorCssSources = [ - 'vendor/fullcalendar/dist/fullcalendar.css', - 'vendor/angular/angular-csp.css', + 'node_modules/fullcalendar/dist/fullcalendar.css', + 'node_modules/angular/angular-csp.css', 'licenses/jquery.timepicker.css', - 'vendor/jquery-timepicker/jquery.ui.timepicker.css' + 'node_modules/jquery-timepicker/jquery.ui.timepicker.css' ]; const testSources = ['../tests/js/unit/**/*.js']; diff --git a/js/package.json b/js/package.json index 743b1f6179..dc99d874d1 100644 --- a/js/package.json +++ b/js/package.json @@ -5,7 +5,7 @@ "homepage": "https://github.com/nextcloud/calendar", "scripts": { "test": "node node_modules/gulp-cli/bin/gulp.js karma", - "prebuild": "yarn && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update", + "prebuild": "yarn", "build": "node node_modules/gulp-cli/bin/gulp.js" }, "repository": { @@ -16,10 +16,10 @@ "url": "https://github.com/nextcloud/calendar/issues" }, "devDependencies": { + "angular-mocks": "^1.7.2", "babel-core": "^6.26.3", "babel-polyfill": "^6.26.0", "babel-preset-es2015": "^6.24.1", - "bower": "^1.8.4", "coveralls": "^3.0.2", "gulp": "^3.9.1", "gulp-babel": "^7.0.1", @@ -51,5 +51,14 @@ }, "engines": { "node": ">=6" + }, + "dependencies": { + "angular": "^1.7.2", + "angular-ui-bootstrap": "^2.5.0", + "fullcalendar": "^3.9.0", + "hsl_rgb_converter": "kayellpeee/hsl_rgb_converter", + "ical.js": "^1.2.2", + "jquery-timepicker": "fgelinas/timepicker#883bb2cd94", + "jstzdetect": "georgehrke/jstimezonedetect" } } diff --git a/js/yarn.lock b/js/yarn.lock index 0d1188a43f..032b28dddf 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -117,6 +117,18 @@ amqplib@^0.5.2: readable-stream "1.x >=1.1.9" safe-buffer "^5.0.1" +angular-mocks@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.7.2.tgz#8a2bc7a7ce355697a48ab00e548b88e78f71fa52" + +angular-ui-bootstrap@^2.5.0: + version "2.5.6" + resolved "https://registry.yarnpkg.com/angular-ui-bootstrap/-/angular-ui-bootstrap-2.5.6.tgz#23937322ec641a6fbee16498cc32452aa199e7c5" + +angular@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/angular/-/angular-1.7.2.tgz#687b955dbe5c533f8d73460461707af00360251f" + ansi-colors@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9" @@ -856,10 +868,6 @@ boom@2.x.x: dependencies: hoek "2.x.x" -bower@^1.8.4: - version "1.8.4" - resolved "https://registry.yarnpkg.com/bower/-/bower-1.8.4.tgz#e7876a076deb8137f7d06525dc5e8c66db82f28a" - brace-expansion@^1.0.0, brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -2142,6 +2150,13 @@ ftp@~0.3.10: readable-stream "1.1.x" xregexp "2.0.0" +fullcalendar@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-3.9.0.tgz#b608a9989f3416f0b1d526c6bdfeeaf2ac79eda5" + dependencies: + jquery "2 - 3" + moment "^2.20.1" + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -2712,6 +2727,10 @@ hosted-git-info@^2.1.4: version "2.6.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.1.tgz#6e4cee78b01bb849dcf93527708c69fdbee410df" +hsl_rgb_converter@kayellpeee/hsl_rgb_converter: + version "1.0.0" + resolved "https://codeload.github.com/kayellpeee/hsl_rgb_converter/tar.gz/3936a3896dd2f45a5c66317aab6f9175c9fde9fb" + html-tags@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-2.0.0.tgz#10b30a386085f43cede353cc8fa7cb0deeea668b" @@ -2795,6 +2814,10 @@ https-proxy-agent@^2.2.1: agent-base "^4.1.0" debug "^3.1.0" +ical.js@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/ical.js/-/ical.js-1.2.2.tgz#59b517362a8f61dce0342fe67deb7c20dd119f6e" + iconv-lite@0.4.15: version "0.4.15" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" @@ -3231,6 +3254,14 @@ jasmine-core@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.1.0.tgz#a4785e135d5df65024dfc9224953df585bd2766c" +jquery-timepicker@fgelinas/timepicker#883bb2cd94: + version "0.0.0" + resolved "https://codeload.github.com/fgelinas/timepicker/tar.gz/883bb2cd94ce65bc2a0a707b0c5911baf6de4ad4" + +"jquery@2 - 3": + version "3.3.1" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" + js-base64@^2.1.9: version "2.4.5" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.5.tgz#e293cd3c7c82f070d700fc7a1ca0a2e69f101f92" @@ -3325,6 +3356,10 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +jstzdetect@georgehrke/jstimezonedetect: + version "1.0.6" + resolved "https://codeload.github.com/georgehrke/jstimezonedetect/tar.gz/d90d861a98a30a802cb1f4c7864854fe3a583134" + karma-coverage@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/karma-coverage/-/karma-coverage-1.1.2.tgz#cc09dceb589a83101aca5fe70c287645ef387689" @@ -3955,6 +3990,10 @@ mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" +moment@^2.20.1: + version "2.22.2" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66" + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b0be2506df..b8463fd05b 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -23,7 +23,7 @@ \OC_App::loadApp('calendar'); } -if(!class_exists('PHPUnit_Framework_TestCase')) { +if(!class_exists('PHPUnit\Framework\TestCase')) { require_once('PHPUnit/Autoload.php'); } diff --git a/tests/js/config/karma.js b/tests/js/config/karma.js index 0fc4fe2936..aaaff58d24 100644 --- a/tests/js/config/karma.js +++ b/tests/js/config/karma.js @@ -33,12 +33,12 @@ module.exports = function (config) { '../../core/vendor/moment/min/moment-with-locales.js', '../../core/vendor/moment/min/moment-with-locales.min.js', '../../core/vendor/davclient.js/lib/client.js', - 'js/vendor/jstzdetect/dist/jstz.min.js', - 'js/vendor/fullcalendar/dist/fullcalendar.min.js', - 'js/vendor/angular/angular.js', - 'js/vendor/angular-mocks/angular-mocks.js', - 'js/vendor/ical.js/build/ical.js', - 'js/vendor/hsl_rgb_converter/converter.js', + 'js/node_modules/jstzdetect/dist/jstz.min.js', + 'js/node_modules/fullcalendar/dist/fullcalendar.min.js', + 'js/node_modules/angular/angular.js', + 'js/node_modules/angular-mocks/angular-mocks.js', + 'js/node_modules/ical.js/build/ical.js', + 'js/node_modules/hsl_rgb_converter/converter.js', 'tests/js/stubs/app.js', 'js/app/**/*.js', 'tests/js/unit/**/*.js' diff --git a/tests/php/controller/contactcontrollerTest.php b/tests/php/controller/contactcontrollerTest.php index e2b491e88a..6f8b0d9ddd 100644 --- a/tests/php/controller/contactcontrollerTest.php +++ b/tests/php/controller/contactcontrollerTest.php @@ -21,7 +21,9 @@ */ namespace OCA\Calendar\Controller; -class ContactControllerTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class ContactControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/php/controller/emailcontrollerTest.php b/tests/php/controller/emailcontrollerTest.php index 5a917c97ed..d6c3ee37e8 100644 --- a/tests/php/controller/emailcontrollerTest.php +++ b/tests/php/controller/emailcontrollerTest.php @@ -21,7 +21,9 @@ */ namespace OCA\Calendar\Controller; -class EmailControllerTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class EmailControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/php/controller/proxycontrollerTest.php b/tests/php/controller/proxycontrollerTest.php index 872aa52f63..03b2fef9ac 100644 --- a/tests/php/controller/proxycontrollerTest.php +++ b/tests/php/controller/proxycontrollerTest.php @@ -21,11 +21,12 @@ */ namespace OCA\Calendar\Controller; +use PHPUnit\Framework\TestCase; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ConnectException; -class ProxyControllerTest extends \PHPUnit_Framework_TestCase { +class ProxyControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/php/controller/settingscontrollerTest.php b/tests/php/controller/settingscontrollerTest.php index 0f8b3566d3..fecbd34f7e 100755 --- a/tests/php/controller/settingscontrollerTest.php +++ b/tests/php/controller/settingscontrollerTest.php @@ -21,7 +21,9 @@ */ namespace OCA\Calendar\Controller; -class SettingsControllerTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class SettingsControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/php/controller/viewcontrollerTest.php b/tests/php/controller/viewcontrollerTest.php index 62645a3f50..0baed8e4df 100755 --- a/tests/php/controller/viewcontrollerTest.php +++ b/tests/php/controller/viewcontrollerTest.php @@ -22,7 +22,9 @@ namespace OCA\Calendar\Controller; -class ViewControllerTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class ViewControllerTest extends TestCase { private $appName; private $request; diff --git a/tests/php/http/streamresponseTest.php b/tests/php/http/streamresponseTest.php index fa56c4e48d..f731b67da1 100644 --- a/tests/php/http/streamresponseTest.php +++ b/tests/php/http/streamresponseTest.php @@ -21,7 +21,9 @@ */ namespace OCA\Calendar\Http; -class StreamResponseTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class StreamResponseTest extends TestCase { public function setUp() { @@ -38,4 +40,4 @@ public function testCallback() { $streamResponse = new StreamResponse($stream); $streamResponse->callback($ioutput); } -} \ No newline at end of file +}