Compare commits

...

17 commits

Author SHA1 Message Date
rxu
05a5f9ea84
Merge 788e408ceb into e3b837f1b7 2025-07-21 14:57:58 -05:00
Marc Alexander
e3b837f1b7 Merge branch '3.3.x' 2025-07-21 19:34:10 +00:00
Marc Alexander
b59bfadec7
Merge pull request #6840 from battye/ticket/17034
[ticket/17034] Fix minimum posts rank validation
2025-07-21 21:32:36 +02:00
Marc Alexander
c6fe2b6cd1 Merge branch '3.3.x' 2025-07-21 19:25:33 +00:00
Marc Alexander
f6269dde2d
Merge pull request #6791 from IdfbAn/ticket/17110
[ticket/17110] Change "slanderous" to "libellous" in T&C
2025-07-21 21:25:05 +02:00
Marc Alexander
06b9ca4768
Merge pull request #6839 from rxu/ticket/17530
[ticket/17530] Use Doctrine driver middleware instead of 'platform' parameter
2025-07-21 21:01:01 +02:00
battye
1633288447 [ticket/17034] Fix min posts rank validation
PHPBB-17034
2025-07-20 04:41:27 +00:00
rxu
86195ac0f9
[ticket/17530] Better classes naming
PHPBB-17530
2025-07-19 23:32:42 +07:00
rxu
980b6e6f9e
[ticket/17530] Use Doctrine driver middleware instead of 'platform' parameter
PHPBB-17530
2025-07-19 10:43:09 +07:00
rxu
788e408ceb
[ticket/17535] Fix global var names duplication
PHPBB-17535
2025-07-18 23:11:41 +07:00
rxu
65ef7f1156
Merge branch 'iMattPro-pullrequests/rxu/ticket/17535' into ticket/17535 2025-07-18 23:08:06 +07:00
Matt Friedman
69fa84b41b
[ticket/17535] Update test fix
PHPBB-17535

Signed-off-by: Matt Friedman <maf675@gmail.com>
2025-07-18 08:55:06 -07:00
rxu
833ed86283
[ticket/17535] Fix Redis
PHPBB-17535
2025-07-18 13:14:15 +07:00
rxu
902c99bc0c
[ticket/17535] Fix tests PHP deprecations and notices
PHPBB-17535
2025-07-18 13:14:06 +07:00
rxu
8a99024087
[ticket/17535] Convert config files, make data providers static
PHPBB-17535
2025-07-18 13:13:59 +07:00
rxu
d7db296eab
[ticket/17535] Update PHPUnit to v.10
PHPBB-17535
2025-07-18 13:13:51 +07:00
IdfbAn
fabef37d71 [ticket/17110] Change "slanderous" to "libellous" in T&C
Slander is spoken and libel is written, so "libellous" is more accurate here.

PHPBB-17110
2025-03-31 20:36:21 +04:00
270 changed files with 1918 additions and 1907 deletions

View file

@ -1,39 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="mysqli" />
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
<server name="PHPBB_TEST_DBPORT" value="3306" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="root" />
<server name="PHPBB_TEST_DBPASSWD" value="" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="mysqli"/>
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0"/>
<server name="PHPBB_TEST_DBPORT" value="3306"/>
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
<server name="PHPBB_TEST_DBUSER" value="root"/>
<server name="PHPBB_TEST_DBPASSWD" value=""/>
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
</php>
</phpunit>

View file

@ -1,41 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mssqlnative" />
<server name="PHPBB_TEST_DBHOST" value="127.0.0.1" />
<server name="PHPBB_TEST_DBPORT" value="" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="sa" />
<server name="PHPBB_TEST_DBPASSWD" value="Pssw0rd_12" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mssqlnative"/>
<server name="PHPBB_TEST_DBHOST" value="127.0.0.1"/>
<server name="PHPBB_TEST_DBPORT" value=""/>
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
<server name="PHPBB_TEST_DBUSER" value="sa"/>
<server name="PHPBB_TEST_DBPASSWD" value="Pssw0rd_12"/>
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
</php>
</phpunit>

View file

@ -1,41 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli" />
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
<server name="PHPBB_TEST_DBPORT" value="3306" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="root" />
<server name="PHPBB_TEST_DBPASSWD" value="" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli"/>
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0"/>
<server name="PHPBB_TEST_DBPORT" value="3306"/>
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
<server name="PHPBB_TEST_DBUSER" value="root"/>
<server name="PHPBB_TEST_DBPASSWD" value=""/>
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
</php>
</phpunit>

View file

@ -1,41 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
<server name="PHPBB_TEST_DBHOST" value="localhost" />
<server name="PHPBB_TEST_DBPORT" value="5432" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="postgres" />
<server name="PHPBB_TEST_DBPASSWD" value="postgres" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
<server name="PHPBB_TEST_DBHOST" value="localhost"/>
<server name="PHPBB_TEST_DBPORT" value="5432"/>
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
<server name="PHPBB_TEST_DBUSER" value="postgres"/>
<server name="PHPBB_TEST_DBPASSWD" value="postgres"/>
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
</php>
</phpunit>

View file

@ -1,41 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
<server name="PHPBB_TEST_DBHOST" value="localhost" />
<server name="PHPBB_TEST_DBPORT" value="5432" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="postgres" />
<server name="PHPBB_TEST_DBPASSWD" value="root" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://phpbb.test/" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
<server name="PHPBB_TEST_DBHOST" value="localhost"/>
<server name="PHPBB_TEST_DBPORT" value="5432"/>
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests"/>
<server name="PHPBB_TEST_DBUSER" value="postgres"/>
<server name="PHPBB_TEST_DBPASSWD" value="root"/>
<server name="PHPBB_TEST_REDIS_HOST" value="localhost"/>
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://phpbb.test/"/>
</php>
</phpunit>

View file

@ -1,35 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_REDIS_HOST" value="0.0.0.0"/>
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost"/>
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/"/>
</php>
</phpunit>

View file

@ -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

View file

@ -44,7 +44,7 @@
<div id="posts"<!-- IF S_SPECIAL_RANK --> style="display: none;"<!-- ENDIF -->>
<dl>
<dt><label for="min_posts">{L_RANK_MINIMUM}{L_COLON}</label></dt>
<dd><input name="min_posts" type="number" id="min_posts" min="0" max="9999999999" value="{MIN_POSTS}" /></dd>
<dd><input name="min_posts" type="number" id="min_posts" min="0" max="16777215" value="{MIN_POSTS}" /></dd>
</dl>
</div>

View file

@ -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",

609
phpBB/composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -556,6 +556,7 @@ class compress_tar extends compress
{
var $isgz = false;
var $isbz = false;
var $file = '';
var $filename = '';
var $mode = '';
var $type = '';

View file

@ -42,7 +42,7 @@ $lang = array_merge($lang, array(
<br><br>
Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) which is a bulletin board solution released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a> (hereinafter “GPL”) and can be downloaded from <a href="https://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions; phpBB Limited is not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="https://www.phpbb.com/">https://www.phpbb.com/</a>.
<br><br>
You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where %1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that %1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither %1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised.
You agree not to post any abusive, obscene, vulgar, libellous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where %1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that %1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither %1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised.
',
'PRIVACY_POLICY' => 'This policy explains in detail how %1$s” along with its affiliated companies (hereinafter “we”, “us”, “our”, %1$s”, %2$s”) and phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) use any information collected during any session of usage by you (hereinafter “your information”).

View file

@ -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}
*/

View file

@ -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;
}

View file

@ -15,6 +15,8 @@ namespace phpbb\db\doctrine;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use phpbb\db\middleware\oracle\platform as oracle_platform;
use phpbb\db\middleware\postgresql\platform as postgresql_platform;
/**
* Case-insensitive string type (only supported by Postgres).

View file

@ -13,12 +13,17 @@
namespace phpbb\db\doctrine;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Types\Type;
use InvalidArgumentException;
use phpbb\config_php_file;
use phpbb\db\middleware\mysql\middleware as mysql_middleware;
use phpbb\db\middleware\oracle\middleware as oracle_middleware;
use phpbb\db\middleware\postgresql\middleware as postgresql_middleware;
use phpbb\db\middleware\sqlsrv\middleware as sqlsrv_middleware;
use phpbb\exception\runtime_exception;
/**
@ -94,9 +99,21 @@ class connection_factory
$port
);
$middleware = match($driver)
{
'pdo_mysql', 'mysqli' => [new mysql_middleware()],
'pdo_oci', 'oci8' => [new oracle_middleware()],
'pdo_pgsql', 'pgsql' => [new postgresql_middleware()],
'pdo_sqlsrv', 'sqlsrv' => [new sqlsrv_middleware()],
default => [],
};
try
{
$connection = DriverManager::getConnection($params);
$connection_config = new Configuration();
$connection_config->setMiddlewares($middleware);
$connection = DriverManager::getConnection($params, $connection_config);
if (!Type::hasType(case_insensitive_string::CASE_INSENSITIVE_STRING))
{
Type::addType(case_insensitive_string::CASE_INSENSITIVE_STRING, case_insensitive_string::class);

View file

@ -13,9 +13,6 @@
namespace phpbb\db\doctrine;
use InvalidArgumentException;
use phpbb\db\doctrine\oci8\driver as oci8_driver;
/**
* Helper class to generate Doctrine DBAL configuration.
*/
@ -33,7 +30,7 @@ class connection_parameter_factory
*
* @return array Doctrine DBAL connection parameters.
*
* @throws InvalidArgumentException If a required parameter is empty or null.
* @throws \InvalidArgumentException If a required parameter is empty or null.
*/
public static function get_configuration(
string $driver,
@ -69,7 +66,7 @@ class connection_parameter_factory
*
* @return array Doctrine's DBAL configuration for SQLite.
*
* @throws InvalidArgumentException If a required parameter is empty or null.
* @throws \InvalidArgumentException If a required parameter is empty or null.
*/
private static function build_connection_parameters(
array $params,
@ -88,7 +85,7 @@ class connection_parameter_factory
if (empty($user) || empty($name))
{
throw new InvalidArgumentException('Required database parameter is not set.');
throw new \InvalidArgumentException('Required database parameter is not set.');
}
$params = array_merge($params, [
@ -146,37 +143,17 @@ class connection_parameter_factory
*/
private static function enrich_parameters(array $params) : array
{
$enrichment_tags = [
'pdo_mysql' => [
'charset' => 'UTF8',
'platform' => new mysql_platform(),
],
'oci8' => [
'charset' => 'UTF8',
'platform' => new oracle_platform(),
'driverClass' => oci8_driver::class,
],
'pdo_pgsql' => [
'charset' => 'UTF8',
'platform' => new postgresql_platform(),
],
'pdo_sqlsrv' => [
'platform' => new sqlsrv_platform(),
],
];
if (in_array($params['driver'], ['mysqli', 'pdo_mysql', 'pgsql', 'pdo_pgsql', 'oci8', 'pdo_oci']))
{
$params['charset'] = 'UTF8';
}
if ($params['driver'] === 'pdo_mysql' && extension_loaded('pdo_mysql'))
{
$enrichment_tags['pdo_mysql'][\PDO::MYSQL_ATTR_FOUND_ROWS] = true;
$params[\PDO::MYSQL_ATTR_FOUND_ROWS] = true;
}
$driver = $params['driver'];
if (!array_key_exists($driver, $enrichment_tags))
{
return $params;
}
return array_merge($params, $enrichment_tags[$driver]);
return $params;
}
/*

View file

@ -1,99 +0,0 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine\oci8;
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\ParameterType;
class connection implements DriverConnection
{
/**
* @var DriverConnection
*/
private $wrapped;
/**
* @param DriverConnection $wrapped
*/
public function __construct(DriverConnection $wrapped)
{
$this->wrapped = $wrapped;
}
/**
* {@inheritDoc}
*/
public function prepare(string $sql): DriverStatement
{
return new statement($this->wrapped->prepare($sql));
}
/**
* {@inheritDoc}
*/
public function query(string $sql): DriverResult
{
return new result($this->wrapped->query($sql));
}
/**
* {@inheritDoc}
*/
public function quote($value, $type = ParameterType::STRING)
{
return $this->wrapped->quote($value, $type);
}
/**
* {@inheritDoc}
*/
public function exec(string $sql): int
{
return $this->wrapped->exec($sql);
}
/**
* {@inheritDoc}
*/
public function lastInsertId($name = null)
{
return $this->wrapped->lastInsertId($name);
}
/**
* {@inheritDoc}
*/
public function beginTransaction(): bool
{
return $this->wrapped->beginTransaction();
}
/**
* {@inheritDoc}
*/
public function commit(): bool
{
return $this->wrapped->commit();
}
/**
* {@inheritDoc}
*/
public function rollBack(): bool
{
return $this->wrapped->rollBack();
}
}

View file

@ -1,65 +0,0 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine\oci8;
use Doctrine\DBAL\Connection as DoctrineConnection;
use Doctrine\DBAL\Driver\API\ExceptionConverter;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Driver as DoctrineDriver;
use Doctrine\DBAL\Driver\OCI8\Driver as OCI8Driver;
class driver implements DoctrineDriver
{
/**
* @var DoctrineDriver
*/
private $wrapped;
public function __construct()
{
$this->wrapped = new OCI8Driver();
}
/**
* {@inheritDoc}
*/
public function connect(array $params)
{
return new connection($this->wrapped->connect($params));
}
/**
* {@inheritDoc}
*/
public function getDatabasePlatform()
{
return $this->wrapped->getDatabasePlatform();
}
/**
* {@inheritDoc}
*/
public function getSchemaManager(DoctrineConnection $conn, AbstractPlatform $platform)
{
return new schema_manager($conn, $platform);
}
/**
* {@inheritDoc}
*/
public function getExceptionConverter(): ExceptionConverter
{
return $this->wrapped->getExceptionConverter();
}
}

View file

@ -1,109 +0,0 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine\oci8;
use Doctrine\DBAL\Driver\Result as DriverResult;
class result implements DriverResult
{
/**
* @var DriverResult
*/
private $wrapped;
/**
* @param DriverResult $wrapped
*/
public function __construct(DriverResult $wrapped)
{
$this->wrapped = $wrapped;
}
/**
* {@inheritDoc}
*/
public function fetchNumeric()
{
return $this->wrapped->fetchNumeric();
}
/**
* {@inheritDoc}
*/
public function fetchAssociative()
{
return array_change_key_case($this->wrapped->fetchAssociative(), CASE_LOWER);
}
/**
* {@inheritDoc}
*/
public function fetchOne()
{
return $this->wrapped->fetchOne();
}
/**
* {@inheritDoc}
*/
public function fetchAllNumeric(): array
{
return $this->wrapped->fetchAllNumeric();
}
/**
* {@inheritDoc}
*/
public function fetchAllAssociative(): array
{
$rows = [];
foreach ($this->wrapped->fetchAllAssociative() as $row)
{
$rows[] = array_change_key_case($row, CASE_LOWER);
}
return $rows;
}
/**
* {@inheritDoc}
*/
public function fetchFirstColumn(): array
{
return $this->wrapped->fetchFirstColumn();
}
/**
* {@inheritDoc}
*/
public function rowCount(): int
{
return $this->wrapped->rowCount();
}
/**
* {@inheritDoc}
*/
public function columnCount(): int
{
return $this->wrapped->columnCount();
}
/**
* {@inheritDoc}
*/
public function free(): void
{
$this->wrapped->free();
}
}

View file

@ -1,58 +0,0 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\doctrine\oci8;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\ParameterType;
class statement implements DriverStatement
{
/**
* @var DriverStatement
*/
private $wrapped;
/**
* @param DriverStatement $wrapped
*/
public function __construct(DriverStatement $wrapped)
{
$this->wrapped = $wrapped;
}
/**
* {@inheritDoc}
*/
public function bindValue($param, $value, $type = ParameterType::STRING): bool
{
return $this->wrapped->bindValue($param, $value, $type);
}
/**
* {@inheritDoc}
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool
{
return $this->wrapped->bindParam($param, $variable, $type, $length);
}
/**
* {@inheritDoc}
*/
public function execute($params = null): DriverResult
{
return new result($this->wrapped->execute($params));
}
}

View file

@ -0,0 +1,31 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\mysql;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
/**
* MySQL Doctrine driver middleware.
* Makes use of phpBB's MySQL specific platform.
*/
class driver extends AbstractDriverMiddleware
{
/**
* {@inheritDoc}
*/
public function createDatabasePlatformForVersion($version)
{
return new platform();
}
}

View file

@ -0,0 +1,29 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\mysql;
use Doctrine\DBAL\Driver;
use phpbb\db\middleware\mysql\driver as mysql_driver;
/**
* MySQL Doctrine middleware.
* Makes use of phpBB's MySQL specific platform.
*/
class middleware implements Driver\Middleware
{
public function wrap(Driver $driver): Driver
{
return new mysql_driver($driver);
}
}

View file

@ -11,7 +11,7 @@
*
*/
namespace phpbb\db\doctrine;
namespace phpbb\db\middleware\mysql;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\TableDiff;
@ -23,7 +23,7 @@ use Doctrine\DBAL\Schema\TableDiff;
* If it's indexed as primary key, it should be declared as NOT NULL
* because MySQL primary key columns cannot be NULL.
*/
class mysql_platform extends AbstractMySQLPlatform
class platform extends AbstractMySQLPlatform
{
/**
* {@inheritDoc}

View file

@ -0,0 +1,41 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\oracle;
use Doctrine\DBAL\Connection as DoctrineConnection;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* Oracle Doctrine driver middleware.
* Makes use of phpBB's Oracle specific platform.
*/
class driver extends AbstractDriverMiddleware
{
/**
* {@inheritDoc}
*/
public function getSchemaManager(DoctrineConnection $conn, AbstractPlatform $platform)
{
return new schema_manager($conn, $platform);
}
/**
* {@inheritDoc}
*/
public function createDatabasePlatformForVersion($version)
{
return new platform();
}
}

View file

@ -0,0 +1,29 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\oracle;
use Doctrine\DBAL\Driver;
use phpbb\db\middleware\oracle\driver as oracle_driver;
/**
* Oracle Doctrine middleware.
* Makes use of phpBB's Oracle specific platform.
*/
class middleware implements Driver\Middleware
{
public function wrap(Driver $driver): Driver
{
return new oracle_driver($driver);
}
}

View file

@ -11,7 +11,7 @@
*
*/
namespace phpbb\db\doctrine;
namespace phpbb\db\middleware\oracle;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Schema\Identifier;
@ -21,7 +21,7 @@ use Doctrine\DBAL\Schema\Table;
/**
* Oracle specific schema restrictions for BC.
*/
class oracle_platform extends OraclePlatform
class platform extends OraclePlatform
{
/**
* {@inheritDoc}

View file

@ -11,7 +11,7 @@
*
*/
namespace phpbb\db\doctrine\oci8;
namespace phpbb\db\middleware\oracle;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;

View file

@ -0,0 +1,31 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\postgresql;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
/**
* PostgreSQL Doctrine driver middleware.
* Makes use of phpBB's PostgreSQL specific platform.
*/
class driver extends AbstractDriverMiddleware
{
/**
* {@inheritDoc}
*/
public function createDatabasePlatformForVersion($version)
{
return new platform();
}
}

View file

@ -0,0 +1,29 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\postgresql;
use Doctrine\DBAL\Driver;
use phpbb\db\middleware\postgresql\driver as postgresql_driver;
/**
* PostgreSQL Doctrine middleware.
* Makes use of phpBB's PostgreSQL specific platform.
*/
class middleware implements Driver\Middleware
{
public function wrap(Driver $driver): Driver
{
return new postgresql_driver($driver);
}
}

View file

@ -11,7 +11,7 @@
*
*/
namespace phpbb\db\doctrine;
namespace phpbb\db\middleware\postgresql;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
@ -31,7 +31,7 @@ use Doctrine\DBAL\Types\Type;
* to stay compatible with the existing DB we have to change its
* naming and not ours.
*/
class postgresql_platform extends PostgreSQLPlatform
class platform extends PostgreSQLPlatform
{
/**
* {@inheritdoc}

View file

@ -0,0 +1,31 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\sqlsrv;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
/**
* Microsoft SQL server Doctrine driver middleware.
* Makes use of phpBB's SQL Server specific platform.
*/
class driver extends AbstractDriverMiddleware
{
/**
* {@inheritDoc}
*/
public function createDatabasePlatformForVersion($version)
{
return new platform();
}
}

View file

@ -0,0 +1,29 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\middleware\sqlsrv;
use Doctrine\DBAL\Driver;
use phpbb\db\middleware\sqlsrv\driver as sqlsrv_driver;
/**
* Microsoft SQL server Doctrine middleware.
* Makes use of phpBB's SQL Server specific platform.
*/
class middleware implements Driver\Middleware
{
public function wrap(Driver $driver): Driver
{
return new sqlsrv_driver($driver);
}
}

View file

@ -11,7 +11,7 @@
*
*/
namespace phpbb\db\doctrine;
namespace phpbb\db\middleware\sqlsrv;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\Identifier;
@ -20,7 +20,7 @@ use Doctrine\DBAL\Schema\TableDiff;
/**
* SQLServer specific schema restrictions for BC.
*/
class sqlsrv_platform extends SQLServerPlatform
class platform extends SQLServerPlatform
{
/**
* {@inheritDoc}

View file

@ -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;
}
}
/**

View file

@ -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();
}

View file

@ -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;

View file

@ -1,22 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
>
<coverage>
<include>
<directory suffix=".php">./phpBB/includes/</directory>
<directory suffix=".php">./phpBB/phpbb/</directory>
</include>
</coverage>
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">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">./tests</directory>
@ -35,4 +26,10 @@
<group>slow</group>
</exclude>
</groups>
<source>
<include>
<directory suffix=".php">./phpBB/includes/</directory>
<directory suffix=".php">./phpBB/phpbb/</directory>
</include>
</source>
</phpunit>

View file

@ -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),

View file

@ -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(

View file

@ -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')),

View file

@ -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',

View file

@ -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,

View file

@ -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 [
[

View file

@ -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(

View file

@ -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 [
[

View file

@ -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';

View file

@ -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;

View file

@ -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;

View file

@ -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();
}

View file

@ -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(

View file

@ -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);
});

View file

@ -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()),

View file

@ -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

View file

@ -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')

View file

@ -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')

View file

@ -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;

View file

@ -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

View file

@ -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())

View file

@ -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;

View file

@ -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,

View file

@ -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(

View file

@ -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(

View file

@ -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

View file

@ -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(

View file

@ -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(

View file

@ -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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp; 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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp; 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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp; 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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp; 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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp; 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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;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&amp;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&amp;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&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;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&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp; 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'),

View file

@ -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)),

View file

@ -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/';
}

View file

@ -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()
{

View file

@ -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/';
}

View file

@ -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')

View file

@ -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);

View file

@ -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));
}
}

View file

@ -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);
}
}
}

View file

@ -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(

View file

@ -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');

View file

@ -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

View file

@ -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 [
[

View file

@ -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),

View file

@ -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'))),

View file

@ -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(

View file

@ -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());
}

View file

@ -1,7 +1,7 @@
<?php
// phpBB 3.1.x auto-generated configuration file
// Do not change anything in this file!
$dbms = 'mysql';
$dbms = ''; // Set this to empty value to avoid failed connection attempt as this will produce unwanted error/exception
$dbhost = '127.0.0.1';
$dbport = '';
$dbname = 'phpbb';

View file

@ -19,6 +19,9 @@ class phpbb_email_parsing_test extends phpbb_test_case
/** @var \ReflectionProperty */
protected $reflection_template_property;
/** @var \phpbb\messenger\method\email */
protected $email;
protected function setUp(): void
{
global $phpbb_container, $config, $phpbb_root_path, $phpEx, $request, $user;
@ -146,7 +149,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
$this->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'),

View file

@ -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

View file

@ -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(

View file

@ -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(

View file

@ -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(

View file

@ -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(

View file

@ -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

View file

@ -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)),

View file

@ -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()),

View file

@ -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(

View file

@ -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(

View file

@ -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'),

View file

@ -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'),

View file

@ -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'];

Some files were not shown because too many files have changed in this diff Show more