зеркало из https://github.com/nextcloud/news.git
Command: Add unittests
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
This commit is contained in:
Родитель
47104a1971
Коммит
c5daf112be
|
@ -1,8 +1,8 @@
|
|||
# Authors
|
||||
* [Bernhard Posselt](mailto:dev@bernhard-posselt.com)
|
||||
* [Alessandro Cosentino](mailto:cosenal@gmail.com)
|
||||
* [Robin Appelman](mailto:icewind@owncloud.com)
|
||||
* [Benjamin Brahmer](mailto:info@b-brahmer.de)
|
||||
* [Robin Appelman](mailto:icewind@owncloud.com)
|
||||
* [Gregor Tätzner](mailto:gregor@freenet.de)
|
||||
* [Morris Jobke](mailto:hey@morrisjobke.de)
|
||||
* [Sean Molenaar](mailto:SMillerDev@users.noreply.github.com)
|
||||
|
@ -43,6 +43,7 @@
|
|||
* [Andreas Fischer](mailto:bantu@owncloud.com)
|
||||
* [David Guillot](mailto:david@guillot.me)
|
||||
* [Gioele Falcetti](mailto:thegio.f@gmail.com)
|
||||
* [Igor Bubelov](mailto:igor@bubelov.com)
|
||||
* [Jan C. Borchardt](mailto:hey@jancborchardt.net)
|
||||
* [John Kristensen](mailto:john@jerrykan.com)
|
||||
* [Konrad Graefe](mailto:konradgraefe@aol.com)
|
||||
|
|
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## Unreleased
|
||||
- Added changelog enforcer action
|
||||
- Unittest commands and utilities
|
||||
|
||||
## 15.0.6
|
||||
|
||||
|
|
|
@ -57,6 +57,10 @@
|
|||
"html",
|
||||
"readability"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/andreskrey/readability.php/issues",
|
||||
"source": "https://github.com/andreskrey/readability.php/tree/v2.1.0"
|
||||
},
|
||||
"time": "2019-07-22T21:42:25+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -110,6 +114,11 @@
|
|||
"finder",
|
||||
"icon"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ArthurHoaro/favicon/issues",
|
||||
"source": "https://github.com/ArthurHoaro/favicon/tree/v1.3.1",
|
||||
"sources": "https://github.com/ArthurHoaro/favicon"
|
||||
},
|
||||
"time": "2020-10-14T09:32:44+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -173,6 +182,10 @@
|
|||
"news",
|
||||
"rss"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/alexdebril/feed-io/issues",
|
||||
"source": "https://github.com/alexdebril/feed-io/tree/v4.7.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/alexdebril",
|
||||
|
@ -229,6 +242,10 @@
|
|||
"keywords": [
|
||||
"html"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ezyang/htmlpurifier/issues",
|
||||
"source": "https://github.com/ezyang/htmlpurifier/tree/master"
|
||||
},
|
||||
"time": "2020-06-29T00:56:53+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -293,6 +310,10 @@
|
|||
"uri",
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://pear.php.net/bugs/search.php?cmd=display&package_name[]=Net_URL2",
|
||||
"source": "https://github.com/pear/Net_URL2"
|
||||
},
|
||||
"time": "2017-08-25T06:16:11+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -340,6 +361,9 @@
|
|||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/log/tree/1.1.3"
|
||||
},
|
||||
"time": "2020-03-23T09:12:05+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -390,20 +414,24 @@
|
|||
"path",
|
||||
"system"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Riimu/Kit-PathJoin/issues",
|
||||
"source": "https://github.com/Riimu/Kit-PathJoin/tree/master"
|
||||
},
|
||||
"time": "2017-07-09T14:41:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.5.6",
|
||||
"version": "3.5.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||
"reference": "e97627871a7eab2f70e59166072a6b767d5834e0"
|
||||
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0",
|
||||
"reference": "e97627871a7eab2f70e59166072a6b767d5834e0",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
|
||||
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -441,7 +469,12 @@
|
|||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2020-08-10T04:50:15+00:00"
|
||||
"support": {
|
||||
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
||||
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
||||
},
|
||||
"time": "2020-10-23T02:01:07+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
@ -499,6 +532,10 @@
|
|||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/instantiator/issues",
|
||||
"source": "https://github.com/doctrine/instantiator/tree/1.3.x"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
|
@ -561,6 +598,10 @@
|
|||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.x"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
|
@ -622,6 +663,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/manifest/issues",
|
||||
"source": "https://github.com/phar-io/manifest/tree/master"
|
||||
},
|
||||
"time": "2018-07-08T19:23:20+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -669,6 +714,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Library for handling version information and constraints",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/version/issues",
|
||||
"source": "https://github.com/phar-io/version/tree/master"
|
||||
},
|
||||
"time": "2018-07-08T19:19:57+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -718,6 +767,10 @@
|
|||
"reflection",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
|
||||
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
|
||||
},
|
||||
"time": "2020-06-27T09:03:43+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -770,6 +823,10 @@
|
|||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
||||
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master"
|
||||
},
|
||||
"time": "2020-09-03T19:13:55+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -815,6 +872,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
|
||||
},
|
||||
"time": "2020-09-17T18:55:26+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -878,6 +939,10 @@
|
|||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpspec/prophecy/issues",
|
||||
"source": "https://github.com/phpspec/prophecy/tree/1.12.1"
|
||||
},
|
||||
"time": "2020-09-29T09:10:42+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -920,6 +985,10 @@
|
|||
"MIT"
|
||||
],
|
||||
"description": "PHPStan - PHP Static Analysis Tool",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||
"source": "https://github.com/phpstan/phpstan/tree/0.12.52"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ondrejmirtes",
|
||||
|
@ -998,6 +1067,10 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/8.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1054,6 +1127,10 @@
|
|||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1113,6 +1190,10 @@
|
|||
"keywords": [
|
||||
"process"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-invoker/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1123,16 +1204,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
||||
"reference": "18c887016e60e52477e54534956d7b47bc52cd84"
|
||||
"reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/18c887016e60e52477e54534956d7b47bc52cd84",
|
||||
"reference": "18c887016e60e52477e54534956d7b47bc52cd84",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
|
||||
"reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1168,26 +1249,30 @@
|
|||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T06:03:05+00:00"
|
||||
"time": "2020-10-26T05:33:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
"version": "5.0.2",
|
||||
"version": "5.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
||||
"reference": "c9ff14f493699e2f6adee9fd06a0245b276643b7"
|
||||
"reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/c9ff14f493699e2f6adee9fd06a0245b276643b7",
|
||||
"reference": "c9ff14f493699e2f6adee9fd06a0245b276643b7",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
|
||||
"reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1223,13 +1308,17 @@
|
|||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T06:00:25+00:00"
|
||||
"time": "2020-10-26T13:16:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
|
@ -1278,6 +1367,10 @@
|
|||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1373,6 +1466,10 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.2.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://phpunit.de/donate.html",
|
||||
|
@ -1387,16 +1484,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/code-unit",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/code-unit.git",
|
||||
"reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab"
|
||||
"reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/59236be62b1bb9919e6d7f60b0b832dc05cef9ab",
|
||||
"reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120",
|
||||
"reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1429,13 +1526,17 @@
|
|||
],
|
||||
"description": "Collection of value objects that represent the PHP code units",
|
||||
"homepage": "https://github.com/sebastianbergmann/code-unit",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/code-unit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-02T14:47:54+00:00"
|
||||
"time": "2020-10-26T13:08:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
|
@ -1480,6 +1581,10 @@
|
|||
],
|
||||
"description": "Looks up which function or method a line of code belongs to",
|
||||
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
|
||||
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1490,16 +1595,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
"version": "4.0.5",
|
||||
"version": "4.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||
"reference": "7a8ff306445707539c1a6397372a982a1ec55120"
|
||||
"reference": "55f4261989e546dc112258c7a75935a81a7ce382"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/7a8ff306445707539c1a6397372a982a1ec55120",
|
||||
"reference": "7a8ff306445707539c1a6397372a982a1ec55120",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382",
|
||||
"reference": "55f4261989e546dc112258c7a75935a81a7ce382",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1550,26 +1655,30 @@
|
|||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-30T06:47:25+00:00"
|
||||
"time": "2020-10-26T15:49:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "ffc949a1a2aae270ea064453d7535b82e4c32092"
|
||||
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ffc949a1a2aae270ea064453d7535b82e4c32092",
|
||||
"reference": "ffc949a1a2aae270ea064453d7535b82e4c32092",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d",
|
||||
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1612,13 +1721,17 @@
|
|||
"unidiff",
|
||||
"unified diff"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T05:32:55+00:00"
|
||||
"time": "2020-10-26T13:10:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
|
@ -1671,6 +1784,10 @@
|
|||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/environment/issues",
|
||||
"source": "https://github.com/sebastianbergmann/environment/tree/5.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1744,6 +1861,10 @@
|
|||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -1804,20 +1925,24 @@
|
|||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/global-state/issues",
|
||||
"source": "https://github.com/sebastianbergmann/global-state/tree/master"
|
||||
},
|
||||
"time": "2020-02-07T06:11:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/object-enumerator",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
|
||||
"reference": "f6f5957013d84725427d361507e13513702888a4"
|
||||
"reference": "5c9eeac41b290a3712d88851518825ad78f45c71"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f6f5957013d84725427d361507e13513702888a4",
|
||||
"reference": "f6f5957013d84725427d361507e13513702888a4",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71",
|
||||
"reference": "5c9eeac41b290a3712d88851518825ad78f45c71",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1851,26 +1976,30 @@
|
|||
],
|
||||
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T05:55:06+00:00"
|
||||
"time": "2020-10-26T13:12:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/object-reflector",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/object-reflector.git",
|
||||
"reference": "d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5"
|
||||
"reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5",
|
||||
"reference": "d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
|
||||
"reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1902,26 +2031,30 @@
|
|||
],
|
||||
"description": "Allows reflection of object attributes, including inherited and non-public ones",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
|
||||
"source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T05:56:16+00:00"
|
||||
"time": "2020-10-26T13:14:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
||||
"reference": "ed8c9cd355089134bc9cba421b5cfdd58f0eaef7"
|
||||
"reference": "cd9d8cf3c5804de4341c283ed787f099f5506172"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/ed8c9cd355089134bc9cba421b5cfdd58f0eaef7",
|
||||
"reference": "ed8c9cd355089134bc9cba421b5cfdd58f0eaef7",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172",
|
||||
"reference": "cd9d8cf3c5804de4341c283ed787f099f5506172",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1961,13 +2094,17 @@
|
|||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
|
||||
"source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T05:17:32+00:00"
|
||||
"time": "2020-10-26T13:17:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/resource-operations",
|
||||
|
@ -2012,6 +2149,10 @@
|
|||
],
|
||||
"description": "Provides a list of PHP built-in functions that operate on resources",
|
||||
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
|
||||
"source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -2022,16 +2163,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/type",
|
||||
"version": "2.3.0",
|
||||
"version": "2.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/type.git",
|
||||
"reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909"
|
||||
"reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fa592377f3923946cb90bf1f6a71ba2e5f229909",
|
||||
"reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2",
|
||||
"reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2064,13 +2205,17 @@
|
|||
],
|
||||
"description": "Collection of value objects that represent the types of the PHP type system",
|
||||
"homepage": "https://github.com/sebastianbergmann/type",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/type/issues",
|
||||
"source": "https://github.com/sebastianbergmann/type/tree/2.3.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-06T08:41:03+00:00"
|
||||
"time": "2020-10-26T13:18:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
|
@ -2113,6 +2258,10 @@
|
|||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/version/issues",
|
||||
"source": "https://github.com/sebastianbergmann/version/tree/3.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -2123,20 +2272,20 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.18.1",
|
||||
"version": "v1.20.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
|
||||
"reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
|
||||
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41",
|
||||
"reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
|
@ -2144,7 +2293,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
"dev-main": "1.20-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
|
@ -2181,6 +2330,9 @@
|
|||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -2195,7 +2347,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
|
@ -2235,6 +2387,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
|
||||
"support": {
|
||||
"issues": "https://github.com/theseer/tokenizer/issues",
|
||||
"source": "https://github.com/theseer/tokenizer/tree/master"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/theseer",
|
||||
|
@ -2290,6 +2446,10 @@
|
|||
"check",
|
||||
"validate"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webmozart/assert/issues",
|
||||
"source": "https://github.com/webmozart/assert/tree/master"
|
||||
},
|
||||
"time": "2020-07-08T17:02:28+00:00"
|
||||
}
|
||||
],
|
||||
|
@ -2307,5 +2467,5 @@
|
|||
"ext-curl": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class FeedAdd extends Command
|
|||
{
|
||||
$this->setName('news:feed:add')
|
||||
->setDescription('Add a feed')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User to add the feed for')
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User to add the feed for')
|
||||
->addArgument('feed', InputArgument::REQUIRED, 'Feed to parse')
|
||||
->addOption('folder', null, InputOption::VALUE_OPTIONAL, 'Folder ID')
|
||||
->addOption('title', null, InputOption::VALUE_OPTIONAL, 'Feed title')
|
||||
|
@ -54,13 +54,13 @@ class FeedAdd extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$url = $input->getArgument('feed');
|
||||
$user = $input->getArgument('userID');
|
||||
$folder = (int) $input->getOption('folder') ?? 0;
|
||||
$title = $input->getOption('title');
|
||||
$username = $input->getOption('username');
|
||||
$full_text = $input->getOption('full-text');
|
||||
$password = $input->getOption('password');
|
||||
$user = $input->getArgument('user-id');
|
||||
$url = $input->getArgument('feed');
|
||||
$folder = (int) $input->getOption('folder') ?? 0;
|
||||
$title = $input->getOption('title');
|
||||
$full_text = (bool) $input->getOption('full-text');
|
||||
$username = $input->getOption('username');
|
||||
$password = $input->getOption('password');
|
||||
|
||||
$feed = $this->feedService->create($user, $url, $folder, $full_text, $title, $username, $password);
|
||||
$this->feedService->fetch($feed);
|
||||
|
|
|
@ -32,8 +32,8 @@ class FeedDelete extends Command
|
|||
{
|
||||
$this->setName('news:feed:delete')
|
||||
->setDescription('Remove a feed')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User to remove the feed from')
|
||||
->addArgument('id', InputArgument::REQUIRED, 'Feed ID', null);
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User to remove the feed from')
|
||||
->addArgument('feed-id', InputArgument::REQUIRED, 'Feed ID', null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,8 @@ class FeedDelete extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$user = $input->getArgument('userID');
|
||||
$id = $input->getArgument('id');
|
||||
$user = $input->getArgument('user-id');
|
||||
$id = $input->getArgument('feed-id');
|
||||
|
||||
$this->feedService->delete($user, $id);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class FeedList extends Command
|
|||
{
|
||||
$this->setName('news:feed:list')
|
||||
->setDescription('List all feeds')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User to list the feeds for')
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User to list the feeds for')
|
||||
->addOption('recursive', null, InputOption::VALUE_NONE, 'Fetch the feed recursively');
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class FeedList extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$user = $input->getArgument('userID');
|
||||
$user = $input->getArgument('user-id');
|
||||
$recursive = $input->getOption('recursive');
|
||||
|
||||
if ($recursive !== false) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class FolderAdd extends Command
|
|||
{
|
||||
$this->setName('news:folder:add')
|
||||
->setDescription('Add a folder')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User to add the folder for')
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User to add the folder for')
|
||||
->addArgument('name', InputArgument::REQUIRED, 'Folder name', null)
|
||||
->addOption('parent', null, InputOption::VALUE_OPTIONAL, 'Parent folder');
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ class FolderAdd extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$user = $input->getArgument('userID');
|
||||
$user = $input->getArgument('user-id');
|
||||
$name = $input->getArgument('name');
|
||||
$parent = $input->getOption('parent') ?? 0;
|
||||
$parent = (int) $input->getOption('parent') ?? 0;
|
||||
|
||||
$this->folderService->create($user, $name, $parent);
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ class FolderDelete extends Command
|
|||
{
|
||||
$this->setName('news:folder:delete')
|
||||
->setDescription('Remove a folder')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User to remove the folder from')
|
||||
->addArgument('id', InputArgument::REQUIRED, 'Folder ID', null);
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User to remove the folder from')
|
||||
->addArgument('folder-id', InputArgument::REQUIRED, 'Folder ID', null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,8 +47,8 @@ class FolderDelete extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$user = $input->getArgument('userID');
|
||||
$id = $input->getArgument('id');
|
||||
$user = $input->getArgument('user-id');
|
||||
$id = $input->getArgument('folder-id');
|
||||
|
||||
if ($id === '0') {
|
||||
throw new ServiceException('Can not remove root folder!');
|
||||
|
|
|
@ -34,7 +34,7 @@ class FolderList extends Command
|
|||
{
|
||||
$this->setName('news:folder:list')
|
||||
->setDescription('List all folders')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User to list the folders for')
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User to list the folders for')
|
||||
->addOption('recursive', null, InputOption::VALUE_NONE, 'Fetch the folder recursively');
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class FolderList extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$user = $input->getArgument('userID');
|
||||
$user = $input->getArgument('user-id');
|
||||
$recursive = $input->getOption('recursive');
|
||||
|
||||
if ($recursive !== false) {
|
||||
|
|
|
@ -29,7 +29,7 @@ class OpmlExport extends Command
|
|||
{
|
||||
$this->setName('news:opml:export')
|
||||
->setDescription('Print OPML file')
|
||||
->addArgument('userID', InputArgument::REQUIRED, 'User data to export');
|
||||
->addArgument('user-id', InputArgument::REQUIRED, 'User data to export');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class OpmlExport extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$user = $input->getArgument('userID');
|
||||
$user = $input->getArgument('user-id');
|
||||
|
||||
$output->write($this->opmlService->export($user));
|
||||
return 0;
|
||||
|
|
|
@ -10,18 +10,7 @@
|
|||
*/
|
||||
namespace OCA\News\Command;
|
||||
|
||||
use FeedIo\FeedIo;
|
||||
use Favicon\Favicon;
|
||||
|
||||
use HTMLPurifier;
|
||||
use OCA\News\Db\FeedMapper;
|
||||
use OCA\News\Db\ItemMapper;
|
||||
use OCA\News\Fetcher\Fetcher;
|
||||
use OCA\News\Service\FeedService;
|
||||
use OCA\News\Utility\Time;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
@ -80,13 +69,15 @@ class ShowFeed extends Command
|
|||
|
||||
try {
|
||||
list($feed, $items) = $this->feedFetcher->fetch($url, true, null, $fullTextEnabled, $user, $password);
|
||||
$output->writeln("Feed: " . json_encode($feed, JSON_PRETTY_PRINT));
|
||||
$output->writeln("Items: " . json_encode($items, JSON_PRETTY_PRINT));
|
||||
return 0;
|
||||
} catch (\Throwable $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$output->writeln('<error>Failed to fetch feed info:</error>');
|
||||
$output->writeln($ex->getMessage());
|
||||
return 1;
|
||||
}
|
||||
|
||||
$output->writeln("Feed: " . json_encode($feed, JSON_PRETTY_PRINT));
|
||||
$output->writeln("Items: " . json_encode($items, JSON_PRETTY_PRINT));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class AfterUpdate extends Command
|
|||
{
|
||||
$count = $input->getArgument('purge_count');
|
||||
|
||||
echo $this->itemService->purgeOverThreshold($count);
|
||||
$output->writeln($this->itemService->purgeOverThreshold($count));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,12 @@ use Symfony\Component\Console\Command\Command;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Class AllFeeds
|
||||
*
|
||||
* @deprecated use news:feed:list instead
|
||||
* @package OCA\News\Command\Updater
|
||||
*/
|
||||
class AllFeeds extends Command
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -11,16 +11,12 @@
|
|||
|
||||
namespace OCA\News\Command\Updater;
|
||||
|
||||
use Exception;
|
||||
|
||||
use OCA\News\Service\FeedServiceV2;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use OCA\News\Service\FeedService;
|
||||
|
||||
class UpdateFeed extends Command
|
||||
{
|
||||
/**
|
||||
|
@ -57,12 +53,13 @@ class UpdateFeed extends Command
|
|||
try {
|
||||
$feed = $this->feedService->findForUser($userId, $feedId);
|
||||
$this->feedService->fetch($feed);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln(
|
||||
'<error>Could not update feed with id ' . $feedId .
|
||||
' and user ' . $userId . ': ' . $e->getMessage() .
|
||||
'</error> '
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -17,6 +17,7 @@ use OCA\News\Db\Feed;
|
|||
use OCA\News\Db\FeedMapperV2;
|
||||
use OCA\News\Db\Folder;
|
||||
use OCA\News\Db\FolderMapperV2;
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
@ -79,14 +80,14 @@ class FolderServiceV2 extends Service
|
|||
return $this->mapper->findAll();
|
||||
}
|
||||
|
||||
public function create(string $userId, string $name, int $parent = 0): void
|
||||
public function create(string $userId, string $name, int $parent = 0): Entity
|
||||
{
|
||||
$folder = new Folder();
|
||||
$folder->setUserId($userId)
|
||||
->setName($name)
|
||||
->setParentId($parent);
|
||||
|
||||
$this->mapper->insert($folder);
|
||||
return $this->mapper->insert($folder);
|
||||
}
|
||||
|
||||
public function delete(string $user, int $id)
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Updater\AfterUpdate;
|
||||
use OCA\News\Fetcher\Fetcher;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use OCA\News\Service\ItemServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class AfterUpdateTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|ItemServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var AfterUpdate */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(ItemServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)
|
||||
->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)
|
||||
->getMock();
|
||||
|
||||
$this->command = new AfterUpdate($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->once())
|
||||
->method('getArgument')
|
||||
->with('purge_count')
|
||||
->willReturn('1');
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('purgeOverThreshold')
|
||||
->with('1')
|
||||
->willReturn('test');
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(1))
|
||||
->method('writeln')
|
||||
->with('test');
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Updater\BeforeUpdate;
|
||||
use OCA\News\Service\UpdaterService;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class BeforeUpdateTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|UpdaterService */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var BeforeUpdate */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(UpdaterService::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)
|
||||
->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)
|
||||
->getMock();
|
||||
|
||||
$this->command = new BeforeUpdate($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('beforeUpdate');
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -30,7 +30,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ExploreGeneratorTest extends TestCase {
|
||||
class ExploreGeneratorTest extends TestCase
|
||||
{
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject */
|
||||
protected $favicon;
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject */
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\FeedAdd;
|
||||
use OCA\News\Command\Updater\UpdateFeed;
|
||||
use OCA\News\Db\Feed;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use OCA\News\Service\FeedServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FeedAddTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FeedServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var UpdateFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FeedServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new FeedAdd($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['feed', 'http://feed'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->consoleInput->expects($this->exactly(5))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['folder', '0'],
|
||||
['title', 'title'],
|
||||
['username', 'user'],
|
||||
['password', 'pass'],
|
||||
['full-text', '1'],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Feed::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('create')
|
||||
->with('admin', 'http://feed', 0, true, 'title', 'user', 'pass')
|
||||
->willReturn($feed);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('fetch')
|
||||
->with($feed);
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\FeedAdd;
|
||||
use OCA\News\Command\Config\FeedDelete;
|
||||
use OCA\News\Command\Updater\UpdateFeed;
|
||||
use OCA\News\Db\Feed;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use OCA\News\Service\FeedServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FeedDeleteTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FeedServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var UpdateFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FeedServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new FeedDelete($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['feed-id', '1'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('delete')
|
||||
->with('admin', '1');
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\FeedAdd;
|
||||
use OCA\News\Command\Config\FeedList;
|
||||
use OCA\News\Command\Updater\UpdateFeed;
|
||||
use OCA\News\Db\Feed;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use OCA\News\Service\FeedServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FeedListTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FeedServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var UpdateFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FeedServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new FeedList($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValidRecurse()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['recursive', true],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Feed::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('findAllForUserRecursive')
|
||||
->with('admin')
|
||||
->willReturn([$feed]);
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(1))
|
||||
->method('writeln')
|
||||
->with("[\n []\n]");
|
||||
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['recursive', false],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Feed::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('findAllForUser')
|
||||
->with('admin')
|
||||
->willReturn([$feed]);
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(1))
|
||||
->method('writeln')
|
||||
->with("[\n []\n]");
|
||||
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\FolderAdd;
|
||||
use OCA\News\Db\Folder;
|
||||
use OCA\News\Service\FolderServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FolderAddTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FolderServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var FolderAdd */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FolderServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new FolderAdd($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['name', 'folder'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['parent', '0'],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Folder::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('create')
|
||||
->with('admin', 'folder', 0)
|
||||
->willReturn($feed);
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\FeedAdd;
|
||||
use OCA\News\Command\Config\FeedDelete;
|
||||
use OCA\News\Command\Config\FolderDelete;
|
||||
use OCA\News\Command\Updater\UpdateFeed;
|
||||
use OCA\News\Db\Feed;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use OCA\News\Service\FeedServiceV2;
|
||||
use OCA\News\Service\FolderServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FolderDeleteTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FolderServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var UpdateFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FolderServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new FolderDelete($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['folder-id', '1'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('delete')
|
||||
->with('admin', '1');
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testInValid()
|
||||
{
|
||||
$this->expectException('OCA\News\Service\Exceptions\ServiceException');
|
||||
$this->expectExceptionMessage('Can not remove root folder!');
|
||||
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['folder-id', '0'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->service->expects($this->never())
|
||||
->method('delete');
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\FolderList;
|
||||
use OCA\News\Db\Folder;
|
||||
use OCA\News\Service\FolderServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FolderListTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FolderServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var FolderList */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FolderServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new FolderList($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValidRecurse()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['recursive', true],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Folder::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('findAllForUserRecursive')
|
||||
->with('admin')
|
||||
->willReturn([$feed]);
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(1))
|
||||
->method('writeln')
|
||||
->with("[\n []\n]");
|
||||
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['recursive', false],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Folder::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('findAllForUser')
|
||||
->with('admin')
|
||||
->willReturn([$feed]);
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(1))
|
||||
->method('writeln')
|
||||
->with("[\n []\n]");
|
||||
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Config\OpmlExport;
|
||||
use OCA\News\Command\Updater\UpdateFeed;
|
||||
use OCA\News\Service\OpmlService;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class OpmlExportTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|OpmlService */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var UpdateFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(OpmlService::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new OpmlExport($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(1))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('export')
|
||||
->with('admin')
|
||||
->willReturn('export');
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(1))
|
||||
->method('write')
|
||||
->with('export');
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\ShowFeed;
|
||||
use OCA\News\Fetcher\Fetcher;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ShowFeedTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|Fetcher */
|
||||
protected $fetcher;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var ShowFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fetcher = $this->getMockBuilder(Fetcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new ShowFeed($this->fetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->once())
|
||||
->method('getArgument')
|
||||
->with('feed')
|
||||
->willReturn('feed');
|
||||
|
||||
$this->consoleInput->expects($this->exactly(3))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['user', 'user'],
|
||||
['password', 'user'],
|
||||
['full-text', '1'],
|
||||
]));
|
||||
|
||||
$this->fetcher->expects($this->exactly(1))
|
||||
->method('fetch')
|
||||
->with('feed', true, null, true, 'user', 'user')
|
||||
->willReturn([['feed'], [['items']]]);
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(2))
|
||||
->method('writeln')
|
||||
->withConsecutive(
|
||||
["Feed: [\n \"feed\"\n]"],
|
||||
["Items: [\n [\n \"items\"\n ]\n]"]
|
||||
);
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testInValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->once())
|
||||
->method('getArgument')
|
||||
->with('feed')
|
||||
->willReturn('feed');
|
||||
|
||||
$this->consoleInput->expects($this->exactly(3))
|
||||
->method('getOption')
|
||||
->will($this->returnValueMap([
|
||||
['user', 'user'],
|
||||
['password', 'user'],
|
||||
['full-text', '1'],
|
||||
]));
|
||||
|
||||
$this->fetcher->expects($this->exactly(1))
|
||||
->method('fetch')
|
||||
->with('feed', true, null, true, 'user', 'user')
|
||||
->will($this->throwException(new ServiceNotFoundException('test')));
|
||||
|
||||
$this->consoleOutput->expects($this->exactly(2))
|
||||
->method('writeln')
|
||||
->withConsecutive(
|
||||
['<error>Failed to fetch feed info:</error>'],
|
||||
['test']
|
||||
);
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(1, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Command;
|
||||
|
||||
use OCA\News\Command\Updater\UpdateFeed;
|
||||
use OCA\News\Db\Feed;
|
||||
use OCA\News\Service\Exceptions\ServiceNotFoundException;
|
||||
use OCA\News\Service\FeedServiceV2;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class UpdateFeedTest extends TestCase
|
||||
{
|
||||
/** @var MockObject|FeedServiceV2 */
|
||||
protected $service;
|
||||
/** @var MockObject|InputInterface */
|
||||
protected $consoleInput;
|
||||
/** @var MockObject|OutputInterface */
|
||||
protected $consoleOutput;
|
||||
|
||||
/** @var UpdateFeed */
|
||||
protected $command;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = $this->getMockBuilder(FeedServiceV2::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->command = new UpdateFeed($this->service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['feed-id', '1'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Feed::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('findForUser')
|
||||
->with('admin', '1')
|
||||
->willReturn($feed);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('fetch')
|
||||
->with($feed);
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a valid call will work
|
||||
*/
|
||||
public function testInValid()
|
||||
{
|
||||
$this->consoleInput->expects($this->exactly(2))
|
||||
->method('getArgument')
|
||||
->will($this->returnValueMap([
|
||||
['feed-id', '1'],
|
||||
['user-id', 'admin'],
|
||||
]));
|
||||
|
||||
$feed = $this->createMock(Feed::class);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('findForUser')
|
||||
->with('admin', '1')
|
||||
->willReturn($feed);
|
||||
|
||||
$this->service->expects($this->exactly(1))
|
||||
->method('fetch')
|
||||
->with($feed)
|
||||
->will($this->throwException(new ServiceNotFoundException('')));
|
||||
|
||||
$result = $this->command->run($this->consoleInput, $this->consoleOutput);
|
||||
$this->assertSame(1, $result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Sean Molenaar <sean@seanmolenaar.eu>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\Tests\Unit\Utility;
|
||||
|
||||
use OCA\News\Utility\Time;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TimeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test if the correct type is returned
|
||||
*/
|
||||
public function testTime(): void
|
||||
{
|
||||
$cur = time();
|
||||
|
||||
$time = new Time();
|
||||
$result = $time->getTime();
|
||||
$this->assertIsInt($result);
|
||||
$this->assertTrue($result >= $cur);
|
||||
}
|
||||
|
||||
|
||||
public function testMicroTime(): void
|
||||
{
|
||||
$cur = microtime(true) * 1000000;
|
||||
|
||||
$time = new Time();
|
||||
$result = (float) $time->getMicroTime();
|
||||
$this->assertTrue($result > $cur);
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче