diff --git a/.github/phpunit-mariadb-github.xml b/.github/phpunit-mariadb-github.xml index 74b3b85483..e301ced053 100644 --- a/.github/phpunit-mariadb-github.xml +++ b/.github/phpunit-mariadb-github.xml @@ -1,39 +1,36 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + diff --git a/.github/phpunit-mssql-github.xml b/.github/phpunit-mssql-github.xml index 37c1deae2d..b3061cce0e 100644 --- a/.github/phpunit-mssql-github.xml +++ b/.github/phpunit-mssql-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-mysql-github.xml b/.github/phpunit-mysql-github.xml index d14359d618..e15519e8b2 100644 --- a/.github/phpunit-mysql-github.xml +++ b/.github/phpunit-mysql-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-postgres-github.xml b/.github/phpunit-postgres-github.xml index 2648f27bef..57333dacc5 100644 --- a/.github/phpunit-postgres-github.xml +++ b/.github/phpunit-postgres-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-psql-windows-github.xml b/.github/phpunit-psql-windows-github.xml index 5f131bae80..ab0c060010 100644 --- a/.github/phpunit-psql-windows-github.xml +++ b/.github/phpunit-psql-windows-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-sqlite3-github.xml b/.github/phpunit-sqlite3-github.xml index b079a0bbbe..5c7e931b48 100644 --- a/.github/phpunit-sqlite3-github.xml +++ b/.github/phpunit-sqlite3-github.xml @@ -1,35 +1,32 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 28d64bc69a..72bd7d6d42 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -249,7 +249,7 @@ jobs: DB: ${{steps.database-type.outputs.db}} if: ${{ matrix.SLOWTESTS != 1 && matrix.NOTESTS != 1 }} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error + phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --display-all-issues --stop-on-error - name: Slow tests env: @@ -378,7 +378,7 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error + phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --display-all-issues --stop-on-error # Other database types, namely sqlite3 and mssql other-tests: @@ -491,7 +491,7 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error + phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --display-all-issues --stop-on-error # Test with IIS & PostgreSQL on Windows windows-tests: @@ -606,8 +606,8 @@ jobs: - name: Run unit tests if: ${{ matrix.type == 'unit' }} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --exclude-group functional,slow + phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow - name: Run functional tests if: ${{ matrix.type == 'functional' }} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --group functional + phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --group functional diff --git a/phpBB/composer.json b/phpBB/composer.json index 1bc456f32f..7dfe52b322 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -65,7 +65,7 @@ "laravel/homestead": "~14.4", "misantron/dbunit": "~5.0", "phing/phing": "~2.4", - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^10.0", "squizlabs/php_codesniffer": "~3.4", "symfony/browser-kit": "^6.3", "symfony/css-selector": "^6.3", diff --git a/phpBB/composer.lock b/phpBB/composer.lock index dad535bf0b..eed819db81 100644 --- a/phpBB/composer.lock +++ b/phpBB/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": "39f3a7c03ba85a8c7892e5c076372eb0", + "content-hash": "9f600f681e6bb2efaa5a7c6a445e09bf", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -6869,76 +6869,6 @@ }, "time": "2019-12-04T15:06:13+00:00" }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "felixfbecker/advanced-json-rpc", "version": "v3.2.1", @@ -7279,16 +7209,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.13.0", + "version": "1.13.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414" + "reference": "faed855a7b5f4d4637717c2b3863e277116beb36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/faed855a7b5f4d4637717c2b3863e277116beb36", + "reference": "faed855a7b5f4d4637717c2b3863e277116beb36", "shasum": "" }, "require": { @@ -7327,7 +7257,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.3" }, "funding": [ { @@ -7335,7 +7265,7 @@ "type": "tidelift" } ], - "time": "2025-02-12T12:17:51+00:00" + "time": "2025-07-05T12:25:42+00:00" }, { "name": "netresearch/jsonmapper", @@ -7898,16 +7828,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "10.1.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", "shasum": "" }, "require": { @@ -7915,18 +7845,18 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "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", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -7935,7 +7865,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "10.1.x-dev" } }, "autoload": { @@ -7964,7 +7894,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.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" }, "funding": [ { @@ -7972,32 +7902,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-08-22T04:31:57+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -8024,7 +7954,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -8032,28 +7963,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -8061,7 +7992,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -8087,7 +8018,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -8095,32 +8026,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -8146,7 +8077,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -8154,32 +8086,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -8205,7 +8137,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -8213,54 +8145,52 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.22", + "version": "10.5.48", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c" + "reference": "6e0a2bc39f6fae7617989d690d76c48e6d2eb541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6e0a2bc39f6fae7617989d690d76c48e6d2eb541", + "reference": "6e0a2bc39f6fae7617989d690d76c48e6d2eb541", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.1", + "myclabs/deep-copy": "^1.13.3", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.3", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -8268,7 +8198,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "10.5-dev" } }, "autoload": { @@ -8300,7 +8230,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.48" }, "funding": [ { @@ -8311,12 +8241,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2024-12-05T13:48:26+00:00" + "time": "2025-07-11T04:07:17+00:00" }, { "name": "psalm/plugin-symfony", @@ -8385,28 +8323,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -8429,7 +8367,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" }, "funding": [ { @@ -8437,32 +8376,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-03-02T07:12:49+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -8485,7 +8424,7 @@ "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" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -8493,32 +8432,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -8540,7 +8479,7 @@ "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" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -8548,34 +8487,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e", + "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -8614,7 +8555,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.3" }, "funding": [ { @@ -8622,33 +8564,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-10-18T14:56:07+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -8671,7 +8613,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -8679,33 +8622,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -8737,7 +8680,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -8745,27 +8689,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-03-02T07:15:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -8773,7 +8717,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -8792,7 +8736,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -8800,7 +8744,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" }, "funding": [ { @@ -8808,34 +8753,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-03-23T08:47:14+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -8877,7 +8822,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" }, "funding": [ { @@ -8885,38 +8831,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-03-02T07:17:12+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -8935,13 +8878,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" }, "funding": [ { @@ -8949,33 +8893,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-03-02T07:19:19+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -8998,7 +8942,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -9006,34 +8951,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -9055,7 +9000,7 @@ "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" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -9063,32 +9008,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -9110,7 +9055,7 @@ "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" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -9118,32 +9063,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -9173,7 +9118,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -9181,86 +9126,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -9283,7 +9174,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -9291,29 +9182,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -9336,7 +9227,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -9344,7 +9235,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "spatie/array-to-xml", diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 5e588764bd..c96d67d9d7 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -556,6 +556,7 @@ class compress_tar extends compress { var $isgz = false; var $isbz = false; + var $file = ''; var $filename = ''; var $mode = ''; var $type = ''; diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 0a4ea304ad..4ccd0607cd 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -45,6 +45,30 @@ abstract class memory extends \phpbb\cache\driver\base } } + /** + * {@inheritDoc} + */ + function purge() + { + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + if (function_exists('opcache_reset')) + { + @opcache_reset(); + } + + $this->vars = []; + $this->sql_rowset = []; + $this->sql_row_pointer = []; + + $this->is_modified = true; + + // We save here to let the following cache hits succeed + $this->save(); + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php index 6f103bf0f0..5a8332a15b 100644 --- a/phpBB/phpbb/cache/driver/redis.php +++ b/phpBB/phpbb/cache/driver/redis.php @@ -141,7 +141,7 @@ class redis extends \phpbb\cache\driver\memory */ protected function _delete(string $var): bool { - if ($this->redis->delete($var) > 0) + if ($this->redis->del($var) > 0) { return true; } diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 46e7edffd2..59595a9c60 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -573,7 +573,7 @@ class container_builder } $config_data = $this->config_php_file->get_all(); - if (!empty($config_data)) + if (!empty($config_data) && !empty($config_data['dbms'])) { if ($this->dbal_connection === null) { @@ -592,6 +592,10 @@ class container_builder } $this->container->set('dbal.conn.driver', $this->dbal_connection); } + else + { + return; + } } /** diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index 0ab19c5bb3..7056bda350 100644 --- a/phpBB/phpbb/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php @@ -70,11 +70,11 @@ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAgg /** * Redirects isset to the correct request class call. * - * @param string $offset The key of the super global being accessed. + * @param mixed $offset The key of the super global being accessed. * * @return bool Whether the key on the super global exists. */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return $this->request->is_set($offset, $this->super_global); } @@ -82,17 +82,17 @@ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAgg /**#@+ * Part of the \ArrayAccess implementation, will always result in a FATAL error. */ - public function offsetGet($offset): void + #[\ReturnTypeWillChange] public function offsetGet($offset): void { $this->error(); } - public function offsetSet($offset, $value): void + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->error(); } - public function offsetUnset($offset): void + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { $this->error(); } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index f3f4cd04c4..e90539a8a0 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -27,7 +27,7 @@ class user extends \phpbb\session protected $language; var $style = array(); - var $date_format; + var $date_format = ''; /** * DateTimeZone object holding the timezone of the user @@ -627,12 +627,12 @@ class user extends \phpbb\session * Format user date * * @param int $gmepoch unix timestamp - * @param string|false $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. + * @param string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. * @param bool $forcedate force non-relative date format. * * @return mixed translated date */ - function format_date($gmepoch, $format = false, $forcedate = false) + function format_date($gmepoch, $format = '', $forcedate = false) { global $phpbb_dispatcher; static $utc; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 722d67774a..58d0d5c1df 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,13 @@ - - - ./phpBB/includes/ - ./phpBB/phpbb/ - - + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" + backupGlobals="true" + colors="true" + processIsolation="false" + stopOnFailure="false" + bootstrap="tests/bootstrap.php" + cacheDirectory=".phpunit.cache" + backupStaticProperties="false"> ./tests @@ -35,4 +26,10 @@ slow + + + ./phpBB/includes/ + ./phpBB/phpbb/ + + diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php index e92319c078..73b7d75539 100644 --- a/tests/attachment/delete_test.php +++ b/tests/attachment/delete_test.php @@ -53,7 +53,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case $this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->resync, $this->storage); } - public function data_attachment_delete() + public static function data_attachment_delete() { return array( array('attach', '', false, false), @@ -83,7 +83,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case $this->assertSame($expected, $this->attachment_delete->delete($mode, $ids, $resync)); } - public function data_attachment_unlink() + public static function data_attachment_unlink() { return array( array(true, true), diff --git a/tests/attachment/manager_test.php b/tests/attachment/manager_test.php index 8fcea043eb..88e39ed671 100644 --- a/tests/attachment/manager_test.php +++ b/tests/attachment/manager_test.php @@ -21,15 +21,15 @@ class phpbb_attachment_manager_test extends \phpbb_test_case { $this->delete = $this->getMockBuilder('\phpbb\attachment\delete') ->disableOriginalConstructor() - ->setMethods(['delete', 'unlink_attachment']) + ->onlyMethods(['delete', 'unlink_attachment']) ->getMock(); $this->resync = $this->getMockBuilder('\phpbb\attachment\resync') ->disableOriginalConstructor() - ->setMethods(['resync']) + ->onlyMethods(['resync']) ->getMock(); $this->upload = $this->getMockBuilder('\phpbb\attachment\upload') ->disableOriginalConstructor() - ->setMethods(['upload']) + ->onlyMethods(['upload']) ->getMock(); } @@ -38,7 +38,7 @@ class phpbb_attachment_manager_test extends \phpbb_test_case return new \phpbb\attachment\manager($this->delete, $this->resync, $this->upload); } - public function data_manager() + public static function data_manager() { return array( array( diff --git a/tests/attachment/resync_test.php b/tests/attachment/resync_test.php index 9cadbea047..2168d68cf4 100644 --- a/tests/attachment/resync_test.php +++ b/tests/attachment/resync_test.php @@ -32,7 +32,7 @@ class phpbb_attachment_resync_test extends \phpbb_database_test_case $this->resync = new \phpbb\attachment\resync($this->db); } - public function data_resync() + public static function data_resync() { return array( array('', array(1), 'post_id', POSTS_TABLE, array('post_attachment' => '1'), array('post_attachment' => '1')), diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 609ee99536..76237021ec 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -165,7 +165,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case ); } - public function data_upload() + public static function data_upload() { return array( array('foobar', 1, false, @@ -280,7 +280,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case ), $filedata); } - public function data_image_upload() + public static function data_image_upload() { return array( array(false, false, array(), @@ -365,7 +365,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case public function test_image_upload($is_image, $plupload_active, $config_data, $expected) { $filespec = $this->getMockBuilder('\phpbb\files\filespec_storage') - ->setMethods(array( + ->onlyMethods(array( 'init_error', 'is_image', 'move_file', diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php index 2fcb5b8484..f291751575 100644 --- a/tests/auth/provider_apache_test.php +++ b/tests/auth/provider_apache_test.php @@ -74,8 +74,10 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case ->will($this->returnValue(true)); $this->request->expects($this->exactly(2)) ->method('server') - ->withConsecutive(['PHP_AUTH_USER'], ['PHP_AUTH_PW']) - ->will($this->onConsecutiveCalls($this->returnValue('foobar'), $this->returnValue('example'))); + ->willReturnCallback(fn(string $arg) => match(true) { + $arg === 'PHP_AUTH_USER' => 'foobar', + $arg === 'PHP_AUTH_PW' => 'example', + }); $expected = array( 'status' => LOGIN_SUCCESS, @@ -102,8 +104,10 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case ->will($this->returnValue(true)); $this->request->expects($this->exactly(2)) ->method('server') - ->withConsecutive(['PHP_AUTH_USER'], ['PHP_AUTH_PW']) - ->will($this->onConsecutiveCalls($this->returnValue('foobar'), $this->returnValue('example'))); + ->willReturnCallback(fn(string $arg) => match(true) { + $arg === 'PHP_AUTH_USER' => 'foobar', + $arg === 'PHP_AUTH_PW' => 'example', + }); $expected = array( 'user_id' => 1, diff --git a/tests/avatar/driver_gravatar_test.php b/tests/avatar/driver_gravatar_test.php index 27ab847ff7..026655e11a 100644 --- a/tests/avatar/driver_gravatar_test.php +++ b/tests/avatar/driver_gravatar_test.php @@ -89,7 +89,7 @@ class phpbb_avatar_driver_gravatar_test extends \phpbb_database_test_case $this->template_data = array_merge($this->template_data, $data); } - public function data_prepare_form(): array + public static function data_prepare_form(): array { return [ [ diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 576950374e..347f1597a4 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -12,6 +12,7 @@ */ require_once __DIR__ . '/driver/foobar.php'; +require_once __DIR__ . '/driver/barfoo.php'; class phpbb_avatar_manager_test extends \phpbb_database_test_case { @@ -62,15 +63,15 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case // $this->avatar_foobar will be needed later on $this->avatar_foobar = $this->getMockBuilder('\phpbb\avatar\driver\foobar') - ->setMethods(array('get_name')) + ->onlyMethods(array('get_name')) ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) ->getMock(); $this->avatar_foobar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.foobar')); - // barfoo driver can't be mocked with constructor arguments $this->avatar_barfoo = $this->getMockBuilder('\phpbb\avatar\driver\barfoo') - ->setMethods(array('get_name', 'get_config_name')) + ->onlyMethods(array('get_name', 'get_config_name')) + ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) ->getMock(); $this->avatar_barfoo->expects($this->any()) ->method('get_name') @@ -89,14 +90,14 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case if ($driver !== 'upload') { $cur_avatar = $this->getMockBuilder('\phpbb\avatar\driver\\' . $driver) - ->setMethods(array('get_name')) + ->onlyMethods(array('get_name')) ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) ->getMock(); } else { $cur_avatar = $this->getMockBuilder('\phpbb\avatar\driver\\' . $driver) - ->setMethods(array('get_name')) + ->onlyMethods(array('get_name')) ->setConstructorArgs(array($this->config, $phpbb_root_path, $phpEx, $storage, $path_helper, $routing_helper, $dispatcher, $files_factory, $php_ini)) ->getMock(); } @@ -147,7 +148,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals('avatar.driver.foobar', $drivers['avatar.driver.foobar']); } - public function get_driver_data_enabled() + public static function get_driver_data_enabled() { return array( array('avatar.driver.foobar', 'avatar.driver.foobar'), @@ -168,7 +169,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals($expected, ($driver === null) ? null : $driver->get_name()); } - public function get_driver_data_all() + public static function get_driver_data_all() { return array( array('avatar.driver.foobar', 'avatar.driver.foobar'), @@ -204,7 +205,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals($expected_settings, $avatar_settings); } - public function database_row_data() + public static function database_row_data() { return array( array( @@ -302,7 +303,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case global $phpbb_root_path, $phpEx; $user = $this->getMockBuilder('\phpbb\user') - ->setMethods(array()) + ->onlyMethods(['lang']) ->setConstructorArgs(array(new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime')) ->getMock(); $lang_array = array( @@ -326,7 +327,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case ))); } - public function data_handle_avatar_delete() + public static function data_handle_avatar_delete() { return array( array( diff --git a/tests/ban/ban_manager_test.php b/tests/ban/ban_manager_test.php index 2eb49686d6..cdc64435b5 100644 --- a/tests/ban/ban_manager_test.php +++ b/tests/ban/ban_manager_test.php @@ -55,7 +55,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->phpbb_container = $phpbb_container; } - public function data_check_ban(): array + public static function data_check_ban(): array { return [ [ @@ -170,7 +170,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->assertEquals($expected, $this->ban_manager->check($user_data)); } - public function data_get_bans(): array + public static function data_get_bans(): array { return [ [ @@ -298,7 +298,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->assertEquals($expected, $actual); } - public function data_get_ban_end(): array + public static function data_get_ban_end(): array { return [ [ @@ -457,7 +457,7 @@ class ban_manager_test extends \phpbb_session_test_case )); } - public function data_test_ban(): array + public static function data_test_ban(): array { return [ [ @@ -629,7 +629,7 @@ class ban_manager_test extends \phpbb_session_test_case ); } - public function data_test_unban(): array + public static function data_test_unban(): array { return [ [ @@ -700,7 +700,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->assertFalse($check->invoke($ban_type_ip, [], [])); } - public function data_get_ban_message(): array + public static function data_get_ban_message(): array { return [ [ diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php index f5f11ae900..1786fabc5f 100644 --- a/tests/bbcode/parser_test.php +++ b/tests/bbcode/parser_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; class phpbb_bbcode_parser_test extends \phpbb_test_case { - public function bbcode_firstpass_data() + public static function bbcode_firstpass_data() { return array( // Default bbcodes from in their simplest way @@ -249,10 +249,18 @@ class phpbb_bbcode_parser_test extends \phpbb_test_case $this->markTestIncomplete($incomplete); } - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $phpbb_dispatcher, $config, $phpEx; + $phpEx = 'php'; + $config = new \phpbb\config\config([ + 'max_post_font_size' => 0, + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user; + $user->lang['UNAUTHORISED_BBCODE'] = 'UNAUTHORISED_BBCODE'; $request = new phpbb_mock_request; $symfony_request = new \phpbb\symfony_request($request); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $bbcode = new bbcode_firstpass(); $bbcode->mode = 'post'; diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php index 2dfed41b95..5f42f1d4bb 100644 --- a/tests/bbcode/url_bbcode_test.php +++ b/tests/bbcode/url_bbcode_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; class phpbb_url_bbcode_test extends phpbb_test_case { - public function url_bbcode_test_data() + public static function url_bbcode_test_data() { return array( array( @@ -52,10 +52,18 @@ class phpbb_url_bbcode_test extends phpbb_test_case */ public function test_url($description, $message, $expected) { - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $phpbb_dispatcher, $config, $phpEx; + $phpEx = 'php'; + $config = new \phpbb\config\config([ + 'max_post_font_size' => 0, + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user; + $user->lang['UNAUTHORISED_BBCODE'] = 'UNAUTHORISED_BBCODE'; $request = new phpbb_mock_request; $symfony_request = new \phpbb\symfony_request($request); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $bbcode = new bbcode_firstpass(); $bbcode->message = $message; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7556dd8c90..9efef937a4 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,13 +14,14 @@ define('IN_PHPBB', true); define('PHPBB_ENVIRONMENT', 'test'); +global $phpbb_class_loader, $phpbb_class_loader_mock, $phpbb_class_loader_ext, $phpbb_class_loader_tests; +global $phpbb_root_path, $phpEx, $table_prefix; + $phpbb_root_path = 'phpBB/'; $phpEx = 'php'; - -global $table_prefix; -require_once $phpbb_root_path . 'includes/startup.php'; - $table_prefix = 'phpbb_'; + +require_once $phpbb_root_path . 'includes/startup.php'; require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx; require_once $phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx; diff --git a/tests/cache/memcached_test.php b/tests/cache/memcached_driver_test.php similarity index 100% rename from tests/cache/memcached_test.php rename to tests/cache/memcached_driver_test.php diff --git a/tests/cache/redis_driver_test.php b/tests/cache/redis_driver_test.php index ec9de385a1..49f748526b 100644 --- a/tests/cache/redis_driver_test.php +++ b/tests/cache/redis_driver_test.php @@ -32,7 +32,7 @@ class phpbb_cache_redis_driver_test extends \phpbb_cache_common_test_case $config = phpbb_test_case_helpers::get_test_config(); if (isset($config['redis_host']) || isset($config['redis_port'])) { - $host = isset($config['redis_host']) ? $config['redis_host'] : 'localhost'; + $host = isset($config['redis_host']) ? $config['redis_host'] : '0.0.0.0'; $port = isset($config['redis_port']) ? $config['redis_port'] : 6379; self::$config = array('host' => $host, 'port' => $port); } @@ -46,12 +46,14 @@ class phpbb_cache_redis_driver_test extends \phpbb_cache_common_test_case protected function setUp(): void { - global $phpbb_root_path, $phpbb_container; + global $phpbb_root_path, $phpbb_container, $dbname, $table_prefix; parent::setUp(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/'); + $config = phpbb_test_case_helpers::get_test_config(); + $dbname = $config['dbname']; $this->driver = new \phpbb\cache\driver\redis(self::$config['host'], self::$config['port']); $this->driver->purge(); } diff --git a/tests/captcha/qa_test.php b/tests/captcha/qa_test.php index 1c61a7d10c..b91db97d6e 100644 --- a/tests/captcha/qa_test.php +++ b/tests/captcha/qa_test.php @@ -51,7 +51,7 @@ class phpbb_captcha_qa_test extends \phpbb_database_test_case $this->assertSame('foobar', $this->qa->get_service_name()); } - public function data_acp_get_question_input() + public static function data_acp_get_question_input() { return array( array("foobar\ntest\nyes", array( diff --git a/tests/captcha/turnstile_test.php b/tests/captcha/turnstile_test.php index 995a5fdc72..8d3c995810 100644 --- a/tests/captcha/turnstile_test.php +++ b/tests/captcha/turnstile_test.php @@ -454,7 +454,7 @@ class phpbb_captcha_turnstile_test extends \phpbb_database_test_case ->expects($matcher) ->method('assign_vars') ->willReturnCallback(function ($template_data) use ($matcher, $expected) { - $callNr = $matcher->getInvocationCount(); + $callNr = $matcher->numberOfInvocations(); $this->assertEquals($expected[$callNr], $template_data); }); diff --git a/tests/compress/compress_test.php b/tests/compress/compress_test.php index 4d1f1fb018..7e77dc0349 100644 --- a/tests/compress/compress_test.php +++ b/tests/compress/compress_test.php @@ -120,7 +120,7 @@ class phpbb_compress_test extends phpbb_test_case } } - public function tar_archive_list() + public static function tar_archive_list() { return array( array('archive.tar', '.tar', array()), diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index 5a3e075b94..1e245f88ae 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -21,9 +21,10 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case { protected $cache_dir; protected $cache; + protected $config; protected $db; protected $db_tools; - protected $config; + protected $language; protected $user; protected function setUp(): void diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php index cdda4fb886..2bd884127e 100644 --- a/tests/console/cron/cron_list_test.php +++ b/tests/console/cron/cron_list_test.php @@ -76,7 +76,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case )); $mock_router = $this->getMockBuilder('\phpbb\routing\router') - ->setMethods(array('setContext', 'generate')) + ->onlyMethods(array('setContext', 'generate')) ->disableOriginalConstructor() ->getMock(); $mock_router->method('setContext') diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index 90fa2a9fd0..9ba01d217f 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -53,7 +53,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case )); $mock_router = $this->getMockBuilder('\phpbb\routing\router') - ->setMethods(array('setContext', 'generate')) + ->onlyMethods(array('setContext', 'generate')) ->disableOriginalConstructor() ->getMock(); $mock_router->method('setContext') @@ -132,7 +132,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case )); $mock_router = $this->getMockBuilder('\phpbb\routing\router') - ->setMethods(array('setContext', 'generate')) + ->onlyMethods(array('setContext', 'generate')) ->disableOriginalConstructor() ->getMock(); $mock_router->method('setContext') @@ -180,7 +180,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case )); $mock_router = $this->getMockBuilder('\phpbb\routing\router') - ->setMethods(array('setContext', 'generate')) + ->onlyMethods(array('setContext', 'generate')) ->disableOriginalConstructor() ->getMock(); $mock_router->method('setContext') diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index 3a006d27d7..aa5e72bb82 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -23,6 +23,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case protected $db; protected $config; protected $cache; + protected $language; protected $user; protected $storage; protected $temp; diff --git a/tests/console/user/activate_test.php b/tests/console/user/activate_test.php index 2ff65c3e3b..0f5830ee6b 100644 --- a/tests/console/user/activate_test.php +++ b/tests/console/user/activate_test.php @@ -50,7 +50,7 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base return new CommandTester($command); } - public function activate_test_data() + public static function activate_test_data() { return array( // Test an inactive user diff --git a/tests/console/user/add_test.php b/tests/console/user/add_test.php index fb2618787e..0a3aab5422 100644 --- a/tests/console/user/add_test.php +++ b/tests/console/user/add_test.php @@ -62,7 +62,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base return $response; }; $helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\QuestionHelper') - ->setMethods(['ask']) + ->onlyMethods(['ask']) ->disableOriginalConstructor() ->getMock(); $helper->expects($this->any()) diff --git a/tests/console/user/base.php b/tests/console/user/base.php index 511cfff9a3..06e80200b5 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -15,12 +15,14 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case { protected $db; protected $config; + protected $email; protected $user; protected $language; protected $log; protected $passwords_manager; /** @var Symfony\Component\Console\Helper\QuestionHelper */ protected $question; + protected $command_name; protected $user_loader; protected $phpbb_root_path; protected $php_ext; diff --git a/tests/console/user/delete_id_test.php b/tests/console/user/delete_ids_test.php similarity index 100% rename from tests/console/user/delete_id_test.php rename to tests/console/user/delete_ids_test.php diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index b880c8f08f..2d9f32fa3f 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -21,7 +21,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/fixtures/delete_post.xml'); } - public function delete_post_data() + public static function delete_post_data() { $info_data = array( 'topic_first_post_id' => 1, diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index f698e88033..1ae4c5ae8e 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -18,7 +18,7 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data return $this->createXMLDataSet(__DIR__ . '/fixtures/get_forums_visibility_sql.xml'); } - public function get_forums_visibility_sql_data() + public static function get_forums_visibility_sql_data() { return array( array( diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 897bcad3e6..198556132f 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -18,7 +18,7 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data return $this->createXMLDataSet(__DIR__ . '/fixtures/get_forums_visibility_sql.xml'); } - public function get_global_visibility_sql_data() + public static function get_global_visibility_sql_data() { return array( array( diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index 8dafc522aa..42f36a3c4d 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -18,7 +18,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te return $this->createXMLDataSet(__DIR__ . '/fixtures/get_visibility_sql.xml'); } - public function get_visibility_sql_data() + public static function get_visibility_sql_data() { return array( // data set 0: display_unapproved_posts=false, moderator, can see all posts diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index e3fc946fbd..4191402de7 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -21,7 +21,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t return $this->createXMLDataSet(__DIR__ . '/fixtures/set_post_visibility.xml'); } - public function set_post_visibility_data() + public static function set_post_visibility_data() { return array( array( @@ -155,7 +155,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t } } - public function set_post_soft_deleted_data() + public static function set_post_soft_deleted_data() { return array( array( diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 447ae9e1d8..491901cde0 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -21,7 +21,7 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ return $this->createXMLDataSet(__DIR__ . '/fixtures/set_topic_visibility.xml'); } - public function set_topic_visibility_data() + public static function set_topic_visibility_data() { return array( array( diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 0cd52b7d8b..61fd9bf3cb 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -79,7 +79,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ return 'app.php'; } - protected function path_to_app() + protected static function path_to_app() { return ''; } @@ -166,36 +166,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $this->root_path = $this->get_phpbb_root_path(); } - public function helper_url_data_no_rewrite() + public static function helper_url_data_no_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '/' . static::path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -229,36 +229,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description); } - public function helper_url_data_with_rewrite() + public static function helper_url_data_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . static::path_to_app() . 'foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '/' . static::path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -292,36 +292,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description); } - public function helper_url_data_absolute() + public static function helper_url_data_absolute() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -355,7 +355,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description); } - public function helper_url_data_relative_path() + public static function helper_url_data_relative_path() { return array( array('controller2', array('t' => 1, 'f' => 2), true, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), @@ -418,36 +418,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description); } - public function helper_url_data_network() + public static function helper_url_data_network() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -481,36 +481,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description); } - public function helper_url_data_absolute_with_rewrite() + public static function helper_url_data_absolute_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, 'http://localhost/' . static::path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -544,7 +544,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description); } - public function helper_url_data_relative_path_with_rewrite() + public static function helper_url_data_relative_path_with_rewrite() { return array( array('controller2', array('t' => 1, 'f' => 2), true, false, 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), @@ -604,36 +604,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description); } - public function helper_url_data_network_with_rewrite() + public static function helper_url_data_network_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '//localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '//localhost/' . static::path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -667,7 +667,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description); } - public function helper_url_data_force_server_vars() + public static function helper_url_data_force_server_vars() { return array( array(false, true, 'my_server', 443, '/my/board', 'http://', UrlGeneratorInterface::ABSOLUTE_URL, 'http://my_server:443/my/board/app.php/foo'), diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 03d8e89d87..58e1566a04 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -102,7 +102,7 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->assertEquals(array(), $resolver->getArguments($symfony_request, $resolver->getController($symfony_request))); } - public function data_get_arguments() + public static function data_get_arguments() { return array( array(array(new foo\controller(), 'handle2'), array('foo', 0)), diff --git a/tests/controller/helper_route_other_app.php b/tests/controller/helper_route_other_app.php index 2ee291efcf..8e9a9ac0af 100644 --- a/tests/controller/helper_route_other_app.php +++ b/tests/controller/helper_route_other_app.php @@ -30,7 +30,7 @@ class phpbb_controller_helper_route_other_app_test extends phpbb_controller_comm return 'app.php'; } - protected function path_to_app() + protected static function path_to_app() { return 'foo/'; } diff --git a/tests/controller/helper_route_root_test.php b/tests/controller/helper_route_root_test.php index 496027961e..5162201aaa 100644 --- a/tests/controller/helper_route_root_test.php +++ b/tests/controller/helper_route_root_test.php @@ -13,7 +13,7 @@ require_once __DIR__ . '/common_helper_route.php'; -class phpbb_controller_helper_route_test extends phpbb_controller_common_helper_route +class phpbb_controller_helper_route_root_test extends phpbb_controller_common_helper_route { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_slash_test.php b/tests/controller/helper_route_slash_test.php index 5a37d3220f..1827bc0415 100644 --- a/tests/controller/helper_route_slash_test.php +++ b/tests/controller/helper_route_slash_test.php @@ -35,7 +35,7 @@ class phpbb_controller_helper_route_slash_test extends phpbb_controller_common_h return 'app.php'; } - protected function path_to_app() + protected static function path_to_app() { return 'phpBB/'; } diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index 45736e82fe..01483f5c88 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -84,7 +84,7 @@ class phpbb_cron_manager_test extends \phpbb_test_case )); $mock_router = $this->getMockBuilder('\phpbb\routing\router') - ->setMethods(array('setContext', 'generate')) + ->onlyMethods(array('setContext', 'generate')) ->disableOriginalConstructor() ->getMock(); $mock_router->method('setContext') diff --git a/tests/cron/wrapper_test.php b/tests/cron/wrapper_test.php index 95b2a7fa67..315761ca9d 100644 --- a/tests/cron/wrapper_test.php +++ b/tests/cron/wrapper_test.php @@ -111,7 +111,8 @@ class phpbb_cron_wrapper_test extends phpbb_template_template_test_case { $this->task = $this->getMockBuilder(\phpbb\cron\task\task::class) ->disableOriginalConstructor() - ->setMethods(['get_name', 'run', 'is_runnable', 'should_run', 'some_method']) + ->onlyMethods(['get_name', 'run', 'is_runnable', 'should_run']) + ->addMethods(['some_method']) ->getMock(); $this->routing_helper = $this->createMock(\phpbb\routing\helper::class); diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 500f90a3fb..7c76da32d3 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -15,21 +15,59 @@ require_once __DIR__ . '/../mock/lang.php'; class phpbb_datetime_from_format_test extends phpbb_test_case { - public function from_format_data() + /** @var \phpbb\language\language */ + protected $lang; + + /** @var \phpbb\user */ + protected $user; + + protected function setUp(): void { - return array( - array( + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $this->lang = new \phpbb\language\language($lang_loader); + + // Set up language data for testing + $reflection_class = new ReflectionClass('\phpbb\language\language'); + // Set default language files loaded flag to true + $common_language_files_loaded_flag = $reflection_class->getProperty('common_language_files_loaded'); + $common_language_files_loaded_flag->setAccessible(true); + $common_language_files_loaded_flag->setValue($this->lang, true); + // Set up test language data + $lang_array = $reflection_class->getProperty('lang'); + $lang_array->setAccessible(true); + $lang_array->setValue($this->lang, [ + 'datetime' => [ + 'TODAY' => 'Today', + 'TOMORROW' => 'Tomorrow', + 'YESTERDAY' => 'Yesterday', + 'AGO' => [ + 0 => 'less than a minute ago', + 1 => '%d minute ago', + 2 => '%d minutes ago', + ], + ], + ]); + + $this->user = new \phpbb\user($this->lang, '\phpbb\datetime'); + } + + public static function from_format_data() + { + return [ + [ 'UTC', 'Y-m-d', '2012-06-08', - ), + ], - array( + [ 'Europe/Berlin', 'Y-m-d H:i:s', '2012-06-08 14:01:02', - ), - ); + ], + ]; } /** @@ -37,86 +75,66 @@ class phpbb_datetime_from_format_test extends phpbb_test_case */ public function test_from_format($timezone, $format, $expected) { - global $phpbb_root_path, $phpEx; - - $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); - $lang = new \phpbb\language\language($lang_loader); - $user = new \phpbb\user($lang, '\phpbb\datetime'); - $user->timezone = new DateTimeZone($timezone); - $user->lang['datetime'] = array( - 'TODAY' => 'Today', - 'TOMORROW' => 'Tomorrow', - 'YESTERDAY' => 'Yesterday', - 'AGO' => array( - 0 => 'less than a minute ago', - 1 => '%d minute ago', - 2 => '%d minutes ago', - ), - ); - - $timestamp = $user->get_timestamp_from_format($format, $expected, new DateTimeZone($timezone)); - $this->assertEquals($expected, $user->format_date($timestamp, $format, true)); + $this->user->timezone = new DateTimeZone($timezone); + $timestamp = $this->user->get_timestamp_from_format($format, $expected, new DateTimeZone($timezone)); + $this->assertEquals($expected, $this->user->format_date($timestamp, $format, true)); } - public function relative_format_date_data() + public static function relative_format_date_data() { // If the current time is too close to the testing time, // the relative time will use "x minutes ago" instead of "today ..." // So we use 18:01 in the morning and 06:01 in the afternoon. $testing_time = gmdate('H') <= 12 ? '18:01' : '06:01'; - return array( - array( + return [ + [ gmdate('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, false, gmdate('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, false, 'Tomorrow ' . $testing_time, - ), - array( + ], + [ gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, true, gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d') . ' ' . $testing_time, false, 'Today ' . $testing_time, - ), - array( + ], + [ gmdate('Y-m-d') . ' ' . $testing_time, true, gmdate('Y-m-d') . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, false, 'Yesterday ' . $testing_time, - ), - array( + ], + [ gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, true, gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, false, gmdate('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, - ), + ], // Test edge cases: Yesterday 00:00, Today 00:00, Tomorrow 00:00 - array( + [ gmdate('Y-m-d', strtotime('yesterday')) . ' 00:00', false, 'Yesterday 00:00', - ), - array( + ], + [ gmdate('Y-m-d', strtotime('today')) . ' 00:00', false, 'Today 00:00', - ), - array( + ], + [ gmdate('Y-m-d', strtotime('tomorrow')) . ' 00:00', false, 'Tomorrow 00:00', - ), - ); + ], + ]; } /** @@ -124,24 +142,8 @@ class phpbb_datetime_from_format_test extends phpbb_test_case */ public function test_relative_format_date($timestamp, $forcedate, $expected) { - global $phpbb_root_path, $phpEx; - - $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); - $lang = new \phpbb\language\language($lang_loader); - $user = new \phpbb\user($lang, '\phpbb\datetime'); - $user->timezone = new DateTimeZone('UTC'); - $user->lang['datetime'] = array( - 'TODAY' => 'Today', - 'TOMORROW' => 'Tomorrow', - 'YESTERDAY' => 'Yesterday', - 'AGO' => array( - 0 => 'less than a minute ago', - 1 => '%d minute ago', - 2 => '%d minutes ago', - ), - ); - - $timestamp = $user->get_timestamp_from_format('Y-m-d H:i', $timestamp, new DateTimeZone('UTC')); + $this->user->timezone = new DateTimeZone('UTC'); + $timestamp = $this->user->get_timestamp_from_format('Y-m-d H:i', $timestamp, new DateTimeZone('UTC')); /* This code is equal to the one from \phpbb\datetime function format() * If the delta is less than or equal to 1 hour @@ -156,9 +158,9 @@ class phpbb_datetime_from_format_test extends phpbb_test_case ($delta >= -5 || (($now_ts/ 60) % 60) == (($timestamp / 60) % 60)) ) { - $expected = $user->lang(['datetime', 'AGO'], max(0, (int) floor($delta / 60))); + $expected = $this->lang->lang(['datetime', 'AGO'], max(0, (int) floor($delta / 60))); } - $this->assertEquals($expected, $user->format_date($timestamp, '|Y-m-d| H:i', $forcedate)); + $this->assertEquals($expected, $this->user->format_date($timestamp, '|Y-m-d| H:i', $forcedate)); } } diff --git a/tests/dbal/connect_test.php b/tests/dbal/connect_test.php index 9e53954d86..d1ec75470a 100644 --- a/tests/dbal/connect_test.php +++ b/tests/dbal/connect_test.php @@ -31,15 +31,23 @@ class phpbb_dbal_connect_test extends phpbb_database_test_case // Failure to connect results in a trigger_error call in dbal. // phpunit converts triggered errors to exceptions. // In particular there should be no fatals here. - try + + + if ($db->get_sql_layer() === 'mysqli') { - $db->sql_connect($config['dbhost'], 'phpbbogus', 'phpbbogus', 'phpbbogus', $config['dbport']); - $this->assertFalse(true); + $this->setExpectedTriggerError(E_WARNING); } - catch (Exception $e) + else if ($db->get_sql_layer() !== 'sqlite3') { - // should have a legitimate message - $this->assertNotEmpty($e->getMessage()); + $this->setExpectedTriggerError(E_USER_ERROR); + } + + // For SQLite3, connection will be successful anyway as phpBB driver uses SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE flags + $result = $db->sql_connect($config['dbhost'], 'phpbbogus', 'phpbbogus', 'phpbbogus', $config['dbport']); + + if ($db->get_sql_layer() === 'sqlite3') + { + $this->assertTrue($result); } } } diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index 5bd0705daa..f6c108cdae 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -404,11 +404,19 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case ->will($this->returnValue(true)); // drop tables - $db_tools->expects($this->exactly(2))->method('schema_drop_table') - ->withConsecutive( - [$this->isInstanceOf(Schema::class), 'dropped_table_1', true], - [$this->isInstanceOf(Schema::class), 'dropped_table_2', true] - ); + $matcher = $this->exactly(2); + $db_tools->expects($matcher)->method('schema_drop_table') + ->willReturnCallback(function() use ($matcher) { + $args = func_get_args(); + $schema = array_shift($args); + $this->assertInstanceOf(\Doctrine\DBAL\Schema\Schema::class, $schema); + match($matcher->numberOfInvocations()) + { + 1 => $this->assertEquals($args, ['dropped_table_1', true]), + 2 => $this->assertEquals($args, ['dropped_table_2', true]), + }; + } + ); $db_tools->perform_schema_changes(array( 'drop_tables' => array( @@ -432,11 +440,18 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case ->will($this->returnValue(true)); // drop columns - $db_tools->expects($this->exactly(2))->method('schema_column_remove') - ->withConsecutive( - [$this->isInstanceOf(Schema::class), 'existing_table', 'dropped_column_1', true], - [$this->isInstanceOf(Schema::class), 'existing_table', 'dropped_column_2', true] - ); + $matcher = $this->exactly(2); + $db_tools->expects($matcher)->method('schema_column_remove') + ->willReturnCallback(function() use ($matcher) { + $args = func_get_args(); + $schema = array_shift($args); + $this->assertInstanceOf(\Doctrine\DBAL\Schema\Schema::class, $schema); + match($matcher->numberOfInvocations()) { + 1 => $this->assertEquals($args, ['existing_table', 'dropped_column_1', true]), + 2 => $this->assertEquals($args, ['existing_table', 'dropped_column_2', true]), + }; + } + ); $db_tools->perform_schema_changes(array( 'drop_columns' => array( diff --git a/tests/dbal/migrator_tool_config_text_test.php b/tests/dbal/migrator_tool_config_text_test.php index f1b009b5cd..d680b963d7 100644 --- a/tests/dbal/migrator_tool_config_text_test.php +++ b/tests/dbal/migrator_tool_config_text_test.php @@ -13,6 +13,10 @@ class phpbb_dbal_migrator_tool_config_text_test extends phpbb_database_test_case { + protected $db; + protected $config_text; + protected $tool; + public function getDataSet() { return $this->createXMLDataSet(__DIR__.'/fixtures/migrator_config_text.xml'); diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 2d5daa298c..db63394b94 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -16,6 +16,11 @@ require_once __DIR__ . '/ext/foo/bar/ucp/ucp_test_info.php'; class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { + protected $db; + protected $cache; + protected $user; + protected $tool; + public function getDataSet() { return $this->createXMLDataSet(__DIR__.'/fixtures/migrator_module.xml'); @@ -51,7 +56,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules'); } - public function exists_data_acp() + public static function exists_data_acp() { return array( // Test the existing category @@ -184,7 +189,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $this->assertEquals($expected, $this->tool->exists('acp', $parent, $module, $lazy)); } - public function exists_data_ucp() + public static function exists_data_ucp() { return array( // Test the existing category diff --git a/tests/dbal/migrator_tool_permission_role_test.php b/tests/dbal/migrator_tool_permission_role_test.php index dc180dc154..3bebfe238d 100644 --- a/tests/dbal/migrator_tool_permission_role_test.php +++ b/tests/dbal/migrator_tool_permission_role_test.php @@ -22,6 +22,12 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_ /** @var \phpbb\db\migration\tool\permission */ protected $tool; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\service */ + protected $cache; + public $group_ids = [ 'REGISTERED' => 2, 'GLOBAL_MODERATORS' => 4, @@ -102,7 +108,7 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_ $this->auth_admin = new \auth_admin(); } - public function data_test_new_role_exists() + public static function data_test_new_role_exists() { return [ ['ROLE_ADMIN_NEW', true], @@ -119,7 +125,7 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_ $this->assertEquals($expected, (bool) $this->tool->role_exists($role_name)); } - public function data_test_permission_assign_new_roles() + public static function data_test_permission_assign_new_roles() { return [ [ diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index e1ea2e7b51..c4e74f23d4 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -16,6 +16,12 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case /** @var \phpbb\auth\auth */ protected $auth; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\service */ + protected $cache; + /** @var \phpbb\db\migration\tool\permission */ protected $tool; @@ -45,7 +51,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case $this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx); } - public function exists_data() + public static function exists_data() { return array( array( @@ -170,7 +176,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case $this->assertFalse($this->tool->exists('global_test', true)); } - public function data_test_permission_set() + public static function data_test_permission_set() { return array( array( @@ -226,7 +232,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case } } - public function data_test_permission_role_exists() + public static function data_test_permission_role_exists() { return array( array('ROLE_MOD_FULL', true), diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 141ee03a14..2318a54911 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -18,7 +18,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__.'/fixtures/three_users.xml'); } - public function return_on_error_select_data() + public static function return_on_error_select_data() { return array( array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))), @@ -45,7 +45,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function fetchrow_data() + public static function fetchrow_data() { return array( array('', array(array('username_clean' => 'barfoo'), @@ -96,7 +96,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function fetchfield_data() + public static function fetchfield_data() { return array( array('', array('barfoo', 'foobar', 'bertie')), @@ -126,7 +126,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } - static public function fetchfield_seek_data() + public static function fetchfield_seek_data() { return array( array(1, 'foobar'), @@ -152,7 +152,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $field); } - static public function query_limit_data() + public static function query_limit_data() { return array( array(0, 0, array(array('username_clean' => 'barfoo'), @@ -193,7 +193,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } - public function like_expression_data() + public static function like_expression_data() { // * = any_char; # = one_char return array( @@ -230,7 +230,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function not_like_expression_data() + public static function not_like_expression_data() { // * = any_char; # = one_char return array( @@ -290,7 +290,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function in_set_data() + public static function in_set_data() { return array( array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))), @@ -364,7 +364,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function build_array_data() + public static function build_array_data() { return array( array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))), diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index f94aebd85b..79fbffd1dc 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -18,7 +18,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__.'/fixtures/config.xml'); } - public function build_array_insert_data() + public static function build_array_insert_data() { return array( array(array( @@ -167,7 +167,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function update_data() + public static function update_data() { return array( array( diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index 7d8e07560c..36ff57a43d 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -15,7 +15,7 @@ namespace { require_once __DIR__ . '/fixtures/ext/vendor/enabled_4/di/extension.php'; - class phpbb_di_container_test extends \phpbb_test_case + class phpbb_di_create_container_test extends \phpbb_test_case { protected $config_php; @@ -73,7 +73,8 @@ namespace // Checks the construction of a dumped container $container = $this->builder->get_container(); - $this->assertInstanceOf('phpbb_cache_container', $container); + $this->assertEquals('phpbb_cache_container', $container::class); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Container', $container); $this->assertTrue($container->isCompiled()); } @@ -100,7 +101,8 @@ namespace // Checks the construction of a dumped container $container = $this->builder->get_container(); - $this->assertNotInstanceOf('phpbb_cache_container', $container); + $this->assertNotEquals('phpbb_cache_container', $container::class); + $this->assertEquals('Symfony\Component\DependencyInjection\ContainerBuilder', $container::class); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); $this->assertTrue($container->isCompiled()); } diff --git a/tests/di/fixtures/config.php b/tests/di/fixtures/config.php index 1e9207d924..956001ef58 100644 --- a/tests/di/fixtures/config.php +++ b/tests/di/fixtures/config.php @@ -1,7 +1,7 @@ reflection_template_property->setAccessible(true); } - public function email_parsing_data() + public static function email_parsing_data() { return array( array('Author username', 'Any forum', 'The topic title', 'Dear user'), diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index 3079ca1ffe..cb8984a3a1 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -24,7 +24,7 @@ class phpbb_error_collector_test extends phpbb_test_case public function test_collection() { - $collector = new \phpbb\error_collector(E_ALL | E_STRICT); // php set_error_handler() default + $collector = new \phpbb\error_collector(E_ALL | E_NOTICE); // php set_error_handler() default $collector->install(); // Cause a warning diff --git a/tests/event/exception_listener_test.php b/tests/event/exception_listener_test.php index f611a13267..0520d9fbaa 100644 --- a/tests/event/exception_listener_test.php +++ b/tests/event/exception_listener_test.php @@ -11,9 +11,9 @@ * */ -class exception_listener extends phpbb_test_case +class exception_listener_test extends phpbb_test_case { - public function phpbb_exception_data() + public static function phpbb_exception_data() { return array( array( diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php index 3011634c4b..7dc8c1a45c 100644 --- a/tests/extension/extension_base_test.php +++ b/tests/extension/extension_base_test.php @@ -58,7 +58,7 @@ class phpbb_extension_extension_base_test extends phpbb_test_case $container); } - public function data_test_suffix_get_classes() + public static function data_test_suffix_get_classes() { return array( array( diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index bd25b6caf9..066cc9b84d 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -57,7 +57,7 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } - public function set_extensions_data() + public static function set_extensions_data() { return array( array( diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index b32b67c124..b1468f3f9d 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -163,7 +163,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals($metadata, $json); } - public function validator_non_existing_data() + public static function validator_non_existing_data() { return array( array('name'), @@ -223,7 +223,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } } - public function validator_invalid_data() + public static function validator_invalid_data() { return array( array('name', 'asdf'), @@ -281,7 +281,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } } - public function validator_requirements_data() + public static function validator_requirements_data() { return array( array( diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index 7d41b975a7..65e4fcdd33 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -174,7 +174,7 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); } - public function module_auth_test_data() + public static function module_auth_test_data() { return array( // module_auth, expected result diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php index 33ffde6bcb..34a577a0f9 100644 --- a/tests/feed/attachments_base_test.php +++ b/tests/feed/attachments_base_test.php @@ -76,7 +76,7 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case ); } - public function data_fetch_attachments() + public static function data_fetch_attachments() { return array( array(array(0), array(0)), diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php index 877c4c98e2..2f18313eb4 100644 --- a/tests/files/types_base_test.php +++ b/tests/files/types_base_test.php @@ -54,7 +54,7 @@ class phpbb_files_types_base_test extends phpbb_test_case $this->factory = new \phpbb\files\factory($this->container); } - public function data_check_upload_size() + public static function data_check_upload_size() { return array( array('foo', '500KB', array()), diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php index dd9ad7280c..f46be3a715 100644 --- a/tests/files/types_form_test.php +++ b/tests/files/types_form_test.php @@ -71,7 +71,7 @@ class phpbb_files_types_form_test extends phpbb_test_case $this->phpbb_root_path = $phpbb_root_path; } - public function data_upload_form() + public static function data_upload_form() { return array( array( diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php index e4cfd49064..ea1fa23ecb 100644 --- a/tests/files/types_local_test.php +++ b/tests/files/types_local_test.php @@ -96,7 +96,7 @@ class phpbb_files_types_local_test extends phpbb_test_case $this->assertInstanceOf('\phpbb\files\filespec', $file); } - public function data_upload_form() + public static function data_upload_form() { return array( array( diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php index 1fda63e453..ab88b1cd83 100644 --- a/tests/files/upload_test.php +++ b/tests/files/upload_test.php @@ -96,7 +96,7 @@ class phpbb_files_upload_test extends phpbb_test_case $this->assertFalse($upload->is_valid('foobar')); } - public function data_internal_error() + public static function data_internal_error() { return array( array(UPLOAD_ERR_INI_SIZE, 'PHP_SIZE_OVERRUN'), diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index f64d306d90..8ed5519f31 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -21,7 +21,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); } - public function clean_path_data() + public static function clean_path_data() { return array( array('foo', 'foo'), diff --git a/tests/filesystem/helper_clean_path_test.php b/tests/filesystem/helper_clean_path_test.php index c0c8783321..cfaf1df5cb 100644 --- a/tests/filesystem/helper_clean_path_test.php +++ b/tests/filesystem/helper_clean_path_test.php @@ -21,7 +21,7 @@ class phpbb_filesystem_helper_clean_path_test extends phpbb_test_case parent::setUp(); } - public function clean_path_data() + public static function clean_path_data() { yield ['foo', 'foo']; yield ['foo/bar', 'foo/bar']; diff --git a/tests/filesystem/helper_is_absolute_test.php b/tests/filesystem/helper_is_absolute_test.php index 954cf6a30b..d3d05921c9 100644 --- a/tests/filesystem/helper_is_absolute_test.php +++ b/tests/filesystem/helper_is_absolute_test.php @@ -21,7 +21,7 @@ class phpbb_filesystem_helper_is_absolute_test extends phpbb_test_case parent::setUp(); } - static public function is_absolute_data() + public static function is_absolute_data() { // Empty yield ['', false]; diff --git a/tests/filesystem/helper_realpath_test.php b/tests/filesystem/helper_realpath_test.php index 2f28909a82..848a855a4d 100644 --- a/tests/filesystem/helper_realpath_test.php +++ b/tests/filesystem/helper_realpath_test.php @@ -30,7 +30,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case parent::setUp(); } - public function realpath_resolve_absolute_without_symlinks_data() + public static function realpath_resolve_absolute_without_symlinks_data() { // Constant data yield [__DIR__, __DIR__]; @@ -42,7 +42,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case yield [__FILE__ . '../', false]; } - public function realpath_resolve_relative_without_symlinks_data() + public static function realpath_resolve_relative_without_symlinks_data() { if (!function_exists('getcwd')) { diff --git a/tests/filesystem/is_absolute_test.php b/tests/filesystem/is_absolute_test.php index 165130ae85..684fc38684 100644 --- a/tests/filesystem/is_absolute_test.php +++ b/tests/filesystem/is_absolute_test.php @@ -23,7 +23,7 @@ class phpbb_filesystem_is_absolute_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); } - static public function is_absolute_data() + public static function is_absolute_data() { return array( // Empty diff --git a/tests/filesystem/realpath_test.php b/tests/filesystem/realpath_test.php index 17281191d0..8119541844 100644 --- a/tests/filesystem/realpath_test.php +++ b/tests/filesystem/realpath_test.php @@ -34,7 +34,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); } - public function realpath_resolve_absolute_without_symlinks_data() + public static function realpath_resolve_absolute_without_symlinks_data() { return array( // Constant data @@ -49,7 +49,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case ); } - public function realpath_resolve_relative_without_symlinks_data() + public static function realpath_resolve_relative_without_symlinks_data() { if (!function_exists('getcwd')) { diff --git a/tests/functional/acp_bbcodes_test.php b/tests/functional/acp_bbcodes_test.php index dd0d356a58..07ef3b444c 100644 --- a/tests/functional/acp_bbcodes_test.php +++ b/tests/functional/acp_bbcodes_test.php @@ -65,7 +65,7 @@ class phpbb_functional_acp_bbcodes_test extends phpbb_functional_test_case $this->assertStringContainsString($error, $text); } - public function get_bbcode_error_tests() + public static function get_bbcode_error_tests() { return [ [ diff --git a/tests/functional/acp_groups_test.php b/tests/functional/acp_groups_test.php index 34cb16b99a..3c6d228e87 100644 --- a/tests/functional/acp_groups_test.php +++ b/tests/functional/acp_groups_test.php @@ -25,7 +25,7 @@ class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_te return 'adm/index.php?i=groups&mode=manage&action=edit'; } - public function acp_group_test_data() + public static function acp_group_test_data() { return array( 'both_yes' => array( diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php index 39ecbf99e2..fb092a7ff1 100644 --- a/tests/functional/acp_permissions_test.php +++ b/tests/functional/acp_permissions_test.php @@ -48,7 +48,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case $this->assertStringContainsString($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); } - public function permissions_data() + public static function permissions_data() { return array( // description diff --git a/tests/functional/acp_profile_field_test.php b/tests/functional/acp_profile_field_test.php index 9730e1e385..7413c34980 100644 --- a/tests/functional/acp_profile_field_test.php +++ b/tests/functional/acp_profile_field_test.php @@ -25,7 +25,7 @@ class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case $this->add_lang('acp/profile'); } - public function data_add_profile_field() + public static function data_add_profile_field() { return array( array('profilefields.type.bool', diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 1ba5dc744f..6bdef1c499 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -23,7 +23,7 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5'; } - public function avatar_acp_groups_data() + public static function avatar_acp_groups_data() { return array( // Correct Gravatar diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php index e35e1a8011..d674495dd3 100644 --- a/tests/functional/avatar_acp_users_test.php +++ b/tests/functional/avatar_acp_users_test.php @@ -23,7 +23,7 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava return 'adm/index.php?i=acp_users&u=2&mode=avatar'; } - public function avatar_acp_users_data() + public static function avatar_acp_users_data() { return array( // Gravatar with incorrect email diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php index a3abe59682..800c98ecf1 100644 --- a/tests/functional/avatar_ucp_groups_test.php +++ b/tests/functional/avatar_ucp_groups_test.php @@ -22,7 +22,7 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av return 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5'; } - public function avatar_ucp_groups_data() + public static function avatar_ucp_groups_data() { return array( // Gravatar with incorrect email diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php index e004bcd166..60e0ea8a63 100644 --- a/tests/functional/avatar_ucp_users_test.php +++ b/tests/functional/avatar_ucp_users_test.php @@ -23,7 +23,7 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava return 'ucp.php?i=ucp_profile&mode=avatar'; } - public function avatar_ucp_groups_data() + public static function avatar_ucp_groups_data() { return array( // Gravatar with correct settings diff --git a/tests/functional/common_groups_test_case.php b/tests/functional/common_groups_test_case.php index 0b0ffd9331..d3ee795c3b 100644 --- a/tests/functional/common_groups_test_case.php +++ b/tests/functional/common_groups_test_case.php @@ -57,7 +57,7 @@ abstract class phpbb_functional_common_groups_test_case extends phpbb_functional $this->assertStringContainsString($this->lang('CONFIG_UPDATED'), $crawler->text()); } - public function groups_manage_test_data() + public static function groups_manage_test_data() { return array( array('', 'GROUP_UPDATED'), diff --git a/tests/functional/download_test.php b/tests/functional/download_test.php index b34b1ad2c2..df2a7cbb26 100644 --- a/tests/functional/download_test.php +++ b/tests/functional/download_test.php @@ -229,6 +229,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case if (!empty($data['forums'])) { + array_walk($data['forums'], function(&$value, $key) + { + $value = $this->db->sql_escape($value); + } + ); $sql = 'SELECT * FROM phpbb_forums WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); @@ -245,6 +250,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case if (!empty($data['topics'])) { + array_walk($data['topics'], function(&$value, $key) + { + $value = $this->db->sql_escape($value); + } + ); $sql = 'SELECT * FROM phpbb_topics WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); @@ -262,6 +272,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case $post_ids = array(); if (!empty($data['posts'])) { + array_walk($data['posts'], function(&$value, $key) + { + $value = $this->db->sql_escape($value); + } + ); $sql = 'SELECT * FROM phpbb_posts WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); @@ -276,7 +291,7 @@ class phpbb_functional_download_test extends phpbb_functional_test_case } $this->db->sql_freeresult($result); - if (isset($data['attachments'])) + if (isset($data['attachments']) && !empty($post_ids)) { $sql = 'SELECT * FROM phpbb_attachments diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 30dcaa89c7..bcc299fae5 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -255,6 +255,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(); $form['minimum_stability']->select('dev'); + $form['enable_packagist']->select('1'); $form['repositories'] = 'https://satis.phpbb.com/'; $crawler = self::submit($form); $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('div[class="successbox"] > p')->text()); diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 7e02e62fc4..a225cf3f56 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -23,16 +23,10 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case protected function setUp(): void { parent::setUp(); - $this->purge_cache(); - } - public function __construct($name = null, array $data = array(), $dataName = '') - { - parent::__construct($name, $data, $dataName); - - $this->backupStaticAttributesExcludeList += [ + $this->setBackupStaticPropertiesExcludeList([ 'phpbb_functional_feed_test' => ['init_values'], - ]; + ]); $this->purge_cache(); } diff --git a/tests/functional/forum_password_test.php b/tests/functional/forum_password_test.php index 4b2b69a92c..93c0dbb6d6 100644 --- a/tests/functional/forum_password_test.php +++ b/tests/functional/forum_password_test.php @@ -34,7 +34,7 @@ class phpbb_functional_forum_password_test extends phpbb_functional_test_case $crawler = self::submit($form); } - public function data_enter_forum_with_password() + public static function data_enter_forum_with_password() { return array( array('foowrong', 'WRONG_PASSWORD'), diff --git a/tests/functional/jumpbox_test.php b/tests/functional/jumpbox_test.php index 9e2938f9e2..9acaf5ee62 100644 --- a/tests/functional/jumpbox_test.php +++ b/tests/functional/jumpbox_test.php @@ -16,6 +16,8 @@ */ class phpbb_functional_jumpbox_test extends phpbb_functional_test_case { + protected $crawler; + public function test_jumpbox() { $this->login(); diff --git a/tests/functional/mcp/mcp_main_test.php b/tests/functional/mcp/mcp_main_test.php index a056217f73..7f092e1f00 100644 --- a/tests/functional/mcp/mcp_main_test.php +++ b/tests/functional/mcp/mcp_main_test.php @@ -72,7 +72,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case return $post; } - public function mcp_view_forum_actions_data() + public static function mcp_view_forum_actions_data() { // action, success message, require_confirmation return [ @@ -181,7 +181,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case $this->assertStringContainsString($this->lang('TOPICS_DELETED_SUCCESS'), $crawler->filter('#message p')->text()); } - public function mcp_view_topic_actions_data() + public static function mcp_view_topic_actions_data() { // action, success message, require_confirmation return [ diff --git a/tests/functional/permission_roles_test.php b/tests/functional/permission_roles_test.php index e6506fb37c..5cc6491e4b 100644 --- a/tests/functional/permission_roles_test.php +++ b/tests/functional/permission_roles_test.php @@ -16,7 +16,7 @@ */ class functional_permission_roles_test extends phpbb_functional_test_case { - public function data_permission_roles() + public static function data_permission_roles() { return array( array( diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index 7952d4f17b..2883642bf2 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -60,7 +60,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case } } - public function get_urls() + public static function get_urls() { return array( array('posting.php?mode=reply&t=1'), diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 9f8b299756..f561a9618c 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -301,7 +301,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case ); } - public function nonexistent_post_id_data() + public static function nonexistent_post_id_data() { $nonexistent_post_id = 999999; // Random value return [ diff --git a/tests/functional/ucp_allow_pm_test.php b/tests/functional/ucp_allow_pm_test.php index 6c275ad916..3cdc1d0af6 100644 --- a/tests/functional/ucp_allow_pm_test.php +++ b/tests/functional/ucp_allow_pm_test.php @@ -18,13 +18,13 @@ class phpbb_functional_ucp_allow_pm_test extends phpbb_functional_test_case { protected static $data = array(); - public function __construct() + protected function setUp(): void { - parent::__construct(); + parent::setUp(); - $this->backupStaticAttributesExcludeList += [ + $this->setBackupStaticPropertiesExcludeList([ 'phpbb_functional_ucp_allow_pm_test' => ['data'], - ]; + ]); } // user A sends a PM to user B where B accepts PM diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index cf0f903817..e2efccc9b0 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -102,7 +102,7 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca $this->login(self::TEST_USER); } - public function data_reset_user_password() + public static function data_reset_user_password() { return [ ['RESET_TOKEN_EXPIRED_OR_INVALID', 0, 'abcdef'], diff --git a/tests/functional/visibility_unapproved_posts_test.php b/tests/functional/visibility_unapproved_posts_test.php index 51e5641788..7c14b10a90 100644 --- a/tests/functional/visibility_unapproved_posts_test.php +++ b/tests/functional/visibility_unapproved_posts_test.php @@ -14,7 +14,7 @@ /** * @group functional */ -class phpbb_functional_visibility_unapproved_test extends phpbb_functional_test_case +class phpbb_functional_visibility_unapproved_posts_test extends phpbb_functional_test_case { protected $data = []; diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 6e1fc57306..da38cae635 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -15,13 +15,16 @@ class phpbb_build_url_test extends phpbb_test_case { protected function setUp(): void { - global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper; + global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper, $config; parent::setUp(); $phpbb_container = new phpbb_mock_container_builder(); $user = new phpbb_mock_user(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $config = new \phpbb\config\config([ + 'enable_mod_rewrite' => 0, + ]); $phpbb_path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( @@ -33,7 +36,7 @@ class phpbb_build_url_test extends phpbb_test_case ); $phpbb_container->set('path_helper', $phpbb_path_helper); } - public function build_url_test_data() + public static function build_url_test_data() { return array( array( @@ -79,8 +82,9 @@ class phpbb_build_url_test extends phpbb_test_case */ public function test_build_url($page, $strip_vars, $expected) { - global $user; + global $config, $user, $phpbb_path_helper, $phpbb_dispatcher, $_SID; + $_SID = ''; $user->page['page'] = $page; $output = build_url($strip_vars); diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php index e88da592a7..f3fbda79d9 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -13,7 +13,7 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case { - public function convert_30_dbms_to_31_data() + public static function convert_30_dbms_to_31_data() { return array( array('mssql_odbc'), diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php index b23c38854b..3b531398ad 100644 --- a/tests/functions/generate_string_list.php +++ b/tests/functions/generate_string_list.php @@ -29,7 +29,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case $this->user->add_lang('common'); } - public function generate_string_list_data() + public static function generate_string_list_data() { return array( array( diff --git a/tests/functions/get_formatted_filesize_test.php b/tests/functions/get_formatted_filesize_test.php index 290515b64f..d2a94453f6 100644 --- a/tests/functions/get_formatted_filesize_test.php +++ b/tests/functions/get_formatted_filesize_test.php @@ -13,7 +13,7 @@ class phpbb_get_formatted_filesize_test extends phpbb_test_case { - public function get_formatted_filesize_test_data() + public static function get_formatted_filesize_test_data() { return array( // exact powers of 2 diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php index b8254b03ea..5b98d70646 100644 --- a/tests/functions/get_preg_expression_test.php +++ b/tests/functions/get_preg_expression_test.php @@ -13,7 +13,7 @@ class phpbb_functions_get_preg_expression_test extends phpbb_test_case { - public function data_path_remove_dot_trailing_slash() + public static function data_path_remove_dot_trailing_slash() { return array( array('./../', '$2', '/..'), diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php index 47b9edcdbb..5b19f66e8e 100644 --- a/tests/functions/make_clickable_email_test.php +++ b/tests/functions/make_clickable_email_test.php @@ -17,7 +17,11 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case { parent::setUp(); - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $config; + $config = new \phpbb\config\config([ + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user(); $request = new phpbb_mock_request(); $symfony_request = new \phpbb\symfony_request($request); @@ -26,7 +30,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case /** * 'e' tag for email addresses html **/ - public function data_test_make_clickable_email_positive() + public static function data_test_make_clickable_email_positive() { return array( array( @@ -147,7 +151,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case ); } - public function data_test_make_clickable_email_negative() + public static function data_test_make_clickable_email_negative() { return array( array('foo.example.com'), // @ is missing @@ -206,6 +210,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case */ public function test_email_matching_positive($email, $expected) { + global $config, $user, $request, $symfony_request; $this->assertSame($expected, make_clickable($email)); } @@ -214,6 +219,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case */ public function test_email_matching_negative($email, $expected = null) { + global $config, $user, $request, $symfony_request; $expected = ($expected) ?: $email; $this->assertSame($expected, make_clickable($email)); } diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php index 5b24696460..443b78b3a4 100644 --- a/tests/functions/make_clickable_test.php +++ b/tests/functions/make_clickable_test.php @@ -25,7 +25,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case * "postlink" for the rest of URLs * empty for email addresses **/ - public function data_test_make_clickable_url_positive() + public static function data_test_make_clickable_url_positive() { return [ [ @@ -82,7 +82,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ]; } - public function data_test_make_clickable_url_idn() + public static function data_test_make_clickable_url_idn() { return [ [ @@ -135,7 +135,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ]; } - public function data_test_make_clickable_local_url_idn() + public static function data_test_make_clickable_local_url_idn() { return [ [ @@ -154,7 +154,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ]; } - public function data_test_make_clickable_custom_classes() + public static function data_test_make_clickable_custom_classes() { return [ [ @@ -200,7 +200,11 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case { parent::setUp(); - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $config; + $config = new \phpbb\config\config([ + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user(); $request = new phpbb_mock_request(); $symfony_request = new \phpbb\symfony_request($request); @@ -212,6 +216,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case */ public function test_urls_matching_positive($url, $expected) { + global $user, $request, $symfony_request, $config; $this->assertSame($expected, make_clickable($url)); } @@ -220,6 +225,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case */ public function test_local_urls_matching_idn($url, $expected) { + global $user, $request, $symfony_request, $config; $this->assertSame($expected, make_clickable($url, "http://www.домен.рф")); } @@ -228,6 +234,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case */ public function test_make_clickable_custom_classes($url, $server_url, $class, $expected) { + global $user, $request, $symfony_request, $config; $this->assertSame($expected, make_clickable($url, $server_url, $class)); } } diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index 1a2d000d0d..2beb14d826 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -33,7 +33,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case ); } - static public function obtain_guest_count_data() + public static function obtain_guest_count_data() { return array( array(0, 2), @@ -53,7 +53,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $this->assertEquals($expected, obtain_guest_count($forum_id)); } - static public function obtain_users_online_data() + public static function obtain_users_online_data() { return array( array(0, false, array( @@ -123,7 +123,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $this->assertEquals($expected, obtain_users_online($forum_id)); } - static public function obtain_users_online_string_data() + public static function obtain_users_online_string_data() { return array( array(0, false, array( diff --git a/tests/functions/parse_cfg_file_test.php b/tests/functions/parse_cfg_file_test.php index 017a931f28..0ac63a13a3 100644 --- a/tests/functions/parse_cfg_file_test.php +++ b/tests/functions/parse_cfg_file_test.php @@ -11,9 +11,9 @@ * */ -class phpbb_functions_parse_cfg_file extends phpbb_test_case +class phpbb_functions_parse_cfg_file_test extends phpbb_test_case { - public function parse_cfg_file_data() + public static function parse_cfg_file_data() { return array( array( diff --git a/tests/functions/phpbb_get_banned_user_ids.php b/tests/functions/phpbb_get_banned_user_ids.php index 6aaa5f8641..b0c0307d84 100644 --- a/tests/functions/phpbb_get_banned_user_ids.php +++ b/tests/functions/phpbb_get_banned_user_ids.php @@ -61,7 +61,7 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case $phpbb_container->set('ban.manager', $ban_manager); } - public function phpbb_get_banned_user_ids_data() + public static function phpbb_get_banned_user_ids_data() { return array( // Input to phpbb_get_banned_user_ids (user_id list, ban_end) diff --git a/tests/functions/phpbb_get_install_redirect_test.php b/tests/functions/phpbb_get_install_redirect_test.php index 22b9ade589..3b3b65f964 100644 --- a/tests/functions/phpbb_get_install_redirect_test.php +++ b/tests/functions/phpbb_get_install_redirect_test.php @@ -13,7 +13,7 @@ class phpbb_get_install_redirect_test extends phpbb_test_case { - public function data_redirect(): array + public static function data_redirect(): array { return [ [ diff --git a/tests/functions/quoteattr_test.php b/tests/functions/quoteattr_test.php index dbad7a99d8..a84ad17483 100644 --- a/tests/functions/quoteattr_test.php +++ b/tests/functions/quoteattr_test.php @@ -13,7 +13,7 @@ class phpbb_quoteattr_test extends phpbb_test_case { - public function quoteattr_test_data() + public static function quoteattr_test_data() { return array( array('foo', null, '"foo"'), diff --git a/tests/functions/short_ipv6__test.php b/tests/functions/short_ipv6__test.php index 8fa9cd7420..d62f652746 100644 --- a/tests/functions/short_ipv6__test.php +++ b/tests/functions/short_ipv6__test.php @@ -13,7 +13,7 @@ class short_ipv6__test extends phpbb_test_case { - public function data_short_ipv6(): array + public static function data_short_ipv6(): array { return [ ['::1', 0, ''], diff --git a/tests/functions/style_select_test.php b/tests/functions/style_select_test.php index aadacadb02..b3b4b42598 100644 --- a/tests/functions/style_select_test.php +++ b/tests/functions/style_select_test.php @@ -18,7 +18,7 @@ class phpbb_functions_style_select_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__.'/fixtures/style_select.xml'); } - static public function style_select_data() + public static function style_select_data() { return [ [ diff --git a/tests/functions/validate_hex_colour_test.php b/tests/functions/validate_hex_colour_test.php index 467bcd1d89..c82cce140b 100644 --- a/tests/functions/validate_hex_colour_test.php +++ b/tests/functions/validate_hex_colour_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_user.php'; class phpbb_functions_validate_hex_colour_test extends phpbb_test_case { - public function positive_match_data() + public static function positive_match_data() { return array( array('a00'), @@ -27,7 +27,7 @@ class phpbb_functions_validate_hex_colour_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( // Invalid prefix @@ -53,7 +53,7 @@ class phpbb_functions_validate_hex_colour_test extends phpbb_test_case ); } - public function optional_only_data() + public static function optional_only_data() { return array( // The empty colour, i.e. "no colour". @@ -61,19 +61,19 @@ class phpbb_functions_validate_hex_colour_test extends phpbb_test_case ); } - public function strict_negative_match_data() + public static function strict_negative_match_data() { return array_merge( - $this->negative_match_data(), - $this->optional_only_data() + self::negative_match_data(), + self::optional_only_data() ); } - public function nonstrict_positive_match_data() + public static function nonstrict_positive_match_data() { return array_merge( - $this->positive_match_data(), - $this->optional_only_data() + self::positive_match_data(), + self::optional_only_data() ); } diff --git a/tests/functions/validate_password_test.php b/tests/functions/validate_password_test.php index bf74cb30fb..56be2b6441 100644 --- a/tests/functions/validate_password_test.php +++ b/tests/functions/validate_password_test.php @@ -25,7 +25,7 @@ class phpbb_functions_validate_password_test extends phpbb_test_case $this->helper = new phpbb_functions_validate_data_helper($this); } - public function validate_password_data() + public static function validate_password_data() { return array( array('PASS_TYPE_ANY', array( diff --git a/tests/functions/validate_user_email_test.php b/tests/functions/validate_user_email_test.php index a43244bd50..e1f8526e21 100644 --- a/tests/functions/validate_user_email_test.php +++ b/tests/functions/validate_user_email_test.php @@ -28,12 +28,14 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case protected function setUp(): void { - global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx; + global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $config; parent::setUp(); $phpbb_container = new phpbb_mock_container_builder(); - $config = new \phpbb\config\config([]); + $config = new \phpbb\config\config([ + 'allow_emailreuse' => 0, + ]); $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $language = new phpbb\language\language(new phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -99,6 +101,8 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case */ public function test_validate_user_email($case, $errors, $email) { + global $config, $db, $user; + $this->set_validation_prerequisites(false); $this->helper->assert_valid_data(array( @@ -124,6 +128,8 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case */ public function test_validate_user_email_mx($case, $errors, $email) { + global $config, $db, $user; + $this->set_validation_prerequisites(true); $this->helper->assert_valid_data(array( diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index fc52f91347..0da6b99a6c 100644 --- a/tests/functions/validate_username_test.php +++ b/tests/functions/validate_username_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_user.php'; require_once __DIR__ . '/../mock/cache.php'; require_once __DIR__ . '/validate_data_helper.php'; -class phpbb_functions_validate_data_test extends phpbb_database_test_case +class phpbb_functions_validate_username_test extends phpbb_database_test_case { protected $db; protected $cache; @@ -35,7 +35,7 @@ class phpbb_functions_validate_data_test extends phpbb_database_test_case $this->helper = new phpbb_functions_validate_data_helper($this); } - public function validate_username_data() + public static function validate_username_data() { return array( array('USERNAME_CHARS_ANY', array( diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php index bdb2bb36e4..4ddd891f81 100644 --- a/tests/functions_acp/build_cfg_template_test.php +++ b/tests/functions_acp/build_cfg_template_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case { - public function build_cfg_template_text_data() + public static function build_cfg_template_text_data() { return array( array( @@ -84,7 +84,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_dimension_data() + public static function build_cfg_template_dimension_data() { return array( array( @@ -154,7 +154,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_number_data() + public static function build_cfg_template_number_data() { return array( array( @@ -222,7 +222,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_textarea_data() + public static function build_cfg_template_textarea_data() { return array( array( @@ -257,7 +257,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_radio_data() + public static function build_cfg_template_radio_data() { return [ [ @@ -492,7 +492,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_append_data() + public static function build_cfg_template_append_data() { return array( array( @@ -528,7 +528,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_select_data() + public static function build_cfg_template_select_data() { return [ [ diff --git a/tests/functions_acp/build_select_test.php b/tests/functions_acp/build_select_test.php index e59f25e977..693eabe3c9 100644 --- a/tests/functions_acp/build_select_test.php +++ b/tests/functions_acp/build_select_test.php @@ -13,7 +13,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_acp.php'; -class phpbb_functions_acp_built_select_test extends phpbb_test_case +class phpbb_functions_acp_build_select_test extends phpbb_test_case { protected function setUp(): void { @@ -25,7 +25,7 @@ class phpbb_functions_acp_built_select_test extends phpbb_test_case $user->lang = new phpbb_mock_lang(); } - public function build_select_data() + public static function build_select_data() { return array( array( diff --git a/tests/functions_acp/insert_config_array_test.php b/tests/functions_acp/insert_config_array_test.php index bf71b4e32f..f61b6dceac 100644 --- a/tests/functions_acp/insert_config_array_test.php +++ b/tests/functions_acp/insert_config_array_test.php @@ -27,7 +27,7 @@ class phpbb_functions_insert_config_array_test extends phpbb_test_case ); } - public function insert_config_array_data() + public static function insert_config_array_data() { return array( array( // Add a new config after 1st array item diff --git a/tests/functions_acp/validate_config_vars_test.php b/tests/functions_acp/validate_config_vars_test.php index c1b4eb60e4..a94e9b1405 100644 --- a/tests/functions_acp/validate_config_vars_test.php +++ b/tests/functions_acp/validate_config_vars_test.php @@ -29,7 +29,7 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case /** * Data sets that don't throw an error. */ - public function validate_config_vars_fit_data() + public static function validate_config_vars_fit_data() { return array( array( @@ -86,7 +86,7 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case /** * Data sets that throw the error. */ - public function validate_config_vars_error_data() + public static function validate_config_vars_error_data() { return array( array( diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index 8e59011829..16891d936b 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -28,7 +28,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that don't throw an error. */ - public function validate_range_data_fit() + public static function validate_range_data_fit() { return array( array(array(array('column_type' => 'BOOL', 'lang' => 'TEST', 'value' => 0))), @@ -74,7 +74,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that throw the SETTING_TOO_LOW-error. */ - public function validate_range_data_too_low() + public static function validate_range_data_too_low() { return array( array(array(array('column_type' => 'BOOL', 'lang' => 'TEST', 'value' => -1))), @@ -109,7 +109,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that throw the SETTING_TOO_BIG-error. */ - public function validate_range_data_too_big() + public static function validate_range_data_too_big() { return array( array(array(array('column_type' => 'BOOL', 'lang' => 'TEST', 'value' => 2))), @@ -144,7 +144,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that throw the SETTING_TOO_LONG-error. */ - public function validate_range_data_too_long() + public static function validate_range_data_too_long() { return array( array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => str_repeat('a', 256)))), diff --git a/tests/functions_content/get_context_test.php b/tests/functions_content/get_context_test.php index f2865f31ee..0b98018aab 100644 --- a/tests/functions_content/get_context_test.php +++ b/tests/functions_content/get_context_test.php @@ -20,7 +20,7 @@ class phpbb_functions_content_get_context_test extends TestCase * * @return array */ - public function data_get_context(): array + public static function data_get_context(): array { return [ 'text contains words and length greater than text' => [ @@ -121,100 +121,100 @@ class phpbb_functions_content_get_context_test extends TestCase * * @return array */ - public function data_get_context_unicode(): array + public static function data_get_context_unicode(): array { return [ - 'text contains words and length greater than text' => [ + 'text contains words and length greater than text unicode' => [ 'text' => 'Это пример текста, содержащего разнообразные слова, включая пример, текст и слова.', 'words' => ['пример', 'слова'], 'length' => 100, 'expected' => 'Это пример текста, содержащего разнообразные слова, включая пример, текст и слова.', ], - 'text contains words and length less than text' => [ + 'text contains words and length less than text unicode' => [ 'text' => 'Это пример текста, содержащего разнообразные слова, включая шаблон, текст и слова.', 'words' => ['пример', 'слова'], 'length' => 50, 'expected' => 'Это пример текста, содержащего разнообразные слова ...', ], - 'text does not contain words' => [ + 'text does not contain words unicode' => [ 'text' => 'Это пример текста, содержащего разнообразные слова, но ни одно из них не совпадает с искомыми.', 'words' => ['nonexistent'], 'length' => 50, 'expected' => 'Это пример текста, содержащего разнообразные слова ...', ], - 'desired length equal to text length' => [ + 'desired length equal to text length unicode' => [ 'text' => 'Текст точной длины.', 'words' => ['Текст', 'точной'], 'length' => 19, 'expected' => 'Текст точной длины.', ], - 'text with html entities' => [ + 'text with html entities unicode' => [ 'text' => 'Это пример текста, содержащего & и < и > лексемы.', 'words' => ['пример', 'содержащего'], 'length' => 40, 'expected' => 'Это пример текста, содержащего & и < и ...', ], - 'text with html entities and contains last word' => [ + 'text with html entities and contains last word unicode' => [ 'text' => 'Это пример текста, содержащего & и < и > лексемы.', 'words' => ['пример', 'лексемы'], 'length' => 40, 'expected' => 'Это пример текста ... и < и > лексемы.', ], - 'text with multiple spaces and special characters' => [ + 'text with multiple spaces and special characters unicode' => [ 'text' => 'Это пример текста, содержащего разнообразные слова.', 'words' => ['пример', 'разнообразные'], 'length' => 50, 'expected' => 'Это пример текста, содержащего разнообразные слова.', ], - 'empty text' => [ + 'empty text unicode' => [ 'text' => '', 'words' => ['пример', 'слова'], 'length' => 50, 'expected' => '', ], - 'empty words array' => [ + 'empty words array unicode' => [ 'text' => 'Это пример текста, содержащего разнообразные слова.', 'words' => [], 'length' => 50, 'expected' => 'Это пример текста, содержащего разнообразные слова.', ], - 'zero length' => [ + 'zero length unicode' => [ 'text' => 'Это пример текста.', 'words' => ['пример'], 'length' => 0, 'expected' => 'Это пример текста.', ], - 'negative length' => [ + 'negative length unicode' => [ 'text' => 'Это пример текста.', 'words' => ['sample'], 'length' => -10, 'expected' => 'Это пример текста.', ], - 'ellipses_beginning' => [ + 'ellipses_beginning unicode' => [ 'text' => 'раз раз раз раз раз раз раз раз два', 'words' => ['два'], 'length' => 10, 'expected' => '... раз раз два', ], - 'ellipsis_end' => [ + 'ellipsis_end unicode' => [ 'text' => 'два раз раз раз раз раз раз раз раз', 'words' => ['два'], 'length' => 10, 'expected' => 'два раз раз ...', ], - 'ellipsis_middle' => [ + 'ellipsis_middle unicode' => [ 'text' => 'раз слово1 раз раз раз раз раз раз раз раз раз слово2 раз', 'words' => ['слово1', 'слово2'], 'length' => 15, 'expected' => '... слово1 ... слово2 ...', ], - 'ellipsis_middle2' => [ + 'ellipsis_middle2 unicode' => [ 'text' => 'слово1 foo foo foo foo foo foo foo foo foo слово2', 'words' => ['слово1', 'слово2'], 'length' => 10, 'expected' => 'слово1 ... слово2', ], - 'fruits_spanish' => [ + 'fruits_spanish unicode' => [ 'text' => 'Manzana,plátano,naranja,fresa,mango,uva,piña,pera,kiwi,cereza,sandía,melón,papaya,arándano,durazno', 'words' => ['piña'], 'length' => 20, diff --git a/tests/functions_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php index 94ac99f272..3abd10be5c 100644 --- a/tests/functions_content/get_username_string_test.php +++ b/tests/functions_content/get_username_string_test.php @@ -30,7 +30,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $user->lang['GUEST'] = 'Guest'; } - public function get_username_string_profile_data() + public static function get_username_string_profile_data() { global $phpbb_root_path, $phpEx; @@ -49,7 +49,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('profile', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_username_data() + public static function get_username_string_username_data() { return array( array(ANONYMOUS, '', '', false, false, 'Guest'), @@ -68,7 +68,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('username', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_colour_data() + public static function get_username_string_colour_data() { return array( array(0, '', '', false, false, ''), @@ -86,7 +86,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('colour', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_full_data() + public static function get_username_string_full_data() { global $phpbb_root_path, $phpEx; @@ -107,7 +107,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('full', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_no_profile_data() + public static function get_username_string_no_profile_data() { return array( array(ANONYMOUS, 'Anonymous', '', false, false, 'Anonymous'), diff --git a/tests/functions_content/phpbb_clean_search_string_test.php b/tests/functions_content/phpbb_clean_search_string_test.php index 34ae0575c5..0744fa1764 100644 --- a/tests/functions_content/phpbb_clean_search_string_test.php +++ b/tests/functions_content/phpbb_clean_search_string_test.php @@ -13,7 +13,7 @@ class phpbb_functions_content_phpbb_clean_search_string_test extends phpbb_test_case { - public function phpbb_clean_search_string_data() + public static function phpbb_clean_search_string_data() { return array( array('*', ''), diff --git a/tests/functions_content/phpbb_format_quote_test.php b/tests/functions_content/phpbb_format_quote_test.php index 04dc620c29..7156ea7317 100644 --- a/tests/functions_content/phpbb_format_quote_test.php +++ b/tests/functions_content/phpbb_format_quote_test.php @@ -31,7 +31,7 @@ class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case parent::setUp(); } - public function data_phpbb_format_quote() + public static function data_phpbb_format_quote() { return [ [true, ['author' => 'admin', 'user_id' => 2], '[quote="username"]quoted[/quote]', '', "[quote=admin user_id=2][quote="username"]quoted[/quote][/quote]\n\n"], diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php index 9f4f69d0c2..a7bdcdfb2b 100644 --- a/tests/functions_user/delete_user_test.php +++ b/tests/functions_user/delete_user_test.php @@ -68,7 +68,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); } - public function first_last_post_data() + public static function first_last_post_data() { return array( array( @@ -227,7 +227,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $this->db->sql_freeresult($result); } - public function report_attachment_data() + public static function report_attachment_data() { return array( array( @@ -311,7 +311,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $this->db->sql_freeresult($result); } - public function delete_data() + public static function delete_data() { return array( array( @@ -397,7 +397,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $this->db->sql_freeresult($result); } - public function delete_user_id_data() + public static function delete_user_id_data() { return array( array( diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index 887c21d4ca..c0d884e4d8 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -20,7 +20,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes return $this->createXMLDataSet(__DIR__.'/fixtures/group_user_attributes.xml'); } - public function group_user_attributes_data() + public static function group_user_attributes_data() { return array( array( diff --git a/tests/functions_user/whois_test.php b/tests/functions_user/whois_test.php index 4dd72311bb..26793802d5 100644 --- a/tests/functions_user/whois_test.php +++ b/tests/functions_user/whois_test.php @@ -30,7 +30,7 @@ class phpbb_functions_user_whois_test extends phpbb_test_case ->getMock(); } - public function ips_data() + public static function ips_data() { return [ ['2001:4860:4860::8888'], // Google public DNS diff --git a/tests/group/helper_get_name_string_test.php b/tests/group/helper_get_name_string_test.php index 34dab1471d..154fcb2f62 100644 --- a/tests/group/helper_get_name_string_test.php +++ b/tests/group/helper_get_name_string_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_case { - public function get_name_string_profile_data() + public static function get_name_string_profile_data() { global $phpbb_root_path, $phpEx; @@ -35,7 +35,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('profile', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_group_name_data() + public static function get_name_string_group_name_data() { return array( // Should be fine @@ -57,7 +57,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('group_name', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_colour_data() + public static function get_name_string_colour_data() { return array( array(0, '', '', false, ''), @@ -75,7 +75,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('colour', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_full_data() + public static function get_name_string_full_data() { global $phpbb_root_path, $phpEx; @@ -95,7 +95,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('full', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_no_profile_data() + public static function get_name_string_no_profile_data() { return array( array(0, 'BOTS', '000000', false, 'Bots'), diff --git a/tests/group/helper_get_rank_test.php b/tests/group/helper_get_rank_test.php index 95dc2ae600..5d427b49ee 100644 --- a/tests/group/helper_get_rank_test.php +++ b/tests/group/helper_get_rank_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_rank_test extends phpbb_group_helper_test_case { - public function get_rank_data() + public static function get_rank_data() { global $phpbb_root_path; diff --git a/tests/group/helper_test_case.php b/tests/group/helper_test_case.php index f42dd13fa0..1514c616a9 100644 --- a/tests/group/helper_test_case.php +++ b/tests/group/helper_test_case.php @@ -101,7 +101,7 @@ class phpbb_group_helper_test_case extends phpbb_test_case // Set up path helper $path_helper = $this->getMockBuilder('\phpbb\path_helper') ->disableOriginalConstructor() - ->setMethods(array()) + ->onlyMethods(['get_phpbb_root_path', 'get_php_ext', 'update_web_root_path']) ->getMock(); $path_helper->method('get_phpbb_root_path') ->willReturn($phpbb_root_path); diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php index 13c909b6e5..9381cd8b5f 100644 --- a/tests/groupposition/legend_test.php +++ b/tests/groupposition/legend_test.php @@ -18,7 +18,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/fixtures/legend.xml'); } - public function get_group_value_data() + public static function get_group_value_data() { return array( array(1, 0, ''), @@ -57,7 +57,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals(2, $test_class->get_group_count()); } - public function add_group_data() + public static function add_group_data() { return array( array( @@ -101,7 +101,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function delete_group_data() + public static function delete_group_data() { return array( array( @@ -187,7 +187,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_up_data() + public static function move_up_data() { return array( array( @@ -240,7 +240,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_down_data() + public static function move_down_data() { return array( array( @@ -293,7 +293,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_data() + public static function move_data() { return array( array( diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php index c8cfed6c49..5620099698 100644 --- a/tests/groupposition/teampage_test.php +++ b/tests/groupposition/teampage_test.php @@ -18,7 +18,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/fixtures/teampage.xml'); } - public function get_group_value_data() + public static function get_group_value_data() { return array( array(2, 3, ''), @@ -57,7 +57,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals(8, $test_class->get_group_count()); } - public function add_group_teampage_data() + public static function add_group_teampage_data() { return array( array( @@ -145,7 +145,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function add_category_teampage_data() + public static function add_category_teampage_data() { return array( array( @@ -186,7 +186,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function delete_group_data() + public static function delete_group_data() { return array( array( @@ -251,7 +251,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function delete_teampage_data() + public static function delete_teampage_data() { return array( array( @@ -301,7 +301,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_data() + public static function move_data() { return array( array( @@ -462,7 +462,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_teampage_data() + public static function move_teampage_data() { return array( array( diff --git a/tests/help/manager_test.php b/tests/help/manager_test.php index 02695806b6..428e0e5201 100644 --- a/tests/help/manager_test.php +++ b/tests/help/manager_test.php @@ -36,7 +36,7 @@ class phpbb_help_manager_test extends phpbb_test_case ); } - public function add_block_data() + public static function add_block_data() { return array( array('abc', false, array(), false), @@ -78,25 +78,31 @@ class phpbb_help_manager_test extends phpbb_test_case $this->language->expects($this->exactly(count($questions)*2 + 1)) ->method('lang') - ->withConsecutive([$block_name], ...$question_ary) - ->will($this->onConsecutiveCalls(strtoupper($block_name), ...$question_ary_upper)); + ->willReturnCallback(fn(string $arg) => strtoupper($arg)); + + $expected_calls = [ + ['faq_block', [ + 'BLOCK_TITLE' => strtoupper($block_name), + 'SWITCH_COLUMN' => $switch_expected, + ]], + ...$template_call_args + ]; $this->template->expects($this->exactly(count($questions) + 1)) ->method('assign_block_vars') - ->withConsecutive( - ['faq_block', [ - 'BLOCK_TITLE' => strtoupper($block_name), - 'SWITCH_COLUMN' => $switch_expected, - ]], - ...$template_call_args - ); + ->willReturnCallback(function($blockName, $blockVars) use (&$expected_calls) { + static $call = 0; + $this->assertEquals($expected_calls[$call][0], $blockName); + $this->assertEquals($expected_calls[$call][1], $blockVars); + $call++; + }); $this->manager->add_block($block_name, $switch, $questions); $this->assertEquals($switch_expected, $this->manager->switched_column()); } - public function add_question_data() + public static function add_question_data() { return array( array('question1', 'answer1'), @@ -114,11 +120,7 @@ class phpbb_help_manager_test extends phpbb_test_case { $this->language->expects($this->exactly(2)) ->method('lang') - ->withConsecutive( - [$question], - [$answer] - ) - ->will($this->onConsecutiveCalls(strtoupper($question), strtoupper($answer))); + ->willReturnCallback(fn(string $arg) => strtoupper($arg)); $this->template->expects($this->once()) ->method('assign_block_vars') @@ -137,22 +139,27 @@ class phpbb_help_manager_test extends phpbb_test_case $this->language->expects($this->exactly(2)) ->method('lang') - ->withConsecutive([$block_name[0]], [$block_name[1]]) - ->will($this->onConsecutiveCalls(strtoupper($block_name[0]), strtoupper($block_name[1]))); + ->willReturnCallback(fn(string $arg) => strtoupper($arg)); - $this->template->expects($this->exactly(2)) + $expected_calls = [ + ['faq_block', [ + 'BLOCK_TITLE' => strtoupper($block_name[0]), + 'SWITCH_COLUMN' => $switch_expected[0], + ]], + ['faq_block', [ + 'BLOCK_TITLE' => strtoupper($block_name[1]), + 'SWITCH_COLUMN' => $switch_expected[1], + ]] + ]; + + $this->template->expects($this->exactly(count($expected_calls))) ->method('assign_block_vars') - ->withConsecutive( - ['faq_block', [ - 'BLOCK_TITLE' => strtoupper($block_name[0]), - 'SWITCH_COLUMN' => $switch_expected[0], - ]], - ['faq_block', [ - 'BLOCK_TITLE' => strtoupper($block_name[1]), - 'SWITCH_COLUMN' => $switch_expected[1], - ]] - - ); + ->willReturnCallback(function($blockName, $blockVars) use (&$expected_calls) { + static $call = 0; + $this->assertEquals($expected_calls[$call][0], $blockName); + $this->assertEquals($expected_calls[$call][1], $blockVars); + $call++; + }); $this->manager->add_block($block_name[0], true); $this->assertTrue($this->manager->switched_column()); diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php index 03c9152a5b..306a8c1926 100644 --- a/tests/installer/database_helper_test.php +++ b/tests/installer/database_helper_test.php @@ -57,7 +57,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case public function test_validate_table_prefix($expected, $test_string) { $db_helper_mock = $this->getMockBuilder('\phpbb\install\helper\database') - ->setMethods(array('get_available_dbms')) + ->onlyMethods(array('get_available_dbms')) ->disableOriginalConstructor() ->getMock(); @@ -76,7 +76,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case } // Data provider for the remove comments function - public function comment_string_provider() + public static function comment_string_provider() { return array( array( @@ -99,7 +99,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case } // Data provider for the sql file splitter function - public function sql_file_string_provider() + public static function sql_file_string_provider() { return array( array( @@ -116,7 +116,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case } // Test data for prefix test - public function prefix_test_case_provider() + public static function prefix_test_case_provider() { return array( array( diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php index 9b08dc3b26..5e19a9d640 100644 --- a/tests/installer/installer_config_test.php +++ b/tests/installer/installer_config_test.php @@ -25,9 +25,9 @@ class phpbb_installer_config_test extends phpbb_test_case $phpbb_root_path = __DIR__ . './../../phpBB/'; $filesystem = $this->createMock('\phpbb\filesystem\filesystem'); $php_ini = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper') - ->setMethods(array('getInt', 'getBytes')) + ->onlyMethods(array('getNumeric', 'getBytes')) ->getMock(); - $php_ini->method('getInt') + $php_ini->method('getNumeric') ->willReturn(-1); $php_ini->method('getBytes') ->willReturn(-1); diff --git a/tests/json/sanitizer_test.php b/tests/json/sanitizer_test.php index 267dcaf774..286d02d6f1 100644 --- a/tests/json/sanitizer_test.php +++ b/tests/json/sanitizer_test.php @@ -15,7 +15,7 @@ use phpbb\json\sanitizer as json_sanitizer; class phpbb_json_sanitizer_test extends phpbb_test_case { - public function data_decode() + public static function data_decode() { return [ [false, []], diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php index 366d66ee0b..5383d3d04a 100644 --- a/tests/log/delete_test.php +++ b/tests/log/delete_test.php @@ -37,7 +37,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case parent::setUp(); } - public function log_delete_data() + public static function log_delete_data() { return array( array( diff --git a/tests/mcp/post_ip_test.php b/tests/mcp/post_ip_test.php index bd443892e1..1a8e9624b3 100644 --- a/tests/mcp/post_ip_test.php +++ b/tests/mcp/post_ip_test.php @@ -30,7 +30,7 @@ class phpbb_mcp_post_ip_test extends phpbb_database_test_case $this->db = $this->new_dbal(); } - public function data_get_num_ips() + public static function data_get_num_ips() { return array( array(2, 1), @@ -47,7 +47,7 @@ class phpbb_mcp_post_ip_test extends phpbb_database_test_case $this->assertSame($expected, phpbb_get_num_ips_for_poster($this->db, $poster_id)); } - public function data_get_num_posters() + public static function data_get_num_posters() { return array( array(2, '127.0.0.1'), diff --git a/tests/mention/controller_test.php b/tests/mention/controller_test.php index 664ab2bc92..cef50af781 100644 --- a/tests/mention/controller_test.php +++ b/tests/mention/controller_test.php @@ -161,7 +161,7 @@ class phpbb_mention_controller_test extends phpbb_database_test_case $this->controller = new \phpbb\mention\controller\mention($mention_sources_array, $request, $phpbb_root_path, $phpEx); } - public function handle_data() + public static function handle_data() { /** * NOTE: @@ -546,13 +546,13 @@ class phpbb_mention_controller_test extends phpbb_database_test_case { $this->request->expects($this->atLeast(2)) ->method('variable') - ->withConsecutive( - ['keyword', '', true], - ['topic_id', 0]) - ->willReturnOnConsecutiveCalls( - $keyword, - $topic_id - ); + ->willReturnCallback(function() use ($keyword, $topic_id) { + $args = func_get_args(); + return match($args) { + ['keyword', '', true, \phpbb\request\request_interface::REQUEST] => $keyword, + ['topic_id', 0, false, \phpbb\request\request_interface::REQUEST] => $topic_id, + };}); + $data = json_decode($this->controller->handle()->getContent(), true); $this->assertEquals($expected_result, $data); } diff --git a/tests/messenger/method_base_test.php b/tests/messenger/method_base_test.php index 38e7a921b1..4c6e90e84c 100644 --- a/tests/messenger/method_base_test.php +++ b/tests/messenger/method_base_test.php @@ -37,6 +37,8 @@ class phpbb_messenger_method_base_test extends \phpbb_test_case protected $twig_extensions_collection; protected $twig_lexer; protected $user; + protected $filesystem; + protected $symfony_request; public function setUp(): void { diff --git a/tests/messenger/method_email_test.php b/tests/messenger/method_email_test.php index fe5c24808c..84346c5298 100644 --- a/tests/messenger/method_email_test.php +++ b/tests/messenger/method_email_test.php @@ -37,6 +37,8 @@ class phpbb_messenger_method_email_test extends \phpbb_test_case protected $twig_extensions_collection; protected $twig_lexer; protected $user; + protected $filesystem; + protected $symfony_request; public function setUp(): void { @@ -580,7 +582,7 @@ class phpbb_messenger_method_email_test extends \phpbb_test_case $this->method_email->send(); } - public function email_template_data(): array + public static function email_template_data(): array { return [ ['test'], diff --git a/tests/messenger/queue_test.php b/tests/messenger/queue_test.php index 3f87de91fc..a7f336b14a 100644 --- a/tests/messenger/queue_test.php +++ b/tests/messenger/queue_test.php @@ -18,6 +18,7 @@ use phpbb\messenger\queue; class phpbb_messenger_queue_test extends phpbb_test_case { protected $config; + protected $cache_file; protected $dispatcher; protected $service_collection; diff --git a/tests/migrations/migrations_check_config_added_test.php b/tests/migrations/migrations_check_config_added_test.php index 5cde980cde..71c5ee7f07 100644 --- a/tests/migrations/migrations_check_config_added_test.php +++ b/tests/migrations/migrations_check_config_added_test.php @@ -43,6 +43,9 @@ class migrations_check_config_added_test extends phpbb_test_case /** @var string */ protected $php_ext; + /** @var string */ + protected $schema_data; + protected function setUp(): void { global $phpbb_root_path; @@ -51,7 +54,7 @@ class migrations_check_config_added_test extends phpbb_test_case $this->schema_data = file_get_contents($phpbb_root_path . 'install/schemas/schema_data.sql'); } - public function get_config_options_from_migrations() + protected function get_config_names() { global $phpbb_root_path, $phpEx; @@ -154,18 +157,18 @@ class migrations_check_config_added_test extends phpbb_test_case // Drop configuration options which were removed by config.remove $config_names = array_diff_key($config_names, $config_removed); - return $config_names; + + return array_combine(array_column($config_names, 0), array_column($config_names, 1)); } - /** - * @dataProvider get_config_options_from_migrations - */ - public function test_config_option_exists_in_schema_data($config_name, $class) + public function test_config_option_exists_in_schema_data() { $message = 'Migration: %1$s, config_name: %2$s; not added to schema_data.sql'; - - $this->assertNotFalse(strpos($this->schema_data, $config_name), - sprintf($message, $class, $config_name) - ); + foreach ($this->get_config_names() as $config_name => $class) + { + $this->assertNotFalse(strpos($this->schema_data, $config_name), + sprintf($message, $class, $config_name) + ); + } } } diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php index 7bc434e33c..59869454bc 100644 --- a/tests/migrator/convert_timezones_test.php +++ b/tests/migrator/convert_timezones_test.php @@ -15,6 +15,7 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case { protected $db; protected $db_doctrine; + protected $migration; public function getDataSet() { diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php index f8a92c742a..02ee53e172 100644 --- a/tests/migrator/get_callable_from_step_test.php +++ b/tests/migrator/get_callable_from_step_test.php @@ -13,6 +13,9 @@ class get_callable_from_step_test extends phpbb_database_test_case { + protected $migrator; + protected $module_added; + protected function setUp(): void { global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log, $user; @@ -70,7 +73,7 @@ class get_callable_from_step_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/../dbal/fixtures/migrator.xml'); } - public function get_callable_from_step_provider() + public static function get_callable_from_step_provider() { return array( array( diff --git a/tests/migrator/get_schema_steps_test.php b/tests/migrator/get_schema_steps_test.php index 9b5e6c6697..71f9baaef2 100644 --- a/tests/migrator/get_schema_steps_test.php +++ b/tests/migrator/get_schema_steps_test.php @@ -13,6 +13,8 @@ class get_schema_steps_test extends phpbb_test_case { + protected $helper; + protected function setUp(): void { parent::setUp(); @@ -20,7 +22,7 @@ class get_schema_steps_test extends phpbb_test_case $this->helper = new \phpbb\db\migration\helper(); } - public function schema_provider() + public static function schema_provider() { return array( array( diff --git a/tests/migrator/reverse_update_data_test.php b/tests/migrator/reverse_update_data_test.php index 83ae8e780d..856cf12149 100644 --- a/tests/migrator/reverse_update_data_test.php +++ b/tests/migrator/reverse_update_data_test.php @@ -23,7 +23,7 @@ class reverse_update_data_test extends phpbb_test_case $this->helper = new \phpbb\db\migration\helper(); } - public function update_data_provider() + public static function update_data_provider() { return array( array( @@ -34,7 +34,7 @@ class reverse_update_data_test extends phpbb_test_case array('permission.add', array('some_data')), )), array('config.remove', array('foobar')), - array('custom', array(array($this, 'foo_bar'))), + array('custom', array(array(self::class, 'foo_bar'))), array('tool.method', array('test_data')), ), array( diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php index 943029304f..e7129c4cc3 100644 --- a/tests/migrator/schema_generator_test.php +++ b/tests/migrator/schema_generator_test.php @@ -21,9 +21,30 @@ require_once __DIR__ . '/../dbal/migration/dummy_order_5.php'; class schema_generator_test extends phpbb_test_case { + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\db\tools\doctrine */ + protected $db_tools; + + /** @var \Doctrine\DBAL\Connection */ + protected $doctrine_db; + /** @var \phpbb\db\migration\schema_generator */ protected $generator; + /** @var string */ + protected $table_prefix; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + protected function setUp(): void { global $phpbb_root_path, $phpEx; @@ -68,7 +89,7 @@ class schema_generator_test extends phpbb_test_case $this->assertArrayHasKey('phpbb_users', $this->generator->get_schema()); } - public function column_add_after_data() + public static function column_add_after_data() { return array( array( diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index 559a880a7a..8333f9542c 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -27,6 +27,12 @@ class guesser_test extends \phpbb_test_case protected $fileinfo_supported = false; + protected $guesser; + protected $guesser_no_fileinfo; + protected $path; + protected $jpg_file; + protected $phpbb_root_path; + protected function setUp(): void { global $phpbb_root_path; @@ -50,7 +56,7 @@ class guesser_test extends \phpbb_test_case $this->phpbb_root_path = $phpbb_root_path; } - public function data_guess_files() + public static function data_guess_files() { return array( array('image/gif', 'gif'), @@ -76,7 +82,7 @@ class guesser_test extends \phpbb_test_case $this->assertEquals($expected, $this->guesser->guess($this->path . '/../upload/fixture/' . $file)); } - public function data_guess_files_no_fileinfo() + public static function data_guess_files_no_fileinfo() { return array( array('application/octet-stream', 'gif'), @@ -112,7 +118,7 @@ class guesser_test extends \phpbb_test_case $this->assertEquals('application/octet-stream', $guesser->guess($this->jpg_file)); } - public function data_incorrect_guessers() + public static function data_incorrect_guessers() { return array( array(array(new \phpbb\mimetype\incorrect_guesser)), @@ -130,7 +136,7 @@ class guesser_test extends \phpbb_test_case $guesser = new \phpbb\mimetype\guesser($guessers); } - public function data_content_guesser() + public static function data_content_guesser() { return array( array( @@ -210,7 +216,7 @@ class guesser_test extends \phpbb_test_case $this->assertInstanceOf('\phpbb\mimetype\extension_guesser', $guessers[3]); } - public function data_choose_mime_type() + public static function data_choose_mime_type() { return array( array('application/octet-stream', 'application/octet-stream', null), diff --git a/tests/mock/user.php b/tests/mock/user.php index 254c02f669..f6bf0166e1 100644 --- a/tests/mock/user.php +++ b/tests/mock/user.php @@ -24,6 +24,9 @@ class phpbb_mock_user public $style = []; public $data = []; public $lang = []; + public $ip = ''; + public $module; + public $session_id; private $options = array(); public function optionget($item, $data = false) diff --git a/tests/network/ip_normalise_test.php b/tests/network/ip_normalise_test.php index 52e594e115..e15c76af1d 100644 --- a/tests/network/ip_normalise_test.php +++ b/tests/network/ip_normalise_test.php @@ -13,7 +13,7 @@ class phpbb_network_ip_normalise_test extends phpbb_test_case { - public function data_provider() + public static function data_provider() { return array( // From: A Recommendation for IPv6 Address Text Representation diff --git a/tests/notification/base.php b/tests/notification/base.php index ec6319c420..a018191d66 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -21,7 +21,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case { /** @var phpbb_notification_manager_helper */ protected $notifications; - protected $db, $container, $user, $config, $auth, $cache; + protected $db, $container, $user, $config, $auth, $cache, $user_loader, $phpbb_dispatcher; protected function get_notification_types() { diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 6c1f7b496e..b890b47599 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -14,7 +14,9 @@ require_once __DIR__ . '/../mock/sql_insert_buffer.php'; class phpbb_notification_convert_test extends phpbb_database_test_case { - protected $notifications, $db, $doctrine_db, $container, $user, $config, $auth, $cache; + protected $db; + protected $doctrine_db; + protected $migration; public function getDataSet() { diff --git a/tests/notification/notification_method_email_test.php b/tests/notification/notification_method_email_test.php index 6400c8bb1d..71ebffef89 100644 --- a/tests/notification/notification_method_email_test.php +++ b/tests/notification/notification_method_email_test.php @@ -120,7 +120,7 @@ class notification_method_email_test extends phpbb_tests_notification_base $phpbb_container->getParameter('tables.notification_emails'), $phpbb_container->get('messenger.method_collection') ]) - ->setMethods(['notify_using_messenger']) + ->onlyMethods(['notify_using_messenger']) ->getMock(); $notification_method_email = $this->notification_method_email; @@ -178,7 +178,7 @@ class notification_method_email_test extends phpbb_tests_notification_base $this->notifications->set_var('notification_methods', $methods); } - public function data_notification_email() + public static function data_notification_email() { return [ /** diff --git a/tests/notification/notification_method_webpush_test.php b/tests/notification/notification_method_webpush_test.php index 7967a0f7c6..a1b7e6325e 100644 --- a/tests/notification/notification_method_webpush_test.php +++ b/tests/notification/notification_method_webpush_test.php @@ -231,7 +231,7 @@ class notification_method_webpush_test extends phpbb_tests_notification_base $this->notifications->set_var('notification_methods', $methods); } - public function data_notification_webpush() + public static function data_notification_webpush() { return [ /** @@ -656,7 +656,7 @@ class notification_method_webpush_test extends phpbb_tests_notification_base $this->assertCount(0, $cur_notifications, 'Assert that no notifications have been pruned'); } - public function data_set_endpoint_padding(): array + public static function data_set_endpoint_padding(): array { return [ [ diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 08505667d7..d90a4736a8 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -19,8 +19,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_posting.php'; abstract class phpbb_notification_submit_post_base extends phpbb_database_test_case { - protected $notifications, $db, $container, $user, $config, $auth, $cache; - + protected $db; protected $item_type = ''; protected $poll_data = array(); @@ -52,9 +51,9 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c protected function setUp(): void { - parent::setUp(); + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; - global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader; + parent::setUp(); // Database $this->db = $this->new_dbal(); @@ -103,15 +102,15 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $storage = $this->createMock('\phpbb\storage\storage'); // User - $user = $this->createMock('\phpbb\user'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->ip = ''; - $user->data = array( - 'user_id' => 2, - 'username' => 'user-name', - 'is_registered' => true, - 'user_colour' => '', - 'user_lastmark' => 0, - ); + $user->data['user_id'] = 2; + $user->data['username'] = 'user-name'; + $user->data['is_registered'] = true; + $user->data['user_colour'] = ''; + $user->data['user_lastmark'] = 0; // Request $request = new phpbb_mock_request(); @@ -122,6 +121,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user_loader = new \phpbb\user_loader($avatar_helper, $db, $phpbb_root_path, $phpEx, USERS_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); // Container $phpbb_container = new ContainerBuilder(); @@ -190,6 +190,14 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c */ public function test_submit_post($additional_post_data, $expected_before, $expected_after) { + global $db, $auth, $user, $config, $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + + if (isset($additional_post_data['message'])) + { + $parser = $this->get_test_case_helpers()->set_s9e_services($phpbb_container)->get('text_formatter.parser'); + $additional_post_data['message'] = $parser->parse($additional_post_data['message']); + } + $sql = 'SELECT user_id, item_id, item_parent_id FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt WHERE nt.notification_type_name = '" . $this->item_type . "' diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php index d3161b5ccd..1726d09e9b 100644 --- a/tests/notification/submit_post_type_bookmark_test.php +++ b/tests/notification/submit_post_type_bookmark_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -49,7 +51,7 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati * submit_post() $mode = 'reply' * Notification item_type = 'bookmark' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_forum_test.php b/tests/notification/submit_post_type_forum_test.php index 7f06b18951..e6c20fd9dd 100644 --- a/tests/notification/submit_post_type_forum_test.php +++ b/tests/notification/submit_post_type_forum_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_forum_test extends phpbb_notification_ public function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -59,7 +61,7 @@ class phpbb_notification_submit_post_type_forum_test extends phpbb_notification_ * submit_post() $mode = 'reply' * Notification item_type = 'notification.type.forum' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_mention_test.php b/tests/notification/submit_post_type_mention_test.php index f660a38ecc..80204b8351 100644 --- a/tests/notification/submit_post_type_mention_test.php +++ b/tests/notification/submit_post_type_mention_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/submit_post_base.php'; +require_once __DIR__ . '/submit_post_base.php'; class phpbb_notification_submit_post_type_mention_test extends phpbb_notification_submit_post_base { @@ -19,9 +19,9 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio public function setUp(): void { - parent::setUp(); + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; - global $auth; + parent::setUp(); // Add additional permissions $auth->expects($this->any()) @@ -53,11 +53,8 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio * submit_post() $mode = 'reply' * Notification item_type = 'mention' */ - public function submit_post_data() + public static function submit_post_data() { - // The new mock container is needed because the data providers may be executed before phpunit call setUp() - $parser = $this->get_test_case_helpers()->set_s9e_services(new phpbb_mock_container_builder())->get('text_formatter.parser'); - return array( /** * Normal post @@ -73,7 +70,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[mention=u:2]poster[/mention] poster should not be notified', '[mention=u:3]test[/mention] test should be notified', '[mention=u:4]unauthorized[/mention] unauthorized to read, should not receive a notification', @@ -83,7 +80,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio '[mention=g:1]normal group[/mention] group members of a normal group shoud receive a notification', '[mention=g:2]hidden group[/mention] group members of a hidden group shoud not receive a notification from a non-member', '[mention=u:10]doesn\'t exist[/mention] user does not exist, should not receive a notification', - ))), + )), 'bbcode_uid' => 'uid', ), array( @@ -105,7 +102,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[mention=u:2]poster[/mention] poster should not be notified', '[mention=u:3]test[/mention] test should be notified', '[mention=u:4]unauthorized[/mention] unauthorized to read, should not receive a notification', @@ -113,7 +110,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio '[mention=u:6]disabled[/mention] option disabled, should not receive a notification', '[mention=u:7]default[/mention] option set to default, should receive a notification', '[mention=u:8]doesn\'t exist[/mention] user does not exist, should not receive a notification', - ))), + )), 'bbcode_uid' => 'uid', 'force_approved_state' => false, ), diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php index 3ef4395c0f..002bb60f2b 100644 --- a/tests/notification/submit_post_type_post_in_queue_test.php +++ b/tests/notification/submit_post_type_post_in_queue_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notif protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -62,7 +64,7 @@ class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notif * submit_post() $mode = 'reply' * Notification item_type = 'post_in_queue' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php index d63822bad0..cb6008f500 100644 --- a/tests/notification/submit_post_type_post_test.php +++ b/tests/notification/submit_post_type_post_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -59,7 +61,7 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s * submit_post() $mode = 'reply' * Notification item_type = 'post' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php index fd73a264fa..92222f9e41 100644 --- a/tests/notification/submit_post_type_quote_test.php +++ b/tests/notification/submit_post_type_quote_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -49,11 +51,8 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ * submit_post() $mode = 'reply' * Notification item_type = 'quote' */ - public function submit_post_data() + public static function submit_post_data() { - // The new mock container is needed because the data providers may be executed before phpunit call setUp() - $parser = $this->get_test_case_helpers()->set_s9e_services(new phpbb_mock_container_builder())->get('text_formatter.parser'); - return array( /** * Normal post @@ -68,7 +67,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[quote="poster"]poster should not be notified[/quote]', '[quote="test"]test should be notified[/quote]', '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]', @@ -76,7 +75,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ '[quote="disabled"]option disabled, should not receive a notification[/quote]', '[quote="default"]option set to default, should receive a notification[/quote]', '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]', - ))), + )), 'bbcode_uid' => 'uid', ), array( @@ -97,7 +96,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[quote="poster"]poster should not be notified[/quote]', '[quote="test"]test should be notified[/quote]', '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]', @@ -105,7 +104,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ '[quote="disabled"]option disabled, should not receive a notification[/quote]', '[quote="default"]option set to default, should receive a notification[/quote]', '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]', - ))), + )), 'bbcode_uid' => 'uid', 'force_approved_state' => false, ), diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php index b4297dee6b..28403ec0ed 100644 --- a/tests/notification/submit_post_type_topic_test.php +++ b/tests/notification/submit_post_type_topic_test.php @@ -19,9 +19,9 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ protected function setUp(): void { - parent::setUp(); + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; - global $auth, $phpbb_log; + parent::setUp(); // Add additional permissions $auth->expects($this->any()) @@ -41,8 +41,6 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ ), ), ))); - - $phpbb_log = $this->createMock('\phpbb\log\dummy'); } /** @@ -51,7 +49,7 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ * submit_post() $mode = 'post' * Notification item_type = 'topic' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** @@ -97,6 +95,8 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ */ public function test_submit_post($additional_post_data, $expected_before, $expected_after) { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + $sql = 'SELECT user_id, item_id, item_parent_id FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt WHERE nt.notification_type_name = '" . $this->item_type . "' diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php index 6ae225b667..f895b89589 100644 --- a/tests/notification/user_list_trim_test.php +++ b/tests/notification/user_list_trim_test.php @@ -70,7 +70,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case ); } - public function user_list_trim_data() + public static function user_list_trim_data() { return array( array( diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 0a665c1cfb..51b2f8752b 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -15,6 +15,10 @@ require_once __DIR__ . '/../template/template_test_case.php'; class phpbb_pagination_pagination_test extends phpbb_template_template_test_case { + protected $config; + protected $helper; + protected $routing_helper; + protected $pagination; protected $test_path = 'tests/pagination'; public function return_callback_implode() @@ -82,7 +86,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher); } - public function generate_template_pagination_data() + public static function generate_template_pagination_data() { return array( array( @@ -229,7 +233,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); } - public function on_page_data() + public static function on_page_data() { return array( array( @@ -255,7 +259,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals($expect_return, $this->pagination->on_page($num_items, $per_page, $start_item)); } - public function validate_start_data() + public static function validate_start_data() { return array( array( @@ -304,7 +308,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals($expect, $this->pagination->validate_start($start, 10, $num_items)); } - public function reverse_start_data() + public static function reverse_start_data() { return array( array( @@ -330,7 +334,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals($expect, $this->pagination->reverse_start($start, $limit, $num_items)); } - public function reverse_limit_data() + public static function reverse_limit_data() { return array( array( diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php index 51da57c278..d690979a8d 100644 --- a/tests/passwords/drivers_test.php +++ b/tests/passwords/drivers_test.php @@ -11,11 +11,22 @@ * */ -class phpbb_passwords_helper_test extends \phpbb_test_case +class phpbb_passwords_drivers_test extends \phpbb_test_case { + /** @var \phpbb\passwords\driver\helper */ + protected $driver_helper = []; + /** @var array */ protected $passwords_drivers = []; + // Initialize argon2 default options + public static $argon2_default_cost_options = + [ + 'memory_cost' => 65536, + 'time_cost' => 4, + 'threads' => 2 + ]; + protected function setUp(): void { // Prepare dependencies for drivers @@ -25,13 +36,6 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $php_ext = 'php'; - // Initialize argon2 default options - $this->argon2_default_cost_options = [ - 'memory_cost' => 65536, - 'time_cost' => 4, - 'threads' => 2 - ]; - $this->passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper, 10), 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper, 10), @@ -52,17 +56,17 @@ class phpbb_passwords_helper_test extends \phpbb_test_case if (defined('PASSWORD_ARGON2I') && $pwhash_supported) { $this->passwords_drivers['passwords.driver.argon2i'] = new \phpbb\passwords\driver\argon2i($config, $this->driver_helper); - $this->argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2i']->get_options(); + self::$argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2i']->get_options(); } if (defined('PASSWORD_ARGON2ID') && $pwhash_supported) { $this->passwords_drivers['passwords.driver.argon2id'] = new \phpbb\passwords\driver\argon2id($config, $this->driver_helper); - $this->argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2id']->get_options(); + self::$argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2id']->get_options(); } } - public function data_helper_encode64() + public static function data_helper_encode64() { return array( array('foobars', 6, 'axqPW3aQ'), @@ -80,7 +84,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame($output, $return); } - public function data_get_random_salt() + public static function data_get_random_salt() { return array( array(24, false), @@ -118,7 +122,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertEquals(false, $this->passwords_drivers['passwords.driver.salted_md5']->get_hash_settings(false)); } - public function data_hash_sha1_smf() + public static function data_hash_sha1_smf() { return array( array(false, 'test', array()), @@ -135,7 +139,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame($expected, $this->passwords_drivers['passwords.driver.sha1_smf']->hash($password, $user_row)); } - public function data_get_settings() + public static function data_get_settings() { return array( array(false, '6f9e2a1899e1f15708fd2e554103480eb53e8b57', 'passwords.driver.sha1_smf'), @@ -150,7 +154,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame($expected, $this->passwords_drivers[$driver]->get_settings_only($hash)); } - public function data_md5_phpbb2_check() + public static function data_md5_phpbb2_check() { return array( array(false, 'foobar', 'ae2fc75e20ee25d4520766788fbc96ae'), @@ -158,8 +162,8 @@ class phpbb_passwords_helper_test extends \phpbb_test_case array(false, 'fööbar', 'ae2fc75e20ee25d4520766788fbc96ae'), array(true, 'fööbar', 'ae2fc75e20ee25d4520766788fbc96ae', utf8_decode('fööbar')), array(true, 'fööbar', '$H$966CepJh9RC3hFIm7aKywR6jEn0kpA0', utf8_decode('fööbar')), - array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', $this->utf8_to_cp1252(utf8_decode('fööbar'))), - array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', $this->utf8_to_cp1252('fööbar')), + array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', self::utf8_to_cp1252(utf8_decode('fööbar'))), + array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', self::utf8_to_cp1252('fööbar')), ); } @@ -194,7 +198,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1']->hash('foobar')); } - public function data_md5_mybb_check() + public static function data_md5_mybb_check() { return array( array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), @@ -216,7 +220,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_mybb']->hash('foobar')); } - public function data_md5_vb_check() + public static function data_md5_vb_check() { return array( array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), @@ -240,7 +244,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_vb']->hash('foobar')); } - public function data_sha1_wcf1_check() + public static function data_sha1_wcf1_check() { return array( array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), @@ -262,7 +266,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1_wcf1']->hash('foobar')); } - public function data_bcrypt_wcf2_check() + public static function data_bcrypt_wcf2_check() { return array( array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), @@ -284,7 +288,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.bcrypt_wcf2']->hash('foobar')); } - public function data_sha_xf1_check() + public static function data_sha_xf1_check() { return array( array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), @@ -307,7 +311,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha_xf1']->hash('foobar')); } - protected function utf8_to_cp1252($string) + protected static function utf8_to_cp1252($string) { static $transform = array( "\xE2\x82\xAC" => "\x80", @@ -437,36 +441,24 @@ class phpbb_passwords_helper_test extends \phpbb_test_case return strtr($string, $transform); } - public function data_needs_rehash() + public static function data_needs_rehash() { - $data_array = [ + return [ array('passwords.driver.bcrypt_2y', '$2y$10$somerandomhash', false), array('passwords.driver.bcrypt', '$2a$10$somerandomhash', false), array('passwords.driver.salted_md5', 'foobar', false), array('passwords.driver.bcrypt_2y', '$2y$9$somerandomhash', true), array('passwords.driver.bcrypt', '$2a$04$somerandomhash', true), + + array('passwords.driver.argon2i', '$argon2i$v=19$m=' . self::$argon2_default_cost_options['memory_cost'] . ',t=' . self::$argon2_default_cost_options['time_cost'] . ',p=' . self::$argon2_default_cost_options['threads'] . '$NEF0S1JSN04yNGQ1UVRKdA$KYGNI9CbjoKh1UEu1PpdlqbuLbveGwkMcwcT2Un9pPM', false), + array('passwords.driver.argon2i', '$argon2i$v=19$m=128,t=2,p=2$M29GUi51QjdKLjIzbC9scQ$6h1gZDqn7JTmVdQ0lJh1x5nyvgO/DaJWUKOFJ0itCJ0', true), + array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=1,p=2$UnFHb2F4NER3M0xWWmxMUQ$u3javvoAZJeIyR1P3eg0tb8VjEeXvQPagqwetonq1NA', true), + array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=1$bm5SeGJ3R3ZRY1A0YXJPNg$v1A9m4sJW+ge0RBtpJ4w9861+J9xkguKBAsZHrG8LQU', true), + + array('passwords.driver.argon2id', '$argon2id$v=19$m=' . self::$argon2_default_cost_options['memory_cost'] . ',t=' . self::$argon2_default_cost_options['time_cost'] . ',p=' . self::$argon2_default_cost_options['threads'] . '$MXB4OW5sczE5TnFPYkEuYQ$2bxaMIp8+9x37O6v8zkqpBU72ohCibUrtgVZw7vyr5Q', false), + array('passwords.driver.argon2id', '$argon2id$v=19$m=128,t=2,p=2$RWV2VFAuWXk5bTVjbktOLg$Nt7Z7koa25SVRSKr3RKqjwKz26FENDuU+aL1DfMcWRo', true), + array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=1,p=2$Rmw5M21IUFZDVEltYU0uTA$GIObGbHV6sOw5OQEtF8z+2ESztT96OWhCk17sUlwLAY', true), ]; - - if (isset($this->passwords_drivers['passwords.driver.argon2i'])) - { - $data_array = array_merge($data_array, [ - array('passwords.driver.argon2i', '$argon2i$v=19$m=' . $this->argon2_default_cost_options['memory_cost'] . ',t=' . $this->argon2_default_cost_options['time_cost'] . ',p=' . $this->argon2_default_cost_options['threads'] . '$NEF0S1JSN04yNGQ1UVRKdA$KYGNI9CbjoKh1UEu1PpdlqbuLbveGwkMcwcT2Un9pPM', false), - array('passwords.driver.argon2i', '$argon2i$v=19$m=128,t=2,p=2$M29GUi51QjdKLjIzbC9scQ$6h1gZDqn7JTmVdQ0lJh1x5nyvgO/DaJWUKOFJ0itCJ0', true), - array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=1,p=2$UnFHb2F4NER3M0xWWmxMUQ$u3javvoAZJeIyR1P3eg0tb8VjEeXvQPagqwetonq1NA', true), - array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=1$bm5SeGJ3R3ZRY1A0YXJPNg$v1A9m4sJW+ge0RBtpJ4w9861+J9xkguKBAsZHrG8LQU', true), - ]); - } - - if (isset($this->passwords_drivers['passwords.driver.argon2id'])) - { - $data_array = array_merge($data_array, [ - array('passwords.driver.argon2id', '$argon2id$v=19$m=' . $this->argon2_default_cost_options['memory_cost'] . ',t=' . $this->argon2_default_cost_options['time_cost'] . ',p=' . $this->argon2_default_cost_options['threads'] . '$MXB4OW5sczE5TnFPYkEuYQ$2bxaMIp8+9x37O6v8zkqpBU72ohCibUrtgVZw7vyr5Q', false), - array('passwords.driver.argon2id', '$argon2id$v=19$m=128,t=2,p=2$RWV2VFAuWXk5bTVjbktOLg$Nt7Z7koa25SVRSKr3RKqjwKz26FENDuU+aL1DfMcWRo', true), - array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=1,p=2$Rmw5M21IUFZDVEltYU0uTA$GIObGbHV6sOw5OQEtF8z+2ESztT96OWhCk17sUlwLAY', true), - ]); - } - - return $data_array; } /** @@ -474,7 +466,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case */ public function test_needs_rehash($driver, $hash, $expected) { - if (!$this->passwords_drivers[$driver]->is_supported()) + if (!isset($this->passwords_drivers[$driver]) || !$this->passwords_drivers[$driver]->is_supported()) { $this->markTestSkipped($driver . ' is not supported'); } diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 7b1b9a1cc3..273683a097 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -58,7 +58,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->manager = new \phpbb\passwords\manager($config, $this->passwords_drivers, $this->helper, array_keys($this->passwords_drivers)); } - public function hash_password_data() + public static function hash_password_data() { return array( array('', '2y', 60), @@ -94,7 +94,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case } } - public function check_password_data() + public static function check_password_data() { return array( array('passwords.driver.bcrypt_2y'), @@ -126,7 +126,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case } - public function check_hash_exceptions_data() + public static function check_hash_exceptions_data() { return array( array('3858f62230ac3c915f300c664312c63f', true), @@ -164,7 +164,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertEquals($expected, $this->manager->check($password, $hash, $user_row)); } - public function data_hash_password_length() + public static function data_hash_password_length() { return array( array('passwords.driver.bcrypt', false), @@ -188,7 +188,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertNotEquals(false, $this->manager->hash('foobar𝄞', 'passwords.driver.bcrypt_2y')); } - public function combined_hash_data() + public static function combined_hash_data() { return array( array( @@ -276,7 +276,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertLessThanOrEqual(5, time() - $start_time); } - public function data_test_string_compare() + public static function data_test_string_compare() { return array( array('foo', 'bar', false), @@ -294,7 +294,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertSame($expected, $this->driver_helper->string_compare($a, $b)); } - public function data_driver_interface_driver() + public static function data_driver_interface_driver() { return array( array(false, false, false), diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 5c41b33b97..09693c1ceb 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -17,20 +17,20 @@ class phpbb_path_helper_test extends phpbb_test_case { /** @var \phpbb\path_helper */ protected $path_helper; - protected $phpbb_root_path = ''; + protected static $phpbb_root_path = ''; protected function setUp(): void { parent::setUp(); - $this->set_phpbb_root_path(); + self::set_phpbb_root_path(); $this->path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ); @@ -44,17 +44,17 @@ class phpbb_path_helper_test extends phpbb_test_case * any time we wish to use it in one of these functions (and * also in general for everything else) */ - public function set_phpbb_root_path() + public static function set_phpbb_root_path() { - $this->phpbb_root_path = filesystem_helper::clean_path(__DIR__ . '/../../phpBB/'); + self::$phpbb_root_path = filesystem_helper::clean_path(__DIR__ . '/../../phpBB/'); } public function test_get_web_root_path() { - $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); + $this->assertEquals(self::$phpbb_root_path, $this->path_helper->get_web_root_path()); // Second call will use class property - $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); + $this->assertEquals(self::$phpbb_root_path, $this->path_helper->get_web_root_path()); } public function test_get_adm_relative_path() @@ -67,9 +67,9 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertSame('php', $this->path_helper->get_php_ext()); } - public function basic_update_web_root_path_data() + public static function basic_update_web_root_path_data() { - $this->set_phpbb_root_path(); + self::set_phpbb_root_path(); return [ [ @@ -78,16 +78,16 @@ class phpbb_path_helper_test extends phpbb_test_case '/', ], [ - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', ], [ 'test.php', 'test.php', ], [ - $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - filesystem_helper::clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), + self::$phpbb_root_path . self::$phpbb_root_path . 'test.php', + filesystem_helper::clean_path(self::$phpbb_root_path . self::$phpbb_root_path . 'test.php'), ], ]; } @@ -108,52 +108,52 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ]) - ->setMethods(['get_web_root_path']) + ->onlyMethods(['get_web_root_path']) ->getMock(); $path_helper->method('get_web_root_path') ->willReturn('/var/www/phpbb/app.php/'); - $this->assertEquals('/var/www/phpbb/app.php/foo', $path_helper->update_web_root_path($this->phpbb_root_path . 'app.php/foo')); + $this->assertEquals('/var/www/phpbb/app.php/foo', $path_helper->update_web_root_path(self::$phpbb_root_path . 'app.php/foo')); } - public function update_web_root_path_data() + public static function update_web_root_path_data() { - $this->set_phpbb_root_path(); + self::set_phpbb_root_path(); return array( array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/', '', '', '', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '//', 'foo/bar.php', 'bar.php', './../', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/app.php/foo/template', '/phpbb-fork/phpBB/app.php', './../../', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/foo/template', '/phpbb-fork/phpBB/app.php', './../', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/', '/phpbb-fork/phpBB/app.php/', '/phpbb-fork/phpBB/app.php', @@ -162,35 +162,35 @@ class phpbb_path_helper_test extends phpbb_test_case // No correction if the path is already prepend by the web root path array( - './../' . $this->phpbb_root_path . 'test.php', + './../' . self::$phpbb_root_path . 'test.php', '//', 'foo/bar.php', 'bar.php', '', ), array( - './../../' . $this->phpbb_root_path . 'test.php', + './../../' . self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/app.php/foo/template', '/phpbb-fork/phpBB/app.php', '', ), array( - './../' . $this->phpbb_root_path . 'test.php', + './../' . self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/foo/template', '/phpbb-fork/phpBB/app.php', '', ), array( - './../'.$this->phpbb_root_path . 'test.php', + './../'.self::$phpbb_root_path . 'test.php', '/', '/phpbb-fork/phpBB/app.php/', '/phpbb-fork/phpBB/app.php', '', ), array( - './../'.$this->phpbb_root_path . 'test.php', + './../'.self::$phpbb_root_path . 'test.php', '', '/phpbb-fork/phpBB/foo', '/phpbb-fork/phpBB/app.php', @@ -218,17 +218,16 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php' ); $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input)); } - public function remove_web_root_path_data() + public static function remove_web_root_path_data() { - $filesystem = new \phpbb\filesystem\filesystem(); - $this->set_phpbb_root_path($filesystem); + self::set_phpbb_root_path(); return [ [ @@ -237,7 +236,7 @@ class phpbb_path_helper_test extends phpbb_test_case ], [ '/var/www/phpbb/test.php', - $this->phpbb_root_path . 'test.php' + self::$phpbb_root_path . 'test.php' ] ]; } @@ -253,11 +252,11 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ]) - ->setMethods(['get_web_root_path']) + ->onlyMethods(['get_web_root_path']) ->getMock(); $path_helper->method('get_web_root_path') ->willReturn('/var/www/phpbb/'); @@ -265,7 +264,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $path_helper->remove_web_root_path($input)); } - public function clean_url_data() + public static function clean_url_data() { return array( array('', ''), @@ -288,7 +287,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->clean_url($input)); } - public function glue_url_params_data() + public static function glue_url_params_data() { return array( array( @@ -326,7 +325,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->glue_url_params($params)); } - public function get_url_parts_data() + public static function get_url_parts_data() { return array( array( @@ -390,7 +389,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->get_url_parts($url, $is_amp)); } - public function strip_url_params_data() + public static function strip_url_params_data() { return array( array( @@ -428,7 +427,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->strip_url_params($url, $strip, $is_amp)); } - public function append_url_params_data() + public static function append_url_params_data() { return array( array( @@ -462,7 +461,7 @@ class phpbb_path_helper_test extends phpbb_test_case { $symfony_request = $this->getMockBuilder('\phpbb\symfony_request') ->setConstructorArgs([new phpbb_mock_request()]) - ->setMethods(['get', 'getSchemeAndHttpHost', 'getBasePath', 'getPathInfo']) + ->onlyMethods(['get', 'getSchemeAndHttpHost', 'getBasePath', 'getPathInfo']) ->getMock(); $symfony_request->method('getSchemeAndHttpHost') ->willReturn('http://www.phpbb.com'); @@ -484,12 +483,12 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, $request, - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ); - $this->assertEquals($this->phpbb_root_path . '../../', $path_helper->get_web_root_path()); + $this->assertEquals(self::$phpbb_root_path . '../../', $path_helper->get_web_root_path()); } /** @@ -500,7 +499,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->append_url_params($url, $params, $is_amp)); } - public function get_web_root_path_from_ajax_referer_data() + public static function get_web_root_path_from_ajax_referer_data() { return [ [ @@ -581,10 +580,10 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_get_web_root_path_from_ajax_referer($referer_url, $board_url, $expected) { - $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url)); + $this->assertEquals(self::$phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url)); } - public function data_get_valid_page() + public static function data_get_valid_page() { return array( // array( current page , mod_rewrite setting , expected output ) @@ -606,10 +605,10 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_get_valid_page($page, $mod_rewrite, $expected) { - $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_valid_page($page, $mod_rewrite)); + $this->assertEquals(self::$phpbb_root_path . $expected, $this->path_helper->get_valid_page($page, $mod_rewrite)); } - public function is_router_used_data() + public static function is_router_used_data() { return [ [ @@ -630,7 +629,7 @@ class phpbb_path_helper_test extends phpbb_test_case { $symfony_request = $this->getMockBuilder('\phpbb\symfony_request') ->setConstructorArgs([new phpbb_mock_request()]) - ->setMethods(['getScriptName']) + ->onlyMethods(['getScriptName']) ->getMock(); $symfony_request->method('getScriptName') ->willReturn($script_name); @@ -638,7 +637,7 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ); diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php index 206029d8b8..4d020bbdbf 100644 --- a/tests/plupload/plupload_test.php +++ b/tests/plupload/plupload_test.php @@ -13,7 +13,7 @@ class phpbb_plupload_test extends phpbb_test_case { - public function generate_resize_string_data() + public static function generate_resize_string_data() { return array( array( @@ -61,7 +61,7 @@ class phpbb_plupload_test extends phpbb_test_case $this->assertEquals($expected, $plupload->generate_resize_string()); } - public function data_get_chunk_size() + public static function data_get_chunk_size() { return [ [[ @@ -113,7 +113,7 @@ class phpbb_plupload_test extends phpbb_test_case $config = new \phpbb\config\config([]); $ini_wrapper = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper') - ->setMethods(['getBytes']) + ->onlyMethods(['getBytes']) ->getMock(); $ini_wrapper->method('getBytes') ->will($this->returnValueMap([ diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php index cfdec04eda..49bc45805a 100644 --- a/tests/profilefields/type_bool_test.php +++ b/tests/profilefields/type_bool_test.php @@ -33,12 +33,12 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case ->will($this->returnCallback(array($this, 'return_callback_implode'))); $lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper') - ->setMethods(array('get_options_lang', 'is_set', 'get')) + ->onlyMethods(array('load_option_lang', 'is_set', 'get')) ->setConstructorArgs(array($db, LANG_TABLE)) ->getMock(); $lang->expects($this->any()) - ->method('get_options_lang'); + ->method('load_option_lang'); $lang->expects($this->any()) ->method('is_set') @@ -77,7 +77,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -101,7 +101,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -137,7 +137,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index 480b03baf0..679ce99256 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -34,10 +34,11 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case ->will($this->returnCallback(array($this, 'create_datetime_callback'))); $this->user->timezone = new DateTimeZone('UTC'); - $this->user->lang = array( - 'datetime' => array(), - 'DATE_FORMAT' => 'm/d/Y', - ); + $this->user->expects($this->any()) + ->method('__get')->with('lang')->willReturn([ + 'datetime' => [], + 'DATE_FORMAT' => 'm/d/Y', + ]); $request = $this->createMock('\phpbb\request\request'); $template = $this->createMock('\phpbb\template\template'); @@ -60,7 +61,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case ); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -96,7 +97,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -180,7 +181,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php index 8919fbb6a4..17e1a7b3f9 100644 --- a/tests/profilefields/type_dropdown_test.php +++ b/tests/profilefields/type_dropdown_test.php @@ -35,12 +35,12 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case $template = $this->createMock('\phpbb\template\template'); $lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper') - ->setMethods(array('get_options_lang', 'is_set', 'get')) + ->onlyMethods(array('load_option_lang', 'is_set', 'get')) ->setConstructorArgs(array($db, LANG_TABLE)) ->getMock(); $lang->expects($this->any()) - ->method('get_options_lang'); + ->method('load_option_lang'); $lang->expects($this->any()) ->method('is_set') @@ -78,7 +78,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -132,7 +132,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -175,7 +175,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php index a4161ce412..1fb512e1a6 100644 --- a/tests/profilefields/type_int_test.php +++ b/tests/profilefields/type_int_test.php @@ -51,7 +51,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case ); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -118,7 +118,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -172,7 +172,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index a813cc248b..351495069d 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -56,7 +56,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -243,7 +243,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -298,7 +298,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index 7a604ebbd4..177b3efbb1 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -59,7 +59,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -152,7 +152,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( @@ -184,7 +184,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ); } - public function profile_value_data() + public static function profile_value_data() { return array( array( diff --git a/tests/regex/censor_test.php b/tests/regex/censor_test.php index 6da6083e19..8b1410ac7f 100644 --- a/tests/regex/censor_test.php +++ b/tests/regex/censor_test.php @@ -13,7 +13,7 @@ class phpbb_regex_censor_test extends phpbb_test_case { - public function censor_test_data() + public static function censor_test_data() { return array( array('bad*word', 'bad word'), diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php index b281941c49..ccb98558dc 100644 --- a/tests/regex/email_test.php +++ b/tests/regex/email_test.php @@ -20,7 +20,7 @@ class phpbb_regex_email_test extends phpbb_test_case $this->regex = '#^' . get_preg_expression('email') . '$#i'; } - public function positive_match_data() + public static function positive_match_data() { return array( array('nobody@phpbb.com'), @@ -60,7 +60,7 @@ class phpbb_regex_email_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( array('foo.example.com'), // @ is missing diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php index 1bd8948b87..954f24bbcd 100644 --- a/tests/regex/ipv4_test.php +++ b/tests/regex/ipv4_test.php @@ -20,7 +20,7 @@ class phpbb_regex_ipv4_test extends phpbb_test_case $this->regex = get_preg_expression('ipv4'); } - public function positive_match_data() + public static function positive_match_data() { return array( array('0.0.0.0'), @@ -30,7 +30,7 @@ class phpbb_regex_ipv4_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( // IPv6 addresses diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php index 92e74a0220..720161ee8c 100644 --- a/tests/regex/ipv6_test.php +++ b/tests/regex/ipv6_test.php @@ -20,7 +20,7 @@ class phpbb_regex_ipv6_test extends phpbb_test_case $this->regex = get_preg_expression('ipv6'); } - public function positive_match_data() + public static function positive_match_data() { return array( // Full length IPv6 address @@ -97,7 +97,7 @@ class phpbb_regex_ipv6_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( // Empty address diff --git a/tests/regex/password_complexity_test.php b/tests/regex/password_complexity_test.php index 37f3a0c53a..2ee325e40d 100644 --- a/tests/regex/password_complexity_test.php +++ b/tests/regex/password_complexity_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_user.php'; class phpbb_password_complexity_test extends phpbb_test_case { - public function password_complexity_test_data_positive() + public static function password_complexity_test_data_positive() { return array( array('12345', 'PASS_TYPE_ANY'), @@ -33,7 +33,7 @@ class phpbb_password_complexity_test extends phpbb_test_case ); } - public function password_complexity_test_data_negative() + public static function password_complexity_test_data_negative() { return array( array('qwerty', 'PASS_TYPE_CASE'), diff --git a/tests/regex/table_prefix_test.php b/tests/regex/table_prefix_test.php index f425041c94..0fad1d0e1c 100644 --- a/tests/regex/table_prefix_test.php +++ b/tests/regex/table_prefix_test.php @@ -13,7 +13,7 @@ class phpbb_regex_table_prefix_test extends phpbb_test_case { - public function table_prefix_test_data() + public static function table_prefix_test_data() { return array( array('phpbb_', 1), diff --git a/tests/regex/url_test.php b/tests/regex/url_test.php index 5e2a22bf73..5e39a7ba36 100644 --- a/tests/regex/url_test.php +++ b/tests/regex/url_test.php @@ -13,7 +13,7 @@ class phpbb_regex_url_test extends phpbb_test_case { - public function url_test_data() + public static function url_test_data() { return array( array('http://www.phpbb.com/community/', 1), diff --git a/tests/request/request_test.php b/tests/request/request_test.php index d03253ceb9..3744d9b38e 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -146,7 +146,7 @@ class phpbb_request_test extends phpbb_test_case $this->assertTrue($this->request->is_ajax()); } - public function data_is_secure() + public static function data_is_secure() { return array( array( diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index ea1a1ac89e..253b7abb73 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -108,7 +108,7 @@ class phpbb_request_var_test extends phpbb_test_case $this->assertEquals($expected, $result); } - public function deep_access() + public static function deep_access() { return array( // array(path, default, expected result) @@ -119,7 +119,7 @@ class phpbb_request_var_test extends phpbb_test_case ); } - public function request_variables() + public static function request_variables() { return array( // strings diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php index 745008ec3a..87989646eb 100644 --- a/tests/request/type_cast_helper_test.php +++ b/tests/request/type_cast_helper_test.php @@ -20,7 +20,7 @@ class phpbb_type_cast_helper_test extends phpbb_test_case $this->type_cast_helper = new \phpbb\request\type_cast_helper(); } - public function type_cast_helper_test_data() + public static function type_cast_helper_test_data() { return [ [ diff --git a/tests/search/common_test_case.php b/tests/search/common_test_case.php index fc4b461452..f797d414f9 100644 --- a/tests/search/common_test_case.php +++ b/tests/search/common_test_case.php @@ -17,7 +17,7 @@ abstract class phpbb_search_common_test_case extends phpbb_search_test_case { protected $search; - public function keywords() + public static function keywords() { return array( // keywords diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php index fe7326bb3e..981d04d11c 100644 --- a/tests/search/mysql_test.php +++ b/tests/search/mysql_test.php @@ -34,8 +34,10 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case $user = $this->createMock('\phpbb\user'); // set config values - $config['fulltext_mysql_min_word_len'] = 4; - $config['fulltext_mysql_max_word_len'] = 254; + $config = new \phpbb\config\config([ + 'fulltext_mysql_min_word_len' => 4, + 'fulltext_mysql_max_word_len' => 254, + ]); $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); diff --git a/tests/search/native_test.php b/tests/search/native_test.php index 0d8d8e6810..8f74d23e6d 100644 --- a/tests/search/native_test.php +++ b/tests/search/native_test.php @@ -17,6 +17,7 @@ class phpbb_search_native_test extends phpbb_search_test_case { protected $db; protected $db_tools; + protected $search; public function getDataSet() { @@ -43,13 +44,15 @@ class phpbb_search_native_test extends phpbb_search_test_case $this->db_tools = $tools_factory->get($this->new_doctrine_dbal()); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native'); - $config['fulltext_native_min_chars'] = 2; - $config['fulltext_native_max_chars'] = 14; - $config['max_num_search_keywords'] = 10; + $config = new \phpbb\config\config([ + 'fulltext_native_min_chars' => 2, + 'fulltext_native_max_chars' => 14, + 'max_num_search_keywords' => 10, + ]); $this->search = new $class($config, $this->db, $this->db_tools, $phpbb_dispatcher, $language, $user, SEARCH_RESULTS_TABLE, SEARCH_WORDLIST_TABLE, SEARCH_WORDMATCH_TABLE, $phpbb_root_path, $phpEx); } - public function keywords() + public static function keywords() { return array( // keywords @@ -268,7 +271,7 @@ class phpbb_search_native_test extends phpbb_search_test_case $this->assert_array_content_equals($common, $this->search->get_common_words()); } - public function data_split_keywords_max(): array + public static function data_split_keywords_max(): array { return [ 'character count within limits separated by more spaces' => [ diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php index 18c5a46f81..3a699eda2c 100644 --- a/tests/search/postgres_test.php +++ b/tests/search/postgres_test.php @@ -34,8 +34,10 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case $user = $this->createMock('\phpbb\user'); // set config values - $config['fulltext_postgres_min_word_len'] = 4; - $config['fulltext_postgres_max_word_len'] = 254; + $config = new \phpbb\config\config([ + 'fulltext_postgres_min_word_len' => 4, + 'fulltext_postgres_max_word_len' => 254, + ]); $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index 0446673c60..f308468ce3 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/base.php'; class phpbb_security_extract_current_page_test extends phpbb_security_test_base { - public function security_variables() + public static function security_variables() { return array( array('mark=forums&x=">', 'mark=forums&x=%22%3E%3Cscript%3Ealert%28%2FXSS%2F%29%3B%3C%2Fscript%3E'), diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 74c5c2e03e..8568832600 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -18,7 +18,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base { protected $path_helper; - public function provider() + public static function provider() { // array(Input -> redirect(), expected triggered error (else false), expected returned result url (else false)) return array( diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index 4e5a238644..4bd5dbdbdd 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -14,7 +14,7 @@ class phpbb_session_append_sid_test extends phpbb_test_case { - public function append_sid_data() + public static function append_sid_data() { return array( array('viewtopic.php?t=1&f=2', false, true, false, 'viewtopic.php?t=1&f=2', 'parameters in url-argument'), diff --git a/tests/session/session_key_test.php b/tests/session/session_login_keys_test.php similarity index 100% rename from tests/session/session_key_test.php rename to tests/session/session_login_keys_test.php diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index 36e9fe6d3f..a73a9eaf3d 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -31,6 +31,7 @@ class phpbb_session_testable_factory protected $config; protected $cache; protected $request; + protected $server_data; /** * Initialises the factory with a set of default config and cache values. diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php index 8467732bda..87000a0872 100644 --- a/tests/template/asset_test.php +++ b/tests/template/asset_test.php @@ -15,7 +15,7 @@ use phpbb\template\asset; class phpbb_template_asset_test extends phpbb_test_case { - public function set_path_data() + public static function set_path_data() { return array( // array(phpbb_root_path, given path, expected path), @@ -35,7 +35,7 @@ class phpbb_template_asset_test extends phpbb_test_case { $path_helper = $this->getMockBuilder('\phpbb\path_helper') ->disableOriginalConstructor() - ->setMethods(array()) + ->onlyMethods(['get_phpbb_root_path']) ->getMock(); $path_helper->method('get_phpbb_root_path') diff --git a/tests/template/context_test.php b/tests/template/context_test.php index a1be672f51..0f88b66a45 100644 --- a/tests/template/context_test.php +++ b/tests/template/context_test.php @@ -43,7 +43,7 @@ class context_test extends phpbb_test_case } } - public function retrieve_block_vars_data() + public static function retrieve_block_vars_data() { return array( array('foo', array(), array()), // non-existent top-level block diff --git a/tests/template/extension_test.php b/tests/template/extension_test.php index 085caae330..323c605fb9 100644 --- a/tests/template/extension_test.php +++ b/tests/template/extension_test.php @@ -38,7 +38,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case $user->data['user_id'] = 2; $auth = $this->getMockBuilder('phpbb\auth\auth') ->disableOriginalConstructor() - ->setMethods(['acl_get']) + ->onlyMethods(['acl_get']) ->getMock(); $auth->method('acl_get') ->willReturn(true); @@ -142,7 +142,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case ]); } - public function data_template_extensions() + public static function data_template_extensions() { return [ [ @@ -333,7 +333,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case $this->run_template($file, $vars, $block_vars, $destroy_array, $expected, $lang_vars); } - public function data_template_icon_extension() + public static function data_template_icon_extension() { return [ /** Font: default */ diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php index a495f8aff8..6b76e97ae4 100644 --- a/tests/template/template_allfolder_test.php +++ b/tests/template/template_allfolder_test.php @@ -15,6 +15,9 @@ require_once __DIR__ . '/template_test_case.php'; class phpbb_template_allfolder_test extends phpbb_template_template_test_case { + protected $extension_manager; + protected $ext_template_path; + public function test_allfolder() { $this->setup_engine_for_allfolder(); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index a9b1d39451..701c7f99ee 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -15,7 +15,9 @@ require_once __DIR__ . '/template_test_case.php'; class phpbb_template_template_events_test extends phpbb_template_template_test_case { - public function template_data() + protected $extension_manager; + + public static function template_data() { return array( /* diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index f31bcace3c..209d8c5c38 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -85,7 +85,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } - public function template_data() + public static function template_data() { return array( /* diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 9886ced6ad..6345818712 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -15,10 +15,8 @@ require_once __DIR__ . '/template_test_case_with_tree.php'; class phpbb_template_template_includejs_test extends phpbb_template_template_test_case_with_tree { - public function template_data() + public static function template_data() { - $this->setup_engine(); - return array( /* array( diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index 51cc155c9e..5a536a72e6 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -18,7 +18,7 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t /** * @todo put test data into templates/xyz.test */ - public function template_data() + public static function template_data() { return array( // First element of the array is test name - keep them distinct diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 4fc9858366..bb4fa6ad6a 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -18,7 +18,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case /** * @todo put test data into templates/xyz.test */ - public function template_data() + public static function template_data() { return array( /* @@ -637,7 +637,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->assertEquals(array('POSITION' => 'O3M2', 'ONE' => true, 'TWO' => 'two', 'THREE' => 3), $this->template->retrieve_block_vars('outer[2].middle[1]', array()), 'Retrieve all vars from a block in the template'); } - public function alter_block_array_data() + public static function alter_block_array_data() { return array( array( @@ -1030,7 +1030,7 @@ EOT $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Inserting another inner block in the same place'); } - public function assign_block_vars_array_data() + public static function assign_block_vars_array_data() { return array( array( diff --git a/tests/template/twig_test.php b/tests/template/twig_test.php index 69280caa15..f655cd8702 100644 --- a/tests/template/twig_test.php +++ b/tests/template/twig_test.php @@ -100,7 +100,7 @@ class twig_test extends \phpbb_test_case $run_set_user_closure($this->user); } - public function data_get_user_style(): array + public static function data_get_user_style(): array { return [ [['style_path' => 'prosilver', 'style_parent_id' => 0], ['prosilver']], diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 76e77add44..6da764adfb 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -34,25 +34,6 @@ abstract class phpbb_database_test_case extends TestCase */ private $db_connections_doctrine; - public function __construct($name = NULL, array $data = [], $dataName = '') - { - parent::__construct($name, $data, $dataName); - - $this->backupStaticAttributesExcludeList += [ - 'SebastianBergmann\CodeCoverage\CodeCoverage' => ['instance'], - 'SebastianBergmann\CodeCoverage\Filter' => ['instance'], - 'SebastianBergmann\CodeCoverage\Util' => ['ignoredLines', 'templateMethods'], - 'SebastianBergmann\Timer\Timer' => ['startTimes'], - 'PHP_Token_Stream' => ['customTokens'], - 'PHP_Token_Stream_CachingFactory' => ['cache'], - - 'phpbb_database_test_case' => ['already_connected'], - ]; - - $this->db_connections = []; - $this->db_connections_doctrine = []; - } - /** * @return array List of extensions that should be set up */ @@ -135,6 +116,20 @@ abstract class phpbb_database_test_case extends TestCase { parent::setUp(); + $this->setBackupStaticPropertiesExcludeList([ + 'SebastianBergmann\CodeCoverage\CodeCoverage' => ['instance'], + 'SebastianBergmann\CodeCoverage\Filter' => ['instance'], + 'SebastianBergmann\CodeCoverage\Util' => ['ignoredLines', 'templateMethods'], + 'SebastianBergmann\Timer\Timer' => ['startTimes'], + 'PHP_Token_Stream' => ['customTokens'], + 'PHP_Token_Stream_CachingFactory' => ['cache'], + + 'phpbb_database_test_case' => ['already_connected'], + ]); + + $this->db_connections = []; + $this->db_connections_doctrine = []; + // Resynchronise tables if a fixture was loaded if (isset($this->fixture_xml_data)) { diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index ebe7c15f81..9e7e0e4679 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -87,6 +87,10 @@ class phpbb_functional_test_case extends phpbb_test_case { parent::setUp(); + $this->setBackupStaticPropertiesExcludeList([ + 'phpbb_functional_test_case' => ['config', 'already_installed'], + ]); + if (!self::$install_success) { $this->fail('Installing phpBB has failed.'); @@ -97,6 +101,9 @@ class phpbb_functional_test_case extends phpbb_test_case self::$cookieJar = new CookieJar; // Force native client on windows platform self::$http_client = strtolower(substr(PHP_OS, 0, 3)) === 'win' ? new NativeHttpClient() : HttpClient::create(); + self::$http_client->withOptions([ + 'timeout' => 60, + ]); self::$client = new HttpBrowser(self::$http_client, null, self::$cookieJar); // Clear the language array so that things @@ -216,15 +223,6 @@ class phpbb_functional_test_case extends phpbb_test_case { } - public function __construct($name = NULL, array $data = [], $dataName = '') - { - parent::__construct($name, $data, $dataName); - - $this->backupStaticAttributesExcludeList += [ - 'phpbb_functional_test_case' => ['config', 'already_installed'], - ]; - } - /** * @return \phpbb\db\driver\driver_interface */ @@ -307,7 +305,7 @@ class phpbb_functional_test_case extends phpbb_test_case $container->set('event_dispatcher', $phpbb_dispatcher); $cache = $this->getMockBuilder('\phpbb\cache\service') ->setConstructorArgs([$this->get_cache_driver(), $config, $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx]) - ->setMethods(['deferred_purge']) + ->onlyMethods(['deferred_purge']) ->getMock(); $cache->method('deferred_purge') ->willReturnCallback([$cache, 'purge']); @@ -550,7 +548,15 @@ class phpbb_functional_test_case extends phpbb_test_case $iohandler->set_input('script_path', $parseURL['path']); $iohandler->set_input('submit_server', 'submit'); - $installer->run(); + try + { + $installer->run(); + } + catch (\Throwable $e) + { + // Do nothing but catch the exception as PHPUnit here throws + // "PHPUnit\Event\Code\NoTestCaseObjectOnCallStackException: Cannot find TestCase object on call stack" + } copy($config_file, $config_file_test); @@ -568,7 +574,10 @@ class phpbb_functional_test_case extends phpbb_test_case } global $phpbb_container; - $phpbb_container->reset(); + if (!empty($phpbb_container)) + { + $phpbb_container->reset(); + } // Purge cache to remove cached files $phpbb_container = new phpbb_mock_container_builder(); diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php index 11f9020e4f..8c4bf5c1d7 100644 --- a/tests/test_framework/phpbb_test_case.php +++ b/tests/test_framework/phpbb_test_case.php @@ -17,11 +17,9 @@ class phpbb_test_case extends TestCase { protected $test_case_helpers; - public function __construct($name = NULL, array $data = array(), $dataName = '') + protected function setUp(): void { - parent::__construct($name, $data, $dataName); - - $this->backupStaticAttributesExcludeList += [ + $this->setBackupStaticPropertiesExcludeList([ 'SebastianBergmann\CodeCoverage\CodeCoverage' => ['instance'], 'SebastianBergmann\CodeCoverage\Filter' => ['instance'], 'SebastianBergmann\CodeCoverage\Util' => ['ignoredLines', 'templateMethods'], @@ -30,7 +28,7 @@ class phpbb_test_case extends TestCase 'PHP_Token_Stream_CachingFactory' => ['cache'], 'phpbb_database_test_case' => ['already_connected', 'last_post_timestamp'], - ]; + ]); } public function get_test_case_helpers() diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index d3adcceedd..bd5ffc5505 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -434,7 +434,7 @@ class phpbb_test_case_helpers ->disallowMockingUnknownTypes() ->getMock(); $mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access'); - $mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles')); + $mb->onlyMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles')); $mb->setConstructorArgs(array( $db_driver, 'phpbb_bbcodes', @@ -488,7 +488,7 @@ class phpbb_test_case_helpers { $path_helper = $this->test_case->getMockBuilder('phpbb\\path_helper') ->disableOriginalConstructor() - ->setMethods(array('get_web_root_path')) + ->onlyMethods(array('get_web_root_path')) ->getMock(); $path_helper->expects($this->test_case->any()) ->method('get_web_root_path') @@ -578,7 +578,7 @@ class phpbb_test_case_helpers $user = $this->test_case->getMockBuilder('\phpbb\user') ->setConstructorArgs(array($lang, '\phpbb\datetime')) - ->setMethods(array('format_date')) + ->onlyMethods(array('format_date')) ->getMock(); $user->expects($this->test_case->any()) ->method('format_date') diff --git a/tests/text_formatter/s9e/acp_utils_test.php b/tests/text_formatter/s9e/acp_utils_test.php index 9d84924042..597dde0f90 100644 --- a/tests/text_formatter/s9e/acp_utils_test.php +++ b/tests/text_formatter/s9e/acp_utils_test.php @@ -26,7 +26,7 @@ class phpbb_textformatter_s9e_acp_utils_test extends phpbb_test_case $this->assertEquals($expected, $actual); } - public function get_analyse_bbcode_tests() + public static function get_analyse_bbcode_tests() { return [ [ diff --git a/tests/text_formatter/s9e/bbcode_merger_test.php b/tests/text_formatter/s9e/bbcode_merger_test.php index 5ec0c91971..55f9bd6f13 100644 --- a/tests/text_formatter/s9e/bbcode_merger_test.php +++ b/tests/text_formatter/s9e/bbcode_merger_test.php @@ -34,7 +34,7 @@ class phpbb_textformatter_s9e_bbcode_merger_test extends phpbb_test_case $this->assertSame($expected_template, $merged['template']); } - public function get_merge_bbcodes_tests() + public static function get_merge_bbcodes_tests() { return [ [ diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php index 1b91aa7c83..76b22a7845 100644 --- a/tests/text_formatter/s9e/default_formatting_test.php +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -45,7 +45,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case $this->assertSame($expected, $renderer->render($parsed_text)); } - public function get_default_formatting_tests() + public static function get_default_formatting_tests() { return array( array( diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index 5300b4c52d..b62a21106e 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -296,14 +296,19 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case public function test_configure_events() { $this->dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); + $matcher = $this->exactly(2); $this->dispatcher - ->expects($this->exactly(2)) + ->expects($matcher) ->method('trigger_event') - ->withConsecutive( - ['core.text_formatter_s9e_configure_before', $this->callback(array($this, 'configure_event_callback'))], - ['core.text_formatter_s9e_configure_after', $this->callback(array($this, 'configure_event_callback'))] - ) - ->will($this->returnArgument(1)); + ->willReturnCallback(function($event, $vars) use ($matcher) { + $callNr = $matcher->numberOfInvocations(); + match($callNr) { + 1 => $this->assertEquals('core.text_formatter_s9e_configure_before', $event), + 2 => $this->assertEquals('core.text_formatter_s9e_configure_after', $event), + }; + $this->assertTrue($this->configure_event_callback($vars)); + return $vars; + }); $this->get_factory()->get_configurator(); } diff --git a/tests/text_formatter/s9e/mention_helper_test.php b/tests/text_formatter/s9e/mention_helper_test.php index 26fc743841..356dbb5916 100644 --- a/tests/text_formatter/s9e/mention_helper_test.php +++ b/tests/text_formatter/s9e/mention_helper_test.php @@ -76,7 +76,7 @@ class mention_helper_test extends phpbb_database_test_case $this->mention_helper = $phpbb_container->get('text_formatter.s9e.mention_helper'); } - public function inject_metadata_data() + public static function inject_metadata_data() { return [ [ @@ -99,7 +99,7 @@ class mention_helper_test extends phpbb_database_test_case $this->assertStringContainsString($expected_profile_substring, $result); } - public function get_mentioned_user_ids_data() + public static function get_mentioned_user_ids_data() { return [ [ diff --git a/tests/text_formatter/s9e/parser_test.php b/tests/text_formatter/s9e/parser_test.php index ef9a1184ee..61c4f340e2 100644 --- a/tests/text_formatter/s9e/parser_test.php +++ b/tests/text_formatter/s9e/parser_test.php @@ -101,20 +101,19 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case public function test_options($adapter_method, $adapter_arg, $concrete_method, $concrete_arg) { $mock = $this->getMockBuilder('s9e\\TextFormatter\\Parser') - ->setMethods([$concrete_method]) + ->onlyMethods([$concrete_method]) ->disableOriginalConstructor() ->getMock(); $concrete_args = (array) $concrete_arg; - array_walk($concrete_args, function(&$value) - { - $value = (array) $value; - } - ); - $mock->expects($this->exactly(count($concrete_args))) + $matcher = $this->exactly(count($concrete_args)); + $mock->expects($matcher) ->method($concrete_method) - ->withConsecutive(...$concrete_args); - + ->willReturnCallback(function ($arg) use ($concrete_args, $matcher) { + $callNr = $matcher->numberOfInvocations(); + $this->assertEquals($arg, $concrete_args[$callNr - 1]); + }); + $cache = new phpbb_mock_cache; $cache->put('_foo_parser', $mock); @@ -132,7 +131,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case call_user_func_array(array($parser, $adapter_method), (array) $adapter_arg); } - public function get_options_tests() + public static function get_options_tests() { return array( array( @@ -219,15 +218,22 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case $dispatcher ); + $matcher = $this->exactly(2); $dispatcher - ->expects($this->exactly(2)) + ->expects($matcher) ->method('trigger_event') - ->withConsecutive( - ['core.text_formatter_s9e_parse_before', $this->callback(array($this, 'parse_before_event_callback'))], - ['core.text_formatter_s9e_parse_after', $this->callback(array($this, 'parse_after_event_callback'))] - ) - ->will($this->returnArgument(1)); - + ->willReturnCallback(function($event, $vars) use ($matcher) { + $callNr = $matcher->numberOfInvocations(); + match($callNr) { + 1 => $this->assertEquals('core.text_formatter_s9e_parse_before', $event), + 2 => $this->assertEquals('core.text_formatter_s9e_parse_after', $event), + }; + match($callNr) { + 1 => $this->assertTrue($this->parse_before_event_callback($vars)), + 2 => $this->assertTrue($this->parse_after_event_callback($vars)), + }; + return $vars; + }); $parser->parse('...'); } diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php index 51f4f923b4..b39a620931 100644 --- a/tests/text_formatter/s9e/renderer_test.php +++ b/tests/text_formatter/s9e/renderer_test.php @@ -93,7 +93,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $this->assertSame($expected, $renderer->render($original)); } - public function get_options_cases() + public static function get_options_cases() { return array( array( @@ -141,7 +141,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $this->assertSame($expected, $container->get('text_formatter.renderer')->render($original)); } - public function get_default_options_cases() + public static function get_default_options_cases() { return array( array( @@ -278,7 +278,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $this->assertTrue($renderer->{'get_' . $option_name}()); } - public function get_option_names() + public static function get_option_names() { return array( array('viewcensors'), @@ -421,15 +421,22 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $dispatcher ); + $matcher = $this->exactly(2); $dispatcher - ->expects($this->exactly(2)) + ->expects($matcher) ->method('trigger_event') - ->withConsecutive( - ['core.text_formatter_s9e_render_before', $this->callback(array($this, 'render_before_event_callback'))], - ['core.text_formatter_s9e_render_after', $this->callback(array($this, 'render_after_event_callback'))] - ) - ->will($this->returnArgument(1)); - + ->willReturnCallback(function($event, $vars) use ($matcher) { + $callNr = $matcher->numberOfInvocations(); + match($callNr) { + 1 => $this->assertEquals('core.text_formatter_s9e_render_before', $event), + 2 => $this->assertEquals('core.text_formatter_s9e_render_after', $event), + }; + match($callNr) { + 1 => $this->assertTrue($this->render_before_event_callback($vars)), + 2 => $this->assertTrue($this->render_after_event_callback($vars)), + }; + return $vars; + }); $renderer->render('...'); } diff --git a/tests/text_formatter/s9e/utils_test.php b/tests/text_formatter/s9e/utils_test.php index 2754574c27..ecda57d868 100644 --- a/tests/text_formatter/s9e/utils_test.php +++ b/tests/text_formatter/s9e/utils_test.php @@ -24,7 +24,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->unparse($original)); } - public function get_unparse_tests() + public static function get_unparse_tests() { return array( array( @@ -53,7 +53,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->clean_formatting($original)); } - public function get_clean_formatting_tests() + public static function get_clean_formatting_tests() { return array( array( @@ -87,7 +87,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->get_outermost_quote_authors($parser->parse($original))); } - public function get_outermost_quote_authors_tests() + public static function get_outermost_quote_authors_tests() { return array( array( @@ -124,7 +124,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->generate_quote($text, $params)); } - public function get_generate_quote_tests() + public static function get_generate_quote_tests() { return array( array( @@ -248,7 +248,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $actual); } - public function get_remove_bbcode_tests() + public static function get_remove_bbcode_tests() { return array( array( diff --git a/tests/text_processing/censor_text_test.php b/tests/text_processing/censor_text_test.php index eda2bbb1b3..9398c42e6a 100644 --- a/tests/text_processing/censor_text_test.php +++ b/tests/text_processing/censor_text_test.php @@ -13,7 +13,7 @@ class phpbb_text_processing_censor_text_test extends phpbb_test_case { - public function censor_text_data() + public static function censor_text_data() { global $cache, $user; $cache = new phpbb_mock_cache; diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index 0d902c9130..d948dd6148 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -33,7 +33,7 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case $this->assertSame($expected, $actual); } - public function get_legacy_tests() + public static function get_legacy_tests() { return array( array( @@ -86,7 +86,7 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case $this->assertSame($expected, $actual); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index 7d96152c21..45162ce9c3 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -46,7 +46,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $this->assertSame($expected, $actual); } - public function get_legacy_tests() + public static function get_legacy_tests() { return array( array( @@ -132,7 +132,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $this->assertSame($expected, generate_text_for_display($original, '', '', 0, $censor_text)); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/generate_text_for_edit_test.php b/tests/text_processing/generate_text_for_edit_test.php index 8258a196f5..a6d08fe364 100644 --- a/tests/text_processing/generate_text_for_edit_test.php +++ b/tests/text_processing/generate_text_for_edit_test.php @@ -31,7 +31,7 @@ class phpbb_text_processing_generate_text_for_edit_test extends phpbb_test_case $this->assertSame($expected, $return['text']); } - public function get_legacy_tests() + public static function get_legacy_tests() { return array( array( @@ -69,7 +69,7 @@ class phpbb_text_processing_generate_text_for_edit_test extends phpbb_test_case $this->assertSame($expected, $return['text']); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/generate_text_for_storage_test.php b/tests/text_processing/generate_text_for_storage_test.php index 86c257a9f6..c2aa7d2db6 100644 --- a/tests/text_processing/generate_text_for_storage_test.php +++ b/tests/text_processing/generate_text_for_storage_test.php @@ -48,7 +48,7 @@ class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_ca $this->assertSame($expected, $actual); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php index 3c8539c612..e09d98bfdb 100644 --- a/tests/text_processing/make_clickable_test.php +++ b/tests/text_processing/make_clickable_test.php @@ -13,7 +13,7 @@ class phpbb_text_processing_make_clickable_test extends phpbb_test_case { - public function make_clickable_data() + public static function make_clickable_data() { // value => whether it should work $prefix_texts = array( @@ -101,7 +101,7 @@ class phpbb_text_processing_make_clickable_test extends phpbb_test_case $this->assertEquals($expected, $result, $label); } - public function make_clickable_mixed_serverurl_data() + public static function make_clickable_mixed_serverurl_data() { $urls = array( 'http://thisdomain.org' => array('tag' => 'm', 'url' => false, 'text' => false), diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index 93c0bd6652..ca301b9b3e 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_test.php @@ -60,14 +60,15 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ); $user->style = array('style_id' => 1); - $user->lang = array( - 'NO_POLL_TITLE' => 'You have to enter a poll title.', - 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', - 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', - 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', - 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', - 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', - ); + $user->expects($this->any()) + -> method('__get')->with('lang')->willReturn([ + 'NO_POLL_TITLE' => 'You have to enter a poll title.', + 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', + 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', + 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', + 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', + ]); $phpbb_container = new phpbb_mock_container_builder; $phpbb_container->set('user', $user); @@ -113,7 +114,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case $this->assertSame($warn_msg, $message_parser->warn_msg); } - public function get_test_polls() + public static function get_test_polls() { return array( array( @@ -183,7 +184,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case $this->assertSame($warn_msg, $message_parser->warn_msg); } - public function get_test_cases() + public static function get_test_cases() { return array( array( diff --git a/tests/text_processing/smilies_test.php b/tests/text_processing/smilies_test.php index 3778e5f58c..180d4c296e 100644 --- a/tests/text_processing/smilies_test.php +++ b/tests/text_processing/smilies_test.php @@ -25,7 +25,7 @@ class phpbb_text_processing_smilies_test extends phpbb_test_case $this->assertSame($expected, $renderer->render($parser->parse($original))); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/strip_bbcode_test.php b/tests/text_processing/strip_bbcode_test.php index 6eae1aa0dd..2fdae3b5f0 100644 --- a/tests/text_processing/strip_bbcode_test.php +++ b/tests/text_processing/strip_bbcode_test.php @@ -14,7 +14,7 @@ class phpbb_text_processing_strip_bbcode_test extends phpbb_test_case { - public function data_strip_bbcode() + public static function data_strip_bbcode() { return [ ['[b:20m4ill1]bold[/b:20m4ill1]', ' bold '], diff --git a/tests/text_processing/tickets_test.php b/tests/text_processing/tickets_test.php index 6230191a69..36eec93b7e 100644 --- a/tests/text_processing/tickets_test.php +++ b/tests/text_processing/tickets_test.php @@ -44,7 +44,7 @@ class phpbb_text_processing_tickets_test extends phpbb_test_case } } - public function get_tickets_data() + public static function get_tickets_data() { $tests = array(); diff --git a/tests/text_reparser/plugins/post_text_test.php b/tests/text_reparser/plugins/post_text_test.php index ecd06ac9bf..8e63ca7256 100644 --- a/tests/text_reparser/plugins/post_text_test.php +++ b/tests/text_reparser/plugins/post_text_test.php @@ -24,7 +24,7 @@ class phpbb_textreparser_post_text_test extends phpbb_textreparser_test_row_base return new \phpbb\textreparser\plugins\post_text($this->db, POSTS_TABLE); } - public function data_reparse_url(): array + public static function data_reparse_url(): array { return [ [ // Reparse the same diff --git a/tests/text_reparser/plugins/test_row_based_plugin.php b/tests/text_reparser/plugins/test_row_based_plugin.php index c03ed39096..60b3e30584 100644 --- a/tests/text_reparser/plugins/test_row_based_plugin.php +++ b/tests/text_reparser/plugins/test_row_based_plugin.php @@ -85,7 +85,7 @@ abstract class phpbb_textreparser_test_row_based_plugin extends phpbb_database_t $this->assertEquals($expected, $this->get_rows($ids)); } - public function get_reparse_tests() + public static function get_reparse_tests() { return array( array( diff --git a/tests/tree/nestedset_forum_insert_delete_test.php b/tests/tree/nestedset_forum_add_remove_test.php similarity index 97% rename from tests/tree/nestedset_forum_insert_delete_test.php rename to tests/tree/nestedset_forum_add_remove_test.php index e58c1b8c68..863ff8e996 100644 --- a/tests/tree/nestedset_forum_insert_delete_test.php +++ b/tests/tree/nestedset_forum_add_remove_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_nestedset_forum_base { - public function delete_data() + public static function delete_data() { return array( array(1, array(1, 2, 3), array( @@ -56,7 +56,7 @@ class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_ $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function delete_throws_data() + public static function delete_throws_data() { return array( array('Not an item', 0), @@ -74,7 +74,7 @@ class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_ $this->set->delete($forum_id); } - public function insert_data() + public static function insert_data() { return array( array(array( diff --git a/tests/tree/nestedset_forum_get_data_test.php b/tests/tree/nestedset_forum_get_data_test.php index 90ef6b3dc3..c887231754 100644 --- a/tests/tree/nestedset_forum_get_data_test.php +++ b/tests/tree/nestedset_forum_get_data_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_nestedset_forum_base { - public function get_path_and_subtree_data_data() + public static function get_path_and_subtree_data_data() { return array( array(1, true, true, array(1, 2, 3)), @@ -43,7 +43,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_path_and_subtree_data($forum_id, $order_asc, $include_item))); } - public function get_path_data_data() + public static function get_path_data_data() { return array( array(1, true, true, array(1)), @@ -71,7 +71,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_path_data($forum_id, $order_asc, $include_item))); } - public function get_subtree_data_data() + public static function get_subtree_data_data() { return array( array(1, true, true, array(1, 2, 3)), @@ -99,7 +99,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_subtree_data($forum_id, $order_asc, $include_item))); } - public function get_path_basic_data_data() + public static function get_path_basic_data_data() { return array( array(1, '', array()), @@ -121,7 +121,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_path_basic_data($forum_data))); } - public function get_all_tree_data_data() + public static function get_all_tree_data_data() { return array( array(true, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)), diff --git a/tests/tree/nestedset_forum_move_test.php b/tests/tree/nestedset_forum_move_test.php index b738a0f6a8..e841daf843 100644 --- a/tests/tree/nestedset_forum_move_test.php +++ b/tests/tree/nestedset_forum_move_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nestedset_forum_base { - public function move_data() + public static function move_data() { return array( array('Move first item up', @@ -132,7 +132,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_down_data() + public static function move_down_data() { return array( array('Move last item down', @@ -179,7 +179,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_up_data() + public static function move_up_data() { return array( array('Move first item up', @@ -226,7 +226,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_children_data() + public static function move_children_data() { return array( array('Item has no children', @@ -376,7 +376,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_children_throws_item_data() + public static function move_children_throws_item_data() { return array( array('Item 0 does not exist', 0, 5), @@ -394,7 +394,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->set->move_children($forum_id, $target_id); } - public function move_children_throws_parent_data() + public static function move_children_throws_parent_data() { return array( array('New parent is child', 4, 5), @@ -413,7 +413,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->set->move_children($forum_id, $target_id); } - public function change_parent_data() + public static function change_parent_data() { return array( array('Move single child up', @@ -530,7 +530,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function change_parent_throws_item_data() + public static function change_parent_throws_item_data() { return array( array('Item 0 does not exist', 0, 5), @@ -548,7 +548,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->set->change_parent($forum_id, $target_id); } - public function change_parent_throws_parent_data() + public static function change_parent_throws_parent_data() { return array( array('New parent is child', 4, 5), diff --git a/tests/tree/nestedset_forum_regenerate_test.php b/tests/tree/nestedset_forum_regenerate_test.php index 487237deda..b5bc806fd3 100644 --- a/tests/tree/nestedset_forum_regenerate_test.php +++ b/tests/tree/nestedset_forum_regenerate_test.php @@ -31,7 +31,7 @@ class phpbb_tests_tree_nestedset_forum_regenerate_test extends phpbb_tests_tree_ array('forum_id' => 11, 'parent_id' => 7, 'left_id' => 20, 'right_id' => 21, 'forum_parents' => ''), ); - public function regenerate_left_right_ids_data() + public static function regenerate_left_right_ids_data() { return array( array('UPDATE phpbb_forums diff --git a/tests/tree/nestedset_forum_test.php b/tests/tree/nestedset_forum_test.php index bffceb73ef..973af35836 100644 --- a/tests/tree/nestedset_forum_test.php +++ b/tests/tree/nestedset_forum_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class pphpbb_tests_tree_nestedset_forum_test extends phpbb_tests_tree_nestedset_forum_base { - public function forum_constructor_data() + public static function forum_constructor_data() { return array( array(array( @@ -47,7 +47,7 @@ class pphpbb_tests_tree_nestedset_forum_test extends phpbb_tests_tree_nestedset_ $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function get_sql_where_data() + public static function get_sql_where_data() { return array( array('SELECT forum_id diff --git a/tests/ucp/controller_webpush_test.php b/tests/ucp/controller_webpush_test.php index 52356b6f69..e1e5373862 100644 --- a/tests/ucp/controller_webpush_test.php +++ b/tests/ucp/controller_webpush_test.php @@ -70,6 +70,7 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case $this->request = $this->createMock(\phpbb\request\request_interface::class); $this->template = $this->createMock(\Twig\Environment::class); $this->user = new \phpbb\user($this->language, '\phpbb\datetime'); + $user = $this->user; $this->user_loader = new \phpbb\user_loader($this->avatar_helper, $this->db, $this->phpbb_root_path, $this->php_ext, 'phpbb_users'); $this->path_helper = new \phpbb\path_helper($symfony_request, $this->request, $phpbb_root_path, $phpEx); @@ -91,7 +92,7 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case ); } - public function data_notification_exceptions(): array + public static function data_notification_exceptions(): array { return [ 'not_ajax' => [ @@ -216,9 +217,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => 2, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $json_response = $this->controller->notification(); @@ -274,9 +272,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => ANONYMOUS, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $json_response = $this->controller->notification(); @@ -332,9 +327,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => ANONYMOUS, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $this->expectException(http_exception::class); $this->expectExceptionMessage('NO_AUTH_OPERATION'); @@ -382,9 +374,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => 2, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $json_response = $this->controller->notification(); diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php index 887cfdee41..032ab56803 100644 --- a/tests/upload/filespec_test.php +++ b/tests/upload/filespec_test.php @@ -124,7 +124,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertTrue($filespec->init_error()); } - public function additional_checks_variables() + public static function additional_checks_variables() { // False here just indicates the file is too large and fails the // filespec::additional_checks method because of it. All other code @@ -165,7 +165,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertSame(array('WRONG_SIZE'), $filespec->error); } - public function check_content_variables() + public static function check_content_variables() { // False here indicates that a file is non-binary and contains // disallowed content that makes IE report the mimetype incorrectly. @@ -190,7 +190,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals(true, $filespec->check_content(array())); } - public function clean_filename_variables() + public static function clean_filename_variables() { $chunks = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'\\" /:*?<>|[];(){},#+=-_`', 8); return array( @@ -252,7 +252,7 @@ class phpbb_filespec_test extends phpbb_test_case } } - public function data_clean_filename_avatar() + public static function data_clean_filename_avatar() { return array( array(false, false, ''), @@ -285,7 +285,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertSame($expected, $filespec->get('realname')); } - public function get_extension_variables() + public static function get_extension_variables() { return array( array('file.png', 'png'), @@ -305,7 +305,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, \phpbb\files\filespec::get_extension($filename)); } - public function is_image_variables() + public static function is_image_variables() { return array( array('gif', 'image/gif', true), @@ -328,7 +328,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, $filespec->is_image()); } - public function is_image_get_mimetype() + public static function is_image_get_mimetype() { return array( array('gif', 'image/gif', true), @@ -357,7 +357,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, $filespec->is_image()); } - public function move_file_variables() + public static function move_file_variables() { return array( array('gif_copy', 'gif_moved', 'image/gif', 'gif', false, true), @@ -408,7 +408,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertFalse($filespec->move_file('foo')); } - public function data_move_file_copy() + public static function data_move_file_copy() { return array( array('gif_copy', true, false, array()), @@ -451,7 +451,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertSame($expected_error, $filespec->error); } - public function data_move_file_imagesize() + public static function data_move_file_imagesize() { return array( array( diff --git a/tests/upload/imagesize_test.php b/tests/upload/imagesize_test.php index 654e32054a..8ad12740ab 100644 --- a/tests/upload/imagesize_test.php +++ b/tests/upload/imagesize_test.php @@ -27,7 +27,7 @@ class phpbb_upload_imagesize_test extends \phpbb_test_case $this->path = __DIR__ . '/fixture/'; } - public function data_get_imagesize() + public static function data_get_imagesize() { return array( array('foobar', 'image/bmp', false), diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php index 4b3c8a5a25..9b1c6fc4cc 100644 --- a/tests/utf/utf8_clean_string_test.php +++ b/tests/utf/utf8_clean_string_test.php @@ -13,7 +13,7 @@ class phpbb_utf_utf8_clean_string_test extends phpbb_test_case { - public function cleanable_strings() + public static function cleanable_strings() { return array( array('MiXed CaSe', 'mixed case', 'Checking case folding'), diff --git a/tests/version/version_fetch_test.php b/tests/version/version_fetch_test.php index e9c5a22cf0..b138ff4aff 100644 --- a/tests/version/version_fetch_test.php +++ b/tests/version/version_fetch_test.php @@ -14,7 +14,7 @@ /* * @group slow */ -class phpbb_version_helper_fetch_test extends phpbb_test_case +class phpbb_version_fetch_test extends phpbb_test_case { protected $cache, $version_helper; diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php index 1c616bc1fd..abc5475ad3 100644 --- a/tests/version/version_helper_remote_test.php +++ b/tests/version/version_helper_remote_test.php @@ -41,7 +41,7 @@ class version_helper_remote_test extends \phpbb_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $db = new \phpbb\db\driver\factory($container); $this->cache = $this->getMockBuilder('\phpbb\cache\service') - ->setMethods(array('get')) + ->addMethods(array('get')) ->setConstructorArgs(array(new \phpbb\cache\driver\dummy(), $config, $db, $phpbb_dispatcher, '../../', 'php')) ->getMock(); @@ -84,7 +84,7 @@ class version_helper_remote_test extends \phpbb_test_case $this->user->add_lang('acp/common'); } - public function provider_get_versions() + public static function provider_get_versions() { return array( array('', false, '', 'VERSIONCHECK_FAIL'), diff --git a/tests/version/version_test.php b/tests/version/version_helper_test.php similarity index 98% rename from tests/version/version_test.php rename to tests/version/version_helper_test.php index f162d12d44..0683fac555 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_helper_test.php @@ -37,7 +37,7 @@ class phpbb_version_helper_test extends phpbb_test_case ); } - public function is_stable_data() + public static function is_stable_data() { return array( array( @@ -87,7 +87,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $this->version_helper->is_stable($version)); } - public function get_suggested_updates_data() + public static function get_suggested_updates_data() { return array( array( @@ -208,7 +208,7 @@ class phpbb_version_helper_test extends phpbb_test_case $version_helper = $this ->getMockBuilder('\phpbb\version_helper') - ->setMethods(array( + ->onlyMethods(array( 'get_versions_matching_stability', )) ->setConstructorArgs(array( @@ -229,7 +229,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_suggested_updates()); } - public function get_latest_on_current_branch_data() + public static function get_latest_on_current_branch_data() { return array( array( @@ -324,7 +324,7 @@ class phpbb_version_helper_test extends phpbb_test_case $version_helper = $this ->getMockBuilder('\phpbb\version_helper') - ->setMethods(array( + ->onlyMethods(array( 'get_versions_matching_stability', )) ->setConstructorArgs(array( @@ -345,7 +345,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_latest_on_current_branch()); } - public function get_update_on_branch_data() + public static function get_update_on_branch_data() { return array( array( @@ -581,7 +581,7 @@ class phpbb_version_helper_test extends phpbb_test_case $version_helper = $this ->getMockBuilder('\phpbb\version_helper') - ->setMethods(array( + ->onlyMethods(array( 'get_versions_matching_stability', )) ->setConstructorArgs(array( @@ -602,7 +602,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_update_on_branch()); } - public function get_ext_update_on_branch_data() + public static function get_ext_update_on_branch_data() { return array( // Single branch, check version for current branch @@ -958,7 +958,7 @@ class phpbb_version_helper_test extends phpbb_test_case $version_helper = $this ->getMockBuilder('\phpbb\version_helper') - ->setMethods(array( + ->onlyMethods(array( 'get_versions_matching_stability', )) ->setConstructorArgs(array( diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php index 5d1eef3f85..0c3f9d993e 100644 --- a/tests/viewonline/helper_test.php +++ b/tests/viewonline/helper_test.php @@ -26,7 +26,7 @@ class phpbb_viewonline_helper_test extends phpbb_test_case $this->viewonline_helper = new \phpbb\viewonline_helper($db); } - public function session_pages_data() + public static function session_pages_data() { return array( array('index.php', 'index'), diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index ee23fe779c..a12d0e50ac 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -97,7 +97,7 @@ class phpbb_wrapper_version_compare_test extends phpbb_test_case ); } - public function equality_test_data() + public static function equality_test_data() { return array( array('1.1.0-A2', '1.1.0-a2'), @@ -118,7 +118,7 @@ class phpbb_wrapper_version_compare_test extends phpbb_test_case } - public function alpha_beta_test_data() + public static function alpha_beta_test_data() { return array( array(-1, '1.1.0-A2', '1.1.0-B1'),