diff --git a/.github/workflows/api-integration-tests.yml b/.github/workflows/api-integration-tests.yml
index bc2c0b8b0b..cdde1aa169 100644
--- a/.github/workflows/api-integration-tests.yml
+++ b/.github/workflows/api-integration-tests.yml
@@ -28,16 +28,16 @@ jobs:
- 5432:5432 # Maps tcp port 5432 on service container to the host
strategy:
matrix:
- php-versions: ['8.0', '8.1']
- nextcloud: ['stable27']
+ php-versions: ['8.2', '8.3']
+ nextcloud: ['stable29']
database: ['sqlite', 'pgsql', 'mysql']
experimental: [false]
include:
- - php-versions: 8.1
+ - php-versions: 8.3
nextcloud: pre-release
database: sqlite
experimental: true
- - php-versions: 8.2
+ - php-versions: 8.3
nextcloud: pre-release
database: sqlite
experimental: true
diff --git a/.github/workflows/api-php-static-code-check.yml b/.github/workflows/api-php-static-code-check.yml
index 9a37fc40cc..5ed3a0f1c2 100644
--- a/.github/workflows/api-php-static-code-check.yml
+++ b/.github/workflows/api-php-static-code-check.yml
@@ -7,11 +7,11 @@ jobs:
continue-on-error: true
strategy:
matrix:
- php-versions: ['8.0', '8.1', '8.2' ]
- nextcloud: [ 'stable27' ]
+ php-versions: ['8.2', '8.3' ]
+ nextcloud: [ 'stable29' ]
database: [ 'sqlite' ]
include:
- - php-versions: 8.2
+ - php-versions: 8.3
nextcloud: pre-release
database: sqlite
experimental: true
diff --git a/.github/workflows/api-php-tests.yml b/.github/workflows/api-php-tests.yml
index 2fb7907700..4742b7b47c 100644
--- a/.github/workflows/api-php-tests.yml
+++ b/.github/workflows/api-php-tests.yml
@@ -9,14 +9,14 @@ jobs:
name: "PHP: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}"
strategy:
matrix:
- php-versions: ['8.1']
- nextcloud: ['stable27']
+ php-versions: ['8.3']
+ nextcloud: ['stable29']
database: ['sqlite']
experimental: [false]
codecoverage: [false]
include:
- - php-versions: 8.2
- nextcloud: stable27
+ - php-versions: 8.3
+ nextcloud: stable29
database: sqlite
experimental: false
codecoverage: true
diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
index c8f5a988a4..739a028ec5 100644
--- a/.github/workflows/build-release.yml
+++ b/.github/workflows/build-release.yml
@@ -14,8 +14,8 @@ jobs:
name: "Release: build, sign and upload the app"
strategy:
matrix:
- php-versions: ['8.1']
- nextcloud: ['stable27']
+ php-versions: ['8.3']
+ nextcloud: ['stable29']
database: ['sqlite']
steps:
- name: Checkout
diff --git a/.github/workflows/frontend-nodejs-tests.yml b/.github/workflows/frontend-nodejs-tests.yml
index 6b0cbbed97..b772e19a4c 100644
--- a/.github/workflows/frontend-nodejs-tests.yml
+++ b/.github/workflows/frontend-nodejs-tests.yml
@@ -9,8 +9,8 @@ jobs:
name: "Frontend: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}"
strategy:
matrix:
- php-versions: ['8.1']
- nextcloud: ['stable27']
+ php-versions: ['8.3']
+ nextcloud: ['stable29']
database: ['sqlite']
experimental: [false]
steps:
diff --git a/.github/workflows/post-merge-tasks.yml b/.github/workflows/post-merge-tasks.yml
index 58859acecf..1e27e00800 100644
--- a/.github/workflows/post-merge-tasks.yml
+++ b/.github/workflows/post-merge-tasks.yml
@@ -10,9 +10,9 @@ jobs:
name: "Coverage: Nextcloud ${{ matrix.nextcloud }} PHP ${{ matrix.php-version }}"
strategy:
matrix:
- nextcloud: ['stable27']
+ php-version: ["8.3"]
+ nextcloud: ['stable29']
codecoverage: [true]
- php-version: ["8.1"]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -41,11 +41,11 @@ jobs:
- name: Prep PHP tests
run: cd ../server/apps/news && make php-test-dependencies
-
+
- name: Unittests
run: cd ../server/apps/news && make unit-test
env:
CODECOVERAGE: ${{ matrix.codecoverage }}
-
+
- name: Upload codecoverage
run: cd ../server/apps/news && bash <(curl -s https://codecov.io/bash) -f build/php-unit.clover
diff --git a/.github/workflows/updater-test.yml b/.github/workflows/updater-test.yml
index 7ae6103fcf..f5cd39b249 100644
--- a/.github/workflows/updater-test.yml
+++ b/.github/workflows/updater-test.yml
@@ -16,8 +16,8 @@ jobs:
name: "Update Test: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }}"
strategy:
matrix:
- php-versions: ['8.1']
- nextcloud: ['stable27']
+ php-versions: ['8.3']
+ nextcloud: ['stable29']
database: ['sqlite']
experimental: [false]
steps:
@@ -71,7 +71,7 @@ jobs:
sleep 2
cd ${{ github.workspace }}/../server
-
+
bats apps/news/tests/updater
# Kill php server
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb7f5a3221..cb0d1a9d95 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,8 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the
# Unreleased
## [25.x.x]
### Changed
-
+- Require NC 29
+- Require PHP 8.2 or higher
### Fixed
- Allow feed title to be null in DB. #2745
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 5e28a90042..1fc3218b97 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -43,7 +43,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new)
https://raw.githubusercontent.com/nextcloud/news/master/screenshots/2.png
https://raw.githubusercontent.com/nextcloud/news/master/screenshots/3.png
-
+
pgsql
sqlite
mysql
@@ -55,7 +55,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new)
json
-
+
diff --git a/composer.json b/composer.json
index 81c5dc0b0b..ef249b33a4 100644
--- a/composer.json
+++ b/composer.json
@@ -40,7 +40,7 @@
"source": "https://github.com/nextcloud/news/"
},
"require": {
- "php": "~8.0",
+ "php": "^8.2",
"ezyang/htmlpurifier": "^4.17.0",
"pear/net_url2": "^2.2.2",
"riimu/kit-pathjoin": "^1.2.0",
diff --git a/composer.lock b/composer.lock
index fade956563..c69f83a409 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "a6df4cb89c6655979c37eff4963e65c1",
+ "content-hash": "5541efcf3c6ca1f468a95dc0a636841b",
"packages": [
{
"name": "arthurhoaro/favicon",
@@ -194,30 +194,30 @@
},
{
"name": "fivefilters/readability.php",
- "version": "v3.1.7",
+ "version": "v3.2.0",
"source": {
"type": "git",
"url": "https://github.com/fivefilters/readability.php.git",
- "reference": "62b04e8f45a1cfe272608e018e4593ecf22a2201"
+ "reference": "433a15f6649881c53c11bffd41ebccbfce6efabb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/62b04e8f45a1cfe272608e018e4593ecf22a2201",
- "reference": "62b04e8f45a1cfe272608e018e4593ecf22a2201",
+ "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/433a15f6649881c53c11bffd41ebccbfce6efabb",
+ "reference": "433a15f6649881c53c11bffd41ebccbfce6efabb",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-mbstring": "*",
"ext-xml": "*",
- "league/uri": "~6.7.2",
+ "league/uri": "^7",
"masterminds/html5": "^2.0",
- "php": ">=7.4.0",
+ "php": ">=8.1",
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
- "monolog/monolog": "^2.3",
- "phpunit/phpunit": "^9"
+ "monolog/monolog": "^3",
+ "phpunit/phpunit": "^10"
},
"suggest": {
"monolog/monolog": "Allow logging debug information"
@@ -253,59 +253,50 @@
],
"support": {
"issues": "https://github.com/fivefilters/readability.php/issues",
- "source": "https://github.com/fivefilters/readability.php/tree/v3.1.7"
+ "source": "https://github.com/fivefilters/readability.php/tree/v3.2.0"
},
- "time": "2024-04-21T00:36:52+00:00"
+ "time": "2024-04-21T13:31:40+00:00"
},
{
"name": "league/uri",
- "version": "6.7.2",
+ "version": "7.4.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri.git",
- "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06"
+ "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06",
- "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06",
+ "url": "https://api.github.com/repos/thephpleague/uri/zipball/bedb6e55eff0c933668addaa7efa1e1f2c417cc4",
+ "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4",
"shasum": ""
},
"require": {
- "ext-json": "*",
- "league/uri-interfaces": "^2.3",
- "php": "^7.4 || ^8.0",
- "psr/http-message": "^1.0"
+ "league/uri-interfaces": "^7.3",
+ "php": "^8.1"
},
"conflict": {
"league/uri-schemes": "^1.0"
},
- "require-dev": {
- "friendsofphp/php-cs-fixer": "^v3.3.2",
- "nyholm/psr7": "^1.5",
- "php-http/psr7-integration-tests": "^1.1",
- "phpstan/phpstan": "^1.2.0",
- "phpstan/phpstan-deprecation-rules": "^1.0",
- "phpstan/phpstan-phpunit": "^1.0.0",
- "phpstan/phpstan-strict-rules": "^1.1.0",
- "phpunit/phpunit": "^9.5.10",
- "psr/http-factory": "^1.0"
- },
"suggest": {
- "ext-fileinfo": "Needed to create Data URI from a filepath",
- "ext-intl": "Needed to improve host validation",
- "league/uri-components": "Needed to easily manipulate URI objects",
- "psr/http-factory": "Needed to use the URI factory"
+ "ext-bcmath": "to improve IPV4 host parsing",
+ "ext-fileinfo": "to create Data URI from file contennts",
+ "ext-gmp": "to improve IPV4 host parsing",
+ "ext-intl": "to handle IDN host with the best performance",
+ "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain",
+ "league/uri-components": "Needed to easily manipulate URI objects components",
+ "php-64bit": "to improve IPV4 host parsing",
+ "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.x-dev"
+ "dev-master": "7.x-dev"
}
},
"autoload": {
"psr-4": {
- "League\\Uri\\": "src"
+ "League\\Uri\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -345,8 +336,8 @@
"support": {
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
- "issues": "https://github.com/thephpleague/uri/issues",
- "source": "https://github.com/thephpleague/uri/tree/6.7.2"
+ "issues": "https://github.com/thephpleague/uri-src/issues",
+ "source": "https://github.com/thephpleague/uri/tree/7.4.1"
},
"funding": [
{
@@ -354,46 +345,44 @@
"type": "github"
}
],
- "time": "2022-09-13T19:50:42+00:00"
+ "time": "2024-03-23T07:42:40+00:00"
},
{
"name": "league/uri-interfaces",
- "version": "2.3.0",
+ "version": "7.4.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri-interfaces.git",
- "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383"
+ "reference": "8d43ef5c841032c87e2de015972c06f3865ef718"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383",
- "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383",
+ "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/8d43ef5c841032c87e2de015972c06f3865ef718",
+ "reference": "8d43ef5c841032c87e2de015972c06f3865ef718",
"shasum": ""
},
"require": {
- "ext-json": "*",
- "php": "^7.2 || ^8.0"
- },
- "require-dev": {
- "friendsofphp/php-cs-fixer": "^2.19",
- "phpstan/phpstan": "^0.12.90",
- "phpstan/phpstan-phpunit": "^0.12.19",
- "phpstan/phpstan-strict-rules": "^0.12.9",
- "phpunit/phpunit": "^8.5.15 || ^9.5"
+ "ext-filter": "*",
+ "php": "^8.1",
+ "psr/http-factory": "^1",
+ "psr/http-message": "^1.1 || ^2.0"
},
"suggest": {
- "ext-intl": "to use the IDNA feature",
- "symfony/intl": "to use the IDNA feature via Symfony Polyfill"
+ "ext-bcmath": "to improve IPV4 host parsing",
+ "ext-gmp": "to improve IPV4 host parsing",
+ "ext-intl": "to handle IDN host with the best performance",
+ "php-64bit": "to improve IPV4 host parsing",
+ "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.x-dev"
+ "dev-master": "7.x-dev"
}
},
"autoload": {
"psr-4": {
- "League\\Uri\\": "src/"
+ "League\\Uri\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -407,17 +396,32 @@
"homepage": "https://nyamsprod.com"
}
],
- "description": "Common interface for URI representation",
- "homepage": "http://github.com/thephpleague/uri-interfaces",
+ "description": "Common interfaces and classes for URI representation and interaction",
+ "homepage": "https://uri.thephpleague.com",
"keywords": [
+ "data-uri",
+ "file-uri",
+ "ftp",
+ "hostname",
+ "http",
+ "https",
+ "parse_str",
+ "parse_url",
+ "psr-7",
+ "query-string",
+ "querystring",
"rfc3986",
"rfc3987",
+ "rfc6570",
"uri",
- "url"
+ "url",
+ "ws"
],
"support": {
- "issues": "https://github.com/thephpleague/uri-interfaces/issues",
- "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0"
+ "docs": "https://uri.thephpleague.com",
+ "forum": "https://thephpleague.slack.com",
+ "issues": "https://github.com/thephpleague/uri-src/issues",
+ "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.1"
},
"funding": [
{
@@ -425,7 +429,7 @@
"type": "github"
}
],
- "time": "2021-06-28T04:27:21+00:00"
+ "time": "2024-03-23T07:42:40+00:00"
},
{
"name": "masterminds/html5",
@@ -562,18 +566,73 @@
},
"time": "2017-08-25T06:16:11+00:00"
},
+ {
+ "name": "psr/http-factory",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-factory.git",
+ "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
+ "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1",
+ "psr/http-message": "^1.0 || ^2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "psr",
+ "psr-17",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-factory"
+ },
+ "time": "2024-04-15T12:06:14+00:00"
+ },
{
"name": "psr/http-message",
- "version": "1.1",
+ "version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
- "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
+ "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
- "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
+ "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
@@ -582,7 +641,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "2.0.x-dev"
}
},
"autoload": {
@@ -597,7 +656,7 @@
"authors": [
{
"name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
+ "homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
@@ -611,9 +670,9 @@
"response"
],
"support": {
- "source": "https://github.com/php-fig/http-message/tree/1.1"
+ "source": "https://github.com/php-fig/http-message/tree/2.0"
},
- "time": "2023-04-04T09:50:52+00:00"
+ "time": "2023-04-04T09:54:51+00:00"
},
{
"name": "riimu/kit-pathjoin",
@@ -1147,16 +1206,16 @@
},
{
"name": "nikic/php-parser",
- "version": "v5.1.0",
+ "version": "v5.2.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1"
+ "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1",
- "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
+ "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"shasum": ""
},
"require": {
@@ -1199,9 +1258,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
- "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0"
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
},
- "time": "2024-07-01T20:03:41+00:00"
+ "time": "2024-09-15T16:40:33+00:00"
},
{
"name": "phar-io/manifest",
@@ -1323,22 +1382,22 @@
},
{
"name": "phpstan/extension-installer",
- "version": "1.4.2",
+ "version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/extension-installer.git",
- "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd"
+ "reference": "85e90b3942d06b2326fba0403ec24fe912372936"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/46c8219b3fb0deb3fc08301e8f0797d321d17dcd",
- "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd",
+ "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936",
+ "reference": "85e90b3942d06b2326fba0403ec24fe912372936",
"shasum": ""
},
"require": {
"composer-plugin-api": "^2.0",
"php": "^7.2 || ^8.0",
- "phpstan/phpstan": "^1.9.0"
+ "phpstan/phpstan": "^1.9.0 || ^2.0"
},
"require-dev": {
"composer/composer": "^2.0",
@@ -1365,22 +1424,22 @@
],
"support": {
"issues": "https://github.com/phpstan/extension-installer/issues",
- "source": "https://github.com/phpstan/extension-installer/tree/1.4.2"
+ "source": "https://github.com/phpstan/extension-installer/tree/1.4.3"
},
- "time": "2024-08-26T07:38:00+00:00"
+ "time": "2024-09-04T20:21:43+00:00"
},
{
"name": "phpstan/phpstan",
- "version": "1.12.0",
+ "version": "1.12.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
- "reference": "384af967d35b2162f69526c7276acadce534d0e1"
+ "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1",
- "reference": "384af967d35b2162f69526c7276acadce534d0e1",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009",
+ "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009",
"shasum": ""
},
"require": {
@@ -1425,25 +1484,25 @@
"type": "github"
}
],
- "time": "2024-08-27T09:18:05+00:00"
+ "time": "2024-09-09T08:10:35+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",
- "version": "1.2.0",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
- "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26"
+ "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/fa8cce7720fa782899a0aa97b6a41225d1bb7b26",
- "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26",
+ "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82",
+ "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
- "phpstan/phpstan": "^1.11"
+ "phpstan/phpstan": "^1.12"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
@@ -1470,9 +1529,9 @@
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
- "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.0"
+ "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1"
},
- "time": "2024-04-20T06:39:48+00:00"
+ "time": "2024-09-11T15:52:35+00:00"
},
{
"name": "phpstan/phpstan-doctrine",
@@ -1600,21 +1659,21 @@
},
{
"name": "phpstan/phpstan-strict-rules",
- "version": "1.5.2",
+ "version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
- "reference": "7a50e9662ee9f3942e4aaaf3d603653f60282542"
+ "reference": "363f921dd8441777d4fc137deb99beb486c77df1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/7a50e9662ee9f3942e4aaaf3d603653f60282542",
- "reference": "7a50e9662ee9f3942e4aaaf3d603653f60282542",
+ "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/363f921dd8441777d4fc137deb99beb486c77df1",
+ "reference": "363f921dd8441777d4fc137deb99beb486c77df1",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
- "phpstan/phpstan": "^1.10.34"
+ "phpstan/phpstan": "^1.11"
},
"require-dev": {
"nikic/php-parser": "^4.13.0",
@@ -1643,41 +1702,41 @@
"description": "Extra strict and opinionated rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
- "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.5.2"
+ "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.0"
},
- "time": "2023-10-30T14:35:06+00:00"
+ "time": "2024-04-20T06:37:51+00:00"
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.2.31",
+ "version": "9.2.32",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965"
+ "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965",
- "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5",
+ "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
- "nikic/php-parser": "^4.18 || ^5.0",
+ "nikic/php-parser": "^4.19.1 || ^5.1.0",
"php": ">=7.3",
- "phpunit/php-file-iterator": "^3.0.3",
- "phpunit/php-text-template": "^2.0.2",
- "sebastian/code-unit-reverse-lookup": "^2.0.2",
- "sebastian/complexity": "^2.0",
- "sebastian/environment": "^5.1.2",
- "sebastian/lines-of-code": "^1.0.3",
- "sebastian/version": "^3.0.1",
- "theseer/tokenizer": "^1.2.0"
+ "phpunit/php-file-iterator": "^3.0.6",
+ "phpunit/php-text-template": "^2.0.4",
+ "sebastian/code-unit-reverse-lookup": "^2.0.3",
+ "sebastian/complexity": "^2.0.3",
+ "sebastian/environment": "^5.1.5",
+ "sebastian/lines-of-code": "^1.0.4",
+ "sebastian/version": "^3.0.2",
+ "theseer/tokenizer": "^1.2.3"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^9.6"
},
"suggest": {
"ext-pcov": "PHP extension that provides line coverage",
@@ -1686,7 +1745,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "9.2-dev"
+ "dev-main": "9.2.x-dev"
}
},
"autoload": {
@@ -1715,7 +1774,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32"
},
"funding": [
{
@@ -1723,7 +1782,7 @@
"type": "github"
}
],
- "time": "2024-03-02T06:37:42+00:00"
+ "time": "2024-08-22T04:23:01+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -3218,7 +3277,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": "~8.0",
+ "php": "^8.2",
"ext-json": "*",
"ext-simplexml": "*",
"ext-libxml": "*",
diff --git a/lib/Command/Updater/Job.php b/lib/Command/Updater/Job.php
index b8124d82f5..0596ef6c7e 100644
--- a/lib/Command/Updater/Job.php
+++ b/lib/Command/Updater/Job.php
@@ -10,8 +10,7 @@
use DateTime;
use DateInterval;
-use OCP\Util;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCA\News\AppInfo\Application;
use OCA\News\Service\StatusService;
use OCA\News\Service\UpdaterService;
@@ -22,27 +21,12 @@
class Job extends Command
{
- /**
- * @var IConfig
- */
- private $config;
-
- /**
- * @var StatusService Status service
- */
- private $statusService;
-
- /**
- * @var UpdaterService Update service
- */
- private $updaterService;
-
- public function __construct(IConfig $config, StatusService $statusService, UpdaterService $updaterService)
- {
+ public function __construct(
+ private IAppConfig $config,
+ private StatusService $statusService,
+ private UpdaterService $updaterService
+ ) {
parent::__construct();
- $this->config = $config;
- $this->statusService = $statusService;
- $this->updaterService = $updaterService;
}
/**
@@ -71,12 +55,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$reset = (bool) $input->getOption('reset');
$checkElapsed = (bool) $input->getOption('check-elapsed');
- [$major, $minor, $micro] = Util::getVersion();
-
- if ($major < 26) {
- $output->writeln("Error: This only works with Nextcloud 26 or newer.");
- return 1;
- }
$output->writeln("Checking update Status");
$date = new DateTime();
$date->setTimestamp($this->statusService->getUpdateTime());
@@ -95,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
if ($checkElapsed) {
- $updateInterval = $this->config->getAppValue(
+ $updateInterval = $this->config->getValueString(
Application::NAME,
'updateInterval',
Application::DEFAULT_SETTINGS['updateInterval']
diff --git a/lib/Config/FetcherConfig.php b/lib/Config/FetcherConfig.php
index 710c41e245..048b06f038 100644
--- a/lib/Config/FetcherConfig.php
+++ b/lib/Config/FetcherConfig.php
@@ -18,6 +18,8 @@
use OCA\News\AppInfo\Application;
use OCA\News\Fetcher\Client\FeedIoClient;
use OCP\IConfig;
+use OCP\IAppConfig;
+use Net_URL2;
/**
* Class FetcherConfig
@@ -61,29 +63,30 @@ class FetcherConfig
/**
* FetcherConfig constructor.
*
- * @param IConfig $config
+ * @param IAppConfig $config App configuration
+ * @param IConfig $systemconfig System configuration
*/
- public function __construct(IConfig $config)
+ public function __construct(IAppConfig $config, IConfig $systemconfig)
{
- $this->client_timeout = $config->getAppValue(
+ $this->client_timeout = $config->getValueInt(
Application::NAME,
'feedFetcherTimeout',
Application::DEFAULT_SETTINGS['feedFetcherTimeout']
);
- $this->redirects = $config->getAppValue(
+ $this->redirects = $config->getValueInt(
Application::NAME,
'maxRedirects',
Application::DEFAULT_SETTINGS['maxRedirects']
);
- $proxy = $config->getSystemValue('proxy', null);
+ $proxy = $systemconfig->getSystemValue('proxy', null);
if (is_null($proxy)) {
return $this;
}
- $url = new \Net_URL2($proxy);
+ $url = new Net_URL2($proxy);
- $creds = $config->getSystemValue('proxyuserpwd', null);
+ $creds = $systemconfig->getSystemValue('proxyuserpwd', null);
if ($creds !== null) {
$auth = explode(':', $creds, 2);
$url->setUserinfo($auth[0], $auth[1]);
@@ -97,9 +100,9 @@ public function __construct(IConfig $config)
/**
* Checks for available encoding options
*
- * @return String list of supported encoding types
+ * @return string list of supported encoding types
*/
- public function checkEncoding()
+ public function checkEncoding(): string
{
$supportedEncoding = [];
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index abdd3f2f78..818f5db0bb 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -16,6 +16,7 @@
use OCA\News\AppInfo\Application;
use OCA\News\Explore\Exceptions\RecommendedSiteNotFoundException;
use OCP\IRequest;
+use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
@@ -32,46 +33,17 @@ class PageController extends Controller
{
use JSONHttpErrorTrait;
- /**
- * @var IConfig
- */
- private $settings;
-
- /**
- * @var IL10N
- */
- private $l10n;
-
- /**
- * @var IURLGenerator
- */
- private $urlGenerator;
-
- /**
- * @var RecommendedSites
- */
- private $recommendedSites;
-
- /**
- * @var StatusService
- */
- private $statusService;
-
public function __construct(
IRequest $request,
- IConfig $settings,
- IURLGenerator $urlGenerator,
- IL10N $l10n,
- RecommendedSites $recommendedSites,
- StatusService $statusService,
- ?IUserSession $userSession
+ ?IUserSession $userSession,
+ private IAppConfig $settings,
+ private IConfig $config,
+ private IURLGenerator $urlGenerator,
+ private IL10N $l10n,
+ private RecommendedSites $recommendedSites,
+ private StatusService $statusService
) {
parent::__construct($request, $userSession);
- $this->settings = $settings;
- $this->urlGenerator = $urlGenerator;
- $this->l10n = $l10n;
- $this->recommendedSites = $recommendedSites;
- $this->statusService = $statusService;
}
@@ -121,7 +93,7 @@ public function settings(): array
'compactExpand'
];
- $exploreUrl = $this->settings->getAppValue(
+ $exploreUrl = $this->settings->getValueString(
$this->appName,
'exploreUrl',
Application::DEFAULT_SETTINGS['exploreUrl']
@@ -141,7 +113,7 @@ public function settings(): array
];
foreach ($settings as $setting) {
- $result[$setting] = $this->settings->getUserValue(
+ $result[$setting] = $this->config->getUserValue(
$this->getUserId(),
$this->appName,
$setting
diff --git a/lib/Controller/UtilityApiController.php b/lib/Controller/UtilityApiController.php
index 943aa7b15e..02e65c2e40 100644
--- a/lib/Controller/UtilityApiController.php
+++ b/lib/Controller/UtilityApiController.php
@@ -17,7 +17,7 @@
use OCA\News\Service\UpdaterService;
use \OCP\IRequest;
-use \OCP\IConfig;
+use \OCP\IAppConfig;
use \OCP\IUserSession;
use \OCA\News\Service\StatusService;
@@ -25,21 +25,14 @@
class UtilityApiController extends ApiController
{
- private $updaterService;
- private $settings;
- private $statusService;
-
public function __construct(
IRequest $request,
?IUserSession $userSession,
- UpdaterService $updater,
- IConfig $settings,
- StatusService $statusService
+ private UpdaterService $updaterService,
+ private IAppConfig $settings,
+ private StatusService $statusService
) {
parent::__construct($request, $userSession);
- $this->updaterService = $updater;
- $this->settings = $settings;
- $this->statusService = $statusService;
}
@@ -50,7 +43,7 @@ public function __construct(
*/
public function version(): array
{
- $version = $this->settings->getAppValue(
+ $version = $this->settings->getValueString(
$this->appName,
'installed_version'
);
diff --git a/lib/Cron/UpdaterJob.php b/lib/Cron/UpdaterJob.php
index 44bb7bfa30..bac95537c0 100644
--- a/lib/Cron/UpdaterJob.php
+++ b/lib/Cron/UpdaterJob.php
@@ -17,36 +17,20 @@
use OCA\News\AppInfo\Application;
use OCA\News\Service\StatusService;
use OCA\News\Service\UpdaterService;
-use OCP\IConfig;
+use OCP\IAppConfig;
class UpdaterJob extends TimedJob
{
- /**
- * @var IConfig
- */
- private $config;
- /**
- * @var StatusService
- */
- private $statusService;
- /**
- * @var UpdaterService
- */
- private $updaterService;
-
public function __construct(
ITimeFactory $time,
- IConfig $config,
- StatusService $status,
- UpdaterService $updaterService
+ private IAppConfig $config,
+ private StatusService $statusService,
+ private UpdaterService $updaterService
) {
parent::__construct($time);
- $this->config = $config;
- $this->statusService = $status;
- $this->updaterService = $updaterService;
- $interval = $this->config->getAppValue(
+ $interval = $this->config->getValueString(
Application::NAME,
'updateInterval',
Application::DEFAULT_SETTINGS['updateInterval']
@@ -58,9 +42,9 @@ public function __construct(
/**
* @return void
*/
- protected function run($argument)
+ protected function run($argument): void
{
- $uses_cron = (bool) $this->config->getAppValue(
+ $uses_cron = $this->config->getValueBool(
Application::NAME,
'useCronUpdates',
Application::DEFAULT_SETTINGS['useCronUpdates']
diff --git a/lib/Search/FeedSearchProvider.php b/lib/Search/FeedSearchProvider.php
index 65b2059c5d..3d9caeb21e 100644
--- a/lib/Search/FeedSearchProvider.php
+++ b/lib/Search/FeedSearchProvider.php
@@ -20,20 +20,12 @@
*/
class FeedSearchProvider implements IProvider
{
- /** @var IL10N */
- private $l10n;
- /** @var IURLGenerator */
- private $urlGenerator;
-
- /** @var FeedServiceV2 */
- private $service;
-
- public function __construct(IL10N $l10n, IURLGenerator $urlGenerator, FeedServiceV2 $service)
- {
- $this->l10n = $l10n;
- $this->urlGenerator = $urlGenerator;
- $this->service = $service;
+ public function __construct(
+ private IL10N $l10n,
+ private IURLGenerator $urlGenerator,
+ private FeedServiceV2 $service
+ ) {
}
public function getId(): string
@@ -66,13 +58,14 @@ public function search(IUser $user, ISearchQuery $query): SearchResult
}
$term = strtolower($term);
+ $imageurl = $this->urlGenerator->imagePath('core', 'rss.svg');
foreach ($this->service->findAllForUser($user->getUID()) as $feed) {
if (strpos(strtolower($feed->getTitle()), $term) === false) {
continue;
}
$list[] = new SearchResultEntry(
- $this->urlGenerator->imagePath('core', 'rss.svg'),
+ $imageurl,
$feed->getTitle(),
$this->l10n->t('Unread articles') . ': ' . $feed->getUnreadCount(),
$this->urlGenerator->linkToRoute('news.page.index') . '#/feed/' . $feed->getId()
diff --git a/lib/Search/FolderSearchProvider.php b/lib/Search/FolderSearchProvider.php
index 3997eba363..9ccbbf5607 100644
--- a/lib/Search/FolderSearchProvider.php
+++ b/lib/Search/FolderSearchProvider.php
@@ -67,13 +67,14 @@ public function search(IUser $user, ISearchQuery $query): SearchResult
}
$term = strtolower($term);
+ $imageurl = $this->urlGenerator->imagePath('core', 'filetypes/folder.svg');
foreach ($this->service->findAllForUser($user->getUID()) as $folder) {
if (strpos(strtolower($folder->getName()), $term) === false) {
continue;
}
$list[] = new SearchResultEntry(
- $this->urlGenerator->imagePath('core', 'filetypes/folder.svg'),
+ $imageurl,
$folder->getName(),
'',
$this->urlGenerator->linkToRoute('news.page.index') . '#/folder/' . $folder->getId()
diff --git a/lib/Service/FolderServiceV2.php b/lib/Service/FolderServiceV2.php
index e70e4dee9f..feb6f3d49e 100644
--- a/lib/Service/FolderServiceV2.php
+++ b/lib/Service/FolderServiceV2.php
@@ -28,24 +28,13 @@
*/
class FolderServiceV2 extends Service
{
- /**
- * @var FeedServiceV2
- */
- private $feedService;
- /**
- * @var TimeFactory
- */
- private $timeFactory;
-
public function __construct(
FolderMapperV2 $mapper,
- FeedServiceV2 $feedService,
- TimeFactory $timeFactory,
- LoggerInterface $logger
+ LoggerInterface $logger,
+ private FeedServiceV2 $feedService,
+ private TimeFactory $timeFactory,
) {
parent::__construct($mapper, $logger);
- $this->feedService = $feedService;
- $this->timeFactory = $timeFactory;
}
/**
diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php
index ab83ba5c54..4f1401c9db 100644
--- a/lib/Service/ItemServiceV2.php
+++ b/lib/Service/ItemServiceV2.php
@@ -23,7 +23,7 @@
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
-use OCP\IConfig;
+use OCP\IAppConfig;
use Psr\Log\LoggerInterface;
/**
@@ -34,25 +34,19 @@
class ItemServiceV2 extends Service
{
- /**
- * @var IConfig
- */
- protected $config;
-
/**
* ItemService constructor.
*
* @param ItemMapperV2 $mapper
- * @param IConfig $config
+ * @param IAppConfig $config
* @param LoggerInterface $logger
*/
public function __construct(
ItemMapperV2 $mapper,
- IConfig $config,
- LoggerInterface $logger
+ LoggerInterface $logger,
+ protected IAppConfig $config
) {
parent::__construct($mapper, $logger);
- $this->config = $config;
}
/**
@@ -152,17 +146,17 @@ public function read(string $userId, int $id, bool $read): Entity
*/
public function purgeOverThreshold(int $threshold = null, bool $purgeUnread = null): ?int
{
- $threshold = (int) ($threshold ?? $this->config->getAppValue(
+ $threshold = $threshold ?? $this->config->getValueInt(
Application::NAME,
'autoPurgeCount',
Application::DEFAULT_SETTINGS['autoPurgeCount']
- ));
+ );
- $purgeUnread = (bool) ($purgeUnread ?? $this->config->getAppValue(
+ $purgeUnread = $purgeUnread ?? $this->config->getValueBool(
Application::NAME,
'purgeUnread',
Application::DEFAULT_SETTINGS['purgeUnread']
- ));
+ );
if ($threshold <= 0) {
return null;
diff --git a/lib/Service/StatusService.php b/lib/Service/StatusService.php
index 09cea9e4a2..3733513864 100644
--- a/lib/Service/StatusService.php
+++ b/lib/Service/StatusService.php
@@ -14,32 +14,24 @@
namespace OCA\News\Service;
use OCA\News\AppInfo\Application;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\BackgroundJob\IJobList;
-use OCP\Util;
use OCA\News\Cron\UpdaterJob;
class StatusService
{
- /** @var IConfig */
- private $settings;
- /** @var string */
- private $appName;
- /** @var IDBConnection */
- private $connection;
- /** @var IJobList */
- private $jobList;
+ /**
+ * Name of the app
+ */
+ private string $appName;
public function __construct(
- IConfig $settings,
- IDBConnection $connection,
- IJobList $jobList
+ private IAppConfig $settings,
+ private IDBConnection $connection,
+ private IJobList $jobList
) {
- $this->settings = $settings;
- $this->connection = $connection;
$this->appName = Application::NAME;
- $this->jobList = $jobList;
}
/**
@@ -50,13 +42,13 @@ public function __construct(
public function isCronProperlyConfigured(): bool
{
//Is NC cron enabled?
- $cronMode = $this->settings->getAppValue('core', 'backgroundjobs_mode');
+ $cronMode = $this->settings->getValueString('core', 'backgroundjobs_mode');
//Expect nextcloud cron
- $cronOff = !boolval($this->settings->getAppValue(
+ $cronOff = !$this->settings->getValueBool(
Application::NAME,
'useCronUpdates',
Application::DEFAULT_SETTINGS['useCronUpdates']
- ));
+ );
// check for cron modes which may lead to problems
return $cronMode === 'cron' || $cronOff;
@@ -70,7 +62,7 @@ public function isCronProperlyConfigured(): bool
*/
public function getStatus(): array
{
- $version = $this->settings->getAppValue(
+ $version = $this->settings->getValueString(
$this->appName,
'installed_version'
);
@@ -94,7 +86,7 @@ public function getUpdateTime(): int
$myJobList = $this->jobList->getJobsIterator(UpdaterJob::class, 1, 0);
$time = $myJobList->current()->getLastRun();
-
+
return $time;
}
}
diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php
index 5e4e83920a..1a1637a6fe 100644
--- a/lib/Settings/AdminSettings.php
+++ b/lib/Settings/AdminSettings.php
@@ -5,45 +5,36 @@
use OCA\News\AppInfo\Application;
use OCA\News\Service\StatusService;
use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\Settings\ISettings;
use OCP\AppFramework\Services\IInitialState;
class AdminSettings implements ISettings
{
- /**
- * @var IConfig
- */
- private $config;
- /** @var IInitialState */
- private $initialState;
- /** @var StatusService */
- private $service;
-
- public function __construct(IConfig $config, IInitialState $initialState, StatusService $service)
- {
- $this->config = $config;
- $this->initialState = $initialState;
- $this->service = $service;
+ public function __construct(
+ private IAppConfig $config,
+ private IInitialState $initialState,
+ private StatusService $service
+ ) {
}
public function getForm()
{
foreach (array_keys(Application::DEFAULT_SETTINGS) as $setting) {
- $this->initialState->provideInitialState($setting, $this->config->getAppValue(
+ $this->initialState->provideInitialState($setting, $this->config->getValueString(
Application::NAME,
$setting,
- (string)Application::DEFAULT_SETTINGS[$setting]
+ (string) Application::DEFAULT_SETTINGS[$setting]
));
}
-
+
if ($this->service->isCronProperlyConfigured()) {
$lastUpdate = $this->service->getUpdateTime();
} else {
$lastUpdate = 0;
}
-
+
$this->initialState->provideInitialState("lastCron", $lastUpdate);
return new TemplateResponse(Application::NAME, 'admin', []);
diff --git a/lib/Utility/Cache.php b/lib/Utility/Cache.php
index 6337487cfa..5721a1797e 100644
--- a/lib/Utility/Cache.php
+++ b/lib/Utility/Cache.php
@@ -15,7 +15,7 @@
class Cache
{
-
+
/**
* @var ITempManager
diff --git a/tests/Unit/Config/FetcherConfigTest.php b/tests/Unit/Config/FetcherConfigTest.php
index 6f5364490e..942155ec9b 100644
--- a/tests/Unit/Config/FetcherConfigTest.php
+++ b/tests/Unit/Config/FetcherConfigTest.php
@@ -20,16 +20,12 @@
namespace OCA\News\Tests\Config;
-use OCA\News\Command\Debug\ItemList;
-use OCA\News\Command\Updater\UpdateFeed;
use OCA\News\Config\FetcherConfig;
use OCA\News\Fetcher\Client\FeedIoClient;
-use OCA\News\Service\ItemServiceV2;
+use OCP\IAppConfig;
use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
/**
* Class FetcherConfigTest
@@ -40,17 +36,24 @@
*/
class FetcherConfigTest extends TestCase
{
- /** @var MockObject|IConfig */
+ /** @var MockObject|IAppConfig */
protected $config;
+ /** @var MockObject|IConfig */
+ protected $sysconfig;
+
/** @var FetcherConfig */
protected $class;
protected function setUp(): void
{
- $this->config = $this->getMockBuilder(IConfig::class)
+ $this->config = $this->getMockBuilder(IAppConfig::class)
->disableOriginalConstructor()
->getMock();
+
+ $this->sysconfig = $this->getMockBuilder(IConfig::class)
+ ->disableOriginalConstructor()
+ ->getMock();
}
/**
@@ -58,7 +61,7 @@ protected function setUp(): void
*/
public function testGetClient()
{
- $this->class = new FetcherConfig($this->config);
+ $this->class = new FetcherConfig($this->config, $this->sysconfig);
$this->assertInstanceOf(FeedIoClient::class, $this->class->getClient());
}
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php
index 4e29504796..4672a61a43 100644
--- a/tests/Unit/Controller/PageControllerTest.php
+++ b/tests/Unit/Controller/PageControllerTest.php
@@ -19,6 +19,7 @@
use OCA\News\Explore\Exceptions\RecommendedSiteNotFoundException;
use OCA\News\Explore\RecommendedSites;
use OCA\News\Service\StatusService;
+use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
@@ -31,10 +32,15 @@ class PageControllerTest extends TestCase
{
/**
- * @var \PHPUnit\Framework\MockObject\MockObject|IConfig
+ * @var \PHPUnit\Framework\MockObject\MockObject|IAppConfig
*/
private $settings;
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IConfig
+ */
+ private $config;
+
/**
* @var \PHPUnit\Framework\MockObject\MockObject|IRequest
*/
@@ -88,7 +94,10 @@ public function setUp(): void
$this->l10n = $this->request = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
- $this->settings = $this->getMockBuilder(IConfig::class)
+ $this->settings = $this->getMockBuilder(IAppConfig::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->request = $this->getMockBuilder(IRequest::class)
@@ -114,12 +123,13 @@ public function setUp(): void
->will($this->returnValue($this->user));
$this->controller = new PageController(
$this->request,
+ $this->userSession,
$this->settings,
+ $this->config,
$this->urlGenerator,
$this->l10n,
$this->recommended,
- $this->status,
- $this->userSession
+ $this->status
);
}
@@ -173,26 +183,27 @@ public function testSettings()
];
$this->l10n->expects($this->once())
- ->method('getLanguageCode')
- ->will($this->returnValue('de'));
- $this->settings->expects($this->exactly(5))
- ->method('getUserValue')
- ->withConsecutive(
- ['becka', 'news', 'showAll'],
- ['becka', 'news', 'compact'],
- ['becka', 'news', 'preventReadOnScroll'],
- ['becka', 'news', 'oldestFirst'],
- ['becka', 'news', 'compactExpand']
- )
- ->will($this->returnValue('1'));
+ ->method('getLanguageCode')
+ ->will($this->returnValue('de'));
+
+ $this->config->expects($this->exactly(5))
+ ->method('getUserValue')
+ ->withConsecutive(
+ ['becka', 'news', 'showAll'],
+ ['becka', 'news', 'compact'],
+ ['becka', 'news', 'preventReadOnScroll'],
+ ['becka', 'news', 'oldestFirst'],
+ ['becka', 'news', 'compactExpand']
+ )
+ ->will($this->returnValue('1'));
$this->settings->expects($this->once())
- ->method('getAppValue')
- ->with('news', 'exploreUrl')
- ->will($this->returnValue(' '));
+ ->method('getValueString')
+ ->with('news', 'exploreUrl')
+ ->will($this->returnValue(' '));
$this->urlGenerator->expects($this->once())
- ->method('linkToRoute')
- ->with('news.page.explore', ['lang' => 'en'])
- ->will($this->returnValue('test'));
+ ->method('linkToRoute')
+ ->with('news.page.explore', ['lang' => 'en'])
+ ->will($this->returnValue('test'));
$response = $this->controller->settings();
@@ -215,22 +226,23 @@ public function testSettingsExploreUrlSet()
];
$this->l10n->expects($this->once())
- ->method('getLanguageCode')
- ->will($this->returnValue('de'));
- $this->settings->expects($this->exactly(5))
- ->method('getUserValue')
- ->withConsecutive(
- ['becka', 'news', 'showAll'],
- ['becka', 'news', 'compact'],
- ['becka', 'news', 'preventReadOnScroll'],
- ['becka', 'news', 'oldestFirst'],
- ['becka', 'news', 'compactExpand']
- )
- ->will($this->returnValue('1'));
+ ->method('getLanguageCode')
+ ->will($this->returnValue('de'));
+
+ $this->config->expects($this->exactly(5))
+ ->method('getUserValue')
+ ->withConsecutive(
+ ['becka', 'news', 'showAll'],
+ ['becka', 'news', 'compact'],
+ ['becka', 'news', 'preventReadOnScroll'],
+ ['becka', 'news', 'oldestFirst'],
+ ['becka', 'news', 'compactExpand']
+ )
+ ->will($this->returnValue('1'));
$this->settings->expects($this->once())
- ->method('getAppValue')
- ->with('news', 'exploreUrl')
- ->will($this->returnValue('abc'));
+ ->method('getValueString')
+ ->with('news', 'exploreUrl')
+ ->will($this->returnValue('abc'));
$this->urlGenerator->expects($this->never())
->method('getAbsoluteURL');
@@ -244,15 +256,15 @@ public function testSettingsExploreUrlSet()
*/
public function testUpdateSettings()
{
- $this->settings->expects($this->exactly(5))
- ->method('setUserValue')
- ->withConsecutive(
- ['becka', 'news', 'showAll', '1'],
- ['becka', 'news', 'compact', '1'],
- ['becka', 'news', 'preventReadOnScroll', '0'],
- ['becka', 'news', 'oldestFirst', '1'],
- ['becka', 'news', 'compactExpand', '1']
- );
+ $this->config->expects($this->exactly(5))
+ ->method('setUserValue')
+ ->withConsecutive(
+ ['becka', 'news', 'showAll', '1'],
+ ['becka', 'news', 'compact', '1'],
+ ['becka', 'news', 'preventReadOnScroll', '0'],
+ ['becka', 'news', 'oldestFirst', '1'],
+ ['becka', 'news', 'compactExpand', '1']
+ );
$this->controller->updateSettings(true, true, false, true, true);
}
@@ -260,17 +272,17 @@ public function testUpdateSettings()
public function testExplore()
{
$in = ['test'];
- $this->settings->expects($this->exactly(2))
- ->method('setUserValue')
- ->withConsecutive(
- ['becka', 'news', 'lastViewedFeedId', 0],
- ['becka', 'news', 'lastViewedFeedType', ListType::EXPLORE]
- );
+ $this->config->expects($this->exactly(2))
+ ->method('setUserValue')
+ ->withConsecutive(
+ ['becka', 'news', 'lastViewedFeedId', 0],
+ ['becka', 'news', 'lastViewedFeedType', ListType::EXPLORE]
+ );
$this->recommended->expects($this->once())
- ->method('forLanguage')
- ->with('en')
- ->will($this->returnValue($in));
+ ->method('forLanguage')
+ ->with('en')
+ ->will($this->returnValue($in));
$out = $this->controller->explore('en');
@@ -280,17 +292,17 @@ public function testExplore()
public function testExploreError()
{
- $this->settings->expects($this->exactly(2))
- ->method('setUserValue')
- ->withConsecutive(
- ['becka', 'news', 'lastViewedFeedId', 0],
- ['becka', 'news', 'lastViewedFeedType', ListType::EXPLORE]
- );
+ $this->config->expects($this->exactly(2))
+ ->method('setUserValue')
+ ->withConsecutive(
+ ['becka', 'news', 'lastViewedFeedId', 0],
+ ['becka', 'news', 'lastViewedFeedType', ListType::EXPLORE]
+ );
$this->recommended->expects($this->once())
- ->method('forLanguage')
- ->with('nl')
- ->will($this->throwException(new RecommendedSiteNotFoundException('error')));
+ ->method('forLanguage')
+ ->with('nl')
+ ->will($this->throwException(new RecommendedSiteNotFoundException('error')));
$out = $this->controller->explore('nl');
diff --git a/tests/Unit/Controller/UtilityApiControllerTest.php b/tests/Unit/Controller/UtilityApiControllerTest.php
index 16d583b71e..4271831ae7 100644
--- a/tests/Unit/Controller/UtilityApiControllerTest.php
+++ b/tests/Unit/Controller/UtilityApiControllerTest.php
@@ -18,7 +18,7 @@
use OCA\News\Controller\UtilityApiController;
use OCA\News\Service\StatusService;
use OCA\News\Service\UpdaterService;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
@@ -29,7 +29,7 @@ class UtilityApiControllerTest extends TestCase
{
/**
- * @var \PHPUnit\Framework\MockObject\MockObject|IConfig
+ * @var \PHPUnit\Framework\MockObject\MockObject|IAppConfig
*/
private $settings;
@@ -71,7 +71,7 @@ class UtilityApiControllerTest extends TestCase
protected function setUp(): void
{
$this->appName = 'news';
- $this->settings = $this->getMockBuilder(IConfig::class)
+ $this->settings = $this->getMockBuilder(IAppConfig::class)
->disableOriginalConstructor()
->getMock();
$this->request = $this->getMockBuilder(IRequest::class)
@@ -105,12 +105,9 @@ protected function setUp(): void
public function testGetVersion()
{
$this->settings->expects($this->once())
- ->method('getAppValue')
- ->with(
- $this->equalTo($this->appName),
- $this->equalTo('installed_version')
- )
- ->will($this->returnValue('1.0'));
+ ->method('getValueString')
+ ->with($this->appName, 'installed_version')
+ ->willReturn('1.0');
$response = $this->newsAPI->version();
$version = $response['version'];
diff --git a/tests/Unit/Search/ItemSearchProviderTest.php b/tests/Unit/Search/ItemSearchProviderTest.php
index c50e32a593..78f369efa7 100644
--- a/tests/Unit/Search/ItemSearchProviderTest.php
+++ b/tests/Unit/Search/ItemSearchProviderTest.php
@@ -9,6 +9,7 @@
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\Search\ISearchQuery;
+use OCP\Search\IFilter;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
@@ -86,10 +87,13 @@ public function testSearch()
$query = $this->getMockBuilder(ISearchQuery::class)
->getMock();
+ $term = $this->getMockBuilder(IFilter::class)
+ ->getMock();
+
$query->expects($this->once())
->method('getCursor')
->willReturn(null);
-
+
$query->expects($this->once())
->method('getLimit')
->willReturn(10);
@@ -99,8 +103,13 @@ public function testSearch()
->willReturn('user');
$query->expects($this->once())
- ->method('getTerm')
- ->willReturn('some text');
+ ->method('getFilter')
+ ->with('term')
+ ->willReturn($term);
+
+ $term->expects($this->once())
+ ->method('get')
+ ->willReturn('some text');
$items = [
diff --git a/tests/Unit/Service/FeedServiceTest.php b/tests/Unit/Service/FeedServiceTest.php
index bcc367f0cf..21131f7418 100644
--- a/tests/Unit/Service/FeedServiceTest.php
+++ b/tests/Unit/Service/FeedServiceTest.php
@@ -17,10 +17,8 @@
use FeedIo\Explorer;
use FeedIo\Reader\ReadErrorException;
-use OC\L10N\L10N;
use OCA\News\Db\FeedMapperV2;
use OCA\News\Fetcher\FeedFetcher;
-use OCA\News\Service\Exceptions\ServiceConflictException;
use OCA\News\Service\Exceptions\ServiceNotFoundException;
use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\ItemServiceV2;
@@ -29,8 +27,6 @@
use OCA\News\Db\Feed;
use OCA\News\Db\Item;
-use OCP\IConfig;
-use OCP\IL10N;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
@@ -72,11 +68,6 @@ class FeedServiceTest extends TestCase
*/
private $purifier;
- /**
- * @var \PHPUnit\Framework\MockObject\MockObject|L10N
- */
- private $l10n;
-
/**
* @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface
*/
@@ -99,9 +90,7 @@ protected function setUp(): void
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
- $this->l10n = $this->getMockBuilder(IL10N::class)
- ->disableOriginalConstructor()
- ->getMock();
+
$this->mapper = $this
->getMockBuilder(FeedMapperV2::class)
->disableOriginalConstructor()
@@ -122,9 +111,6 @@ protected function setUp(): void
->getMockBuilder(\HTMLPurifier::class)
->disableOriginalConstructor()
->getMock();
- $config = $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock();
$this->class = new FeedServiceV2(
$this->mapper,
diff --git a/tests/Unit/Service/FolderServiceTest.php b/tests/Unit/Service/FolderServiceTest.php
index 3e47c6136d..0d3ef8053a 100644
--- a/tests/Unit/Service/FolderServiceTest.php
+++ b/tests/Unit/Service/FolderServiceTest.php
@@ -90,7 +90,7 @@ protected function setUp(): void
$this->logger = $this->getMockBuilder(LoggerInterface::class)
->disableOriginalConstructor()
->getMock();
- $this->class = new FolderServiceV2($this->mapper, $this->feedService, $timeFactory, $this->logger);
+ $this->class = new FolderServiceV2($this->mapper, $this->logger, $this->feedService, $timeFactory);
}
public function testFindAll()
diff --git a/tests/Unit/Service/ImportServiceTest.php b/tests/Unit/Service/ImportServiceTest.php
index 2a6a7b106f..a37b905617 100644
--- a/tests/Unit/Service/ImportServiceTest.php
+++ b/tests/Unit/Service/ImportServiceTest.php
@@ -14,24 +14,12 @@
namespace OCA\News\Tests\Unit\Service;
-use FeedIo\Explorer;
-use FeedIo\Reader\ReadErrorException;
-
-use OC\L10N\L10N;
-use OCA\News\Db\FeedMapperV2;
-use OCA\News\Fetcher\FeedFetcher;
-use OCA\News\Service\Exceptions\ServiceConflictException;
-use OCA\News\Service\Exceptions\ServiceNotFoundException;
use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\ImportService;
use OCA\News\Service\ItemServiceV2;
-use OCA\News\Utility\Time;
-use OCP\AppFramework\Db\DoesNotExistException;
use OCA\News\Db\Feed;
use OCA\News\Db\Item;
-use OCP\IConfig;
-use OCP\IL10N;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
diff --git a/tests/Unit/Service/ItemServiceTest.php b/tests/Unit/Service/ItemServiceTest.php
index 17a67674c9..35dfb2076e 100644
--- a/tests/Unit/Service/ItemServiceTest.php
+++ b/tests/Unit/Service/ItemServiceTest.php
@@ -23,7 +23,7 @@
use \OCA\News\Db\Item;
use \OCA\News\Db\ListType;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
-use OCP\IConfig;
+use OCP\IAppConfig;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
@@ -47,7 +47,7 @@ class ItemServiceTest extends TestCase
private $class;
/**
- * @var MockObject|IConfig
+ * @var MockObject|IAppConfig
*/
private $config;
@@ -70,7 +70,7 @@ protected function setUp(): void
$this->mapper = $this->getMockBuilder(ItemMapperV2::class)
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder(IConfig::class)
+ $this->config = $this->getMockBuilder(IAppConfig::class)
->disableOriginalConstructor()
->getMock();
@@ -80,8 +80,8 @@ protected function setUp(): void
$this->class = new ItemServiceV2(
$this->mapper,
- $this->config,
- $this->logger
+ $this->logger,
+ $this->config
);
$this->user = 'jack';
$this->id = 3;
@@ -605,28 +605,33 @@ public function testPurgeOverThresholdWithNegative()
public function testPurgeOverThresholdNull()
{
- $this->config->expects($this->exactly(2))
- ->method('getAppValue')
- ->withConsecutive(['news', 'autoPurgeCount', 200], ['news', 'purgeUnread', false])
- ->willReturnOnConsecutiveCalls(200, false);
-
+ $this->config->expects($this->exactly(1))
+ ->method('getValueInt')
+ ->with('news', 'autoPurgeCount', 200)
+ ->willReturn(200);
+
+ $this->config->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->with('news', 'purgeUnread', false)
+ ->willReturn(false);
+
$this->mapper->expects($this->once())
- ->method('deleteOverThreshold')
- ->with(200, false);
+ ->method('deleteOverThreshold')
+ ->with(200, false);
$this->class->purgeOverThreshold();
}
public function testPurgeOverThresholdSet()
{
- $this->config->expects($this->once())
- ->method('getAppValue')
- ->with('news', 'purgeUnread', false)
- ->will($this->returnValue(false));
+ $this->config->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->with('news', 'purgeUnread', false)
+ ->willReturn(false);
$this->mapper->expects($this->once())
- ->method('deleteOverThreshold')
- ->with(5);
+ ->method('deleteOverThreshold')
+ ->with(5);
$this->class->purgeOverThreshold(5);
}
diff --git a/tests/Unit/Service/OPMLServiceTest.php b/tests/Unit/Service/OPMLServiceTest.php
index 6f117c0662..35529f3705 100644
--- a/tests/Unit/Service/OPMLServiceTest.php
+++ b/tests/Unit/Service/OPMLServiceTest.php
@@ -14,31 +14,15 @@
namespace OCA\News\Tests\Unit\Service;
-use FeedIo\Explorer;
-use FeedIo\Reader\ReadErrorException;
-
-use OC\L10N\L10N;
-use OCA\News\Db\FeedMapperV2;
use OCA\News\Db\Folder;
-use OCA\News\Fetcher\FeedFetcher;
-use OCA\News\Service\Exceptions\ServiceConflictException;
-use OCA\News\Service\Exceptions\ServiceNotFoundException;
use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\FolderServiceV2;
-use OCA\News\Service\ImportService;
-use OCA\News\Service\ItemServiceV2;
use OCA\News\Service\OpmlService;
use OCA\News\Utility\OPMLExporter;
-use OCA\News\Utility\Time;
-use OCP\AppFramework\Db\DoesNotExistException;
use OCA\News\Db\Feed;
-use OCA\News\Db\Item;
-use OCP\IConfig;
-use OCP\IL10N;
use PHPUnit\Framework\TestCase;
-use Psr\Log\LoggerInterface;
class OPMLServiceTest extends TestCase
diff --git a/tests/Unit/Service/ShareServiceTest.php b/tests/Unit/Service/ShareServiceTest.php
index d7c26a9181..164f972d21 100644
--- a/tests/Unit/Service/ShareServiceTest.php
+++ b/tests/Unit/Service/ShareServiceTest.php
@@ -11,24 +11,16 @@
namespace OCA\News\Tests\Unit\Service;
-use FeedIo\Explorer;
-use FeedIo\Reader\ReadErrorException;
-
-use OC\L10N\L10N;
-use OCA\News\Service\Exceptions\ServiceConflictException;
use OCA\News\Service\Exceptions\ServiceNotFoundException;
-use OCP\AppFramework\Db\DoesNotExistException;
use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\ItemServiceV2;
use OCA\News\Service\ShareService;
-use OCA\News\Utility\Time;
use OCA\News\Db\Feed;
use OCA\News\Db\Item;
use OCP\IURLGenerator;
use OCP\IUserManager;
-use OCP\IConfig;
use OCP\IL10N;
use OCP\IUser;
diff --git a/tests/Unit/Service/StatusServiceTest.php b/tests/Unit/Service/StatusServiceTest.php
index fdfe41af5c..c83f62aef8 100644
--- a/tests/Unit/Service/StatusServiceTest.php
+++ b/tests/Unit/Service/StatusServiceTest.php
@@ -14,7 +14,7 @@
namespace OCA\News\Tests\Unit\Service;
use OCA\News\Service\StatusService;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\BackgroundJob\IJobList;
use PHPUnit\Framework\MockObject\MockObject;
@@ -24,7 +24,7 @@
class StatusServiceTest extends TestCase
{
/**
- * @var MockObject|IConfig
+ * @var MockObject|IAppConfig
*/
private $settings;
@@ -46,7 +46,7 @@ class StatusServiceTest extends TestCase
public function setUp(): void
{
- $this->settings = $this->getMockBuilder(IConfig::class)
+ $this->settings = $this->getMockBuilder(IAppConfig::class)
->disableOriginalConstructor()
->getMock();
$this->connection = $this->getMockBuilder(IDBConnection::class)
@@ -60,19 +60,19 @@ public function setUp(): void
public function testGetStatus()
{
- $this->settings->expects($this->exactly(3))
- ->method('getAppValue')
- ->withConsecutive(
- ['news', 'installed_version'],
- ['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
- )
+ $this->settings->expects($this->exactly(2))
+ ->method('getValueString')
->will($this->returnValueMap([
['news', 'installed_version', '', '1.0'],
['core', 'backgroundjobs_mode', '', 'cron'],
- ['news', 'useCronUpdates', true, true],
]));
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$this->connection->expects($this->exactly(1))
->method('supports4ByteText')
->will($this->returnValue(true));
@@ -90,19 +90,27 @@ public function testGetStatus()
public function testGetStatusNoCorrectCronAjax()
{
- $this->settings->expects($this->exactly(3))
- ->method('getAppValue')
+ $this->settings->expects($this->exactly(2))
+ ->method('getValueString')
->withConsecutive(
['news', 'installed_version'],
['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
)
->will($this->returnValueMap([
['news', 'installed_version', '', '1.0'],
['core', 'backgroundjobs_mode', '', 'ajax'],
- ['news', 'useCronUpdates', true, true],
]));
+
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->withConsecutive(
+ ['news', 'useCronUpdates']
+ )
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$this->connection->expects($this->exactly(1))
->method('supports4ByteText')
->will($this->returnValue(true));
@@ -120,19 +128,27 @@ public function testGetStatusNoCorrectCronAjax()
public function testGetStatusNoCorrectCronTurnedOff()
{
- $this->settings->expects($this->exactly(3))
- ->method('getAppValue')
+ $this->settings->expects($this->exactly(2))
+ ->method('getValueString')
->withConsecutive(
['news', 'installed_version'],
['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
)
->will($this->returnValueMap([
['news', 'installed_version', '', '1.0'],
['core', 'backgroundjobs_mode', '', 'ajax'],
- ['news', 'useCronUpdates', true, false],
]));
+
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->withConsecutive(
+ ['news', 'useCronUpdates']
+ )
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$this->connection->expects($this->exactly(1))
->method('supports4ByteText')
->will($this->returnValue(true));
@@ -150,19 +166,27 @@ public function testGetStatusNoCorrectCronTurnedOff()
public function testGetStatusReportsNon4ByteText()
{
- $this->settings->expects($this->exactly(3))
- ->method('getAppValue')
+ $this->settings->expects($this->exactly(2))
+ ->method('getValueString')
->withConsecutive(
['news', 'installed_version'],
['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
)
->will($this->returnValueMap([
['news', 'installed_version', '', '1.0'],
['core', 'backgroundjobs_mode', '', 'ajax'],
- ['news', 'useCronUpdates', true, false],
]));
+
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->withConsecutive(
+ ['news', 'useCronUpdates']
+ )
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$this->connection->expects($this->exactly(1))
->method('supports4ByteText')
->will($this->returnValue(false));
@@ -180,53 +204,81 @@ public function testGetStatusReportsNon4ByteText()
public function testIsProperlyConfiguredNone()
{
- $this->settings->expects($this->exactly(2))
- ->method('getAppValue')
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueString')
->withConsecutive(
['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
)
->will($this->returnValueMap([
['core', 'backgroundjobs_mode', '', 'ajax'],
- ['news', 'useCronUpdates', true, true],
]));
+
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->withConsecutive(
+ ['news', 'useCronUpdates']
+ )
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$response = $this->service->isCronProperlyConfigured();
$this->assertFalse($response);
}
public function testIsProperlyConfiguredModeCronNoSystem()
{
- $this->settings->expects($this->exactly(2))
- ->method('getAppValue')
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueString')
->withConsecutive(
+ ['news', 'installed_version'],
['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
)
->will($this->returnValueMap([
+ ['news', 'installed_version', '', '1.0'],
['core', 'backgroundjobs_mode', '', 'cron'],
- ['news', 'useCronUpdates', true, false],
]));
+
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->withConsecutive(
+ ['news', 'useCronUpdates']
+ )
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$response = $this->service->isCronProperlyConfigured();
$this->assertTrue($response);
}
public function testIsProperlyConfiguredModeCron()
{
- $this->settings->expects($this->exactly(2))
- ->method('getAppValue')
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueString')
->withConsecutive(
+ ['news', 'installed_version'],
['core', 'backgroundjobs_mode'],
- ['news', 'useCronUpdates']
)
->will($this->returnValueMap([
+ ['news', 'installed_version', '', '1.0'],
['core', 'backgroundjobs_mode', '', 'cron'],
- ['news', 'useCronUpdates', true, false],
]));
+
+ $this->settings->expects($this->exactly(1))
+ ->method('getValueBool')
+ ->withConsecutive(
+ ['news', 'useCronUpdates']
+ )
+ ->will($this->returnValueMap([
+ ['news', 'useCronUpdates', true, true],
+ ]));
+
$response = $this->service->isCronProperlyConfigured();
$this->assertTrue($response);
}
-}
\ No newline at end of file
+}