This commit is contained in:
rxu 2025-07-21 14:57:58 -05:00 committed by GitHub
commit 05a5f9ea84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
248 changed files with 1628 additions and 1532 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

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

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

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

View file

@ -21,7 +21,7 @@ class phpbb_filesystem_helper_is_absolute_test extends phpbb_test_case
parent::setUp();
}
static public function is_absolute_data()
public static function is_absolute_data()
{
// Empty
yield ['', false];

View file

@ -30,7 +30,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case
parent::setUp();
}
public function realpath_resolve_absolute_without_symlinks_data()
public static function realpath_resolve_absolute_without_symlinks_data()
{
// Constant data
yield [__DIR__, __DIR__];
@ -42,7 +42,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case
yield [__FILE__ . '../', false];
}
public function realpath_resolve_relative_without_symlinks_data()
public static function realpath_resolve_relative_without_symlinks_data()
{
if (!function_exists('getcwd'))
{

View file

@ -23,7 +23,7 @@ class phpbb_filesystem_is_absolute_test extends phpbb_test_case
$this->filesystem = new \phpbb\filesystem\filesystem();
}
static public function is_absolute_data()
public static function is_absolute_data()
{
return array(
// Empty

View file

@ -34,7 +34,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case
$this->filesystem = new \phpbb\filesystem\filesystem();
}
public function realpath_resolve_absolute_without_symlinks_data()
public static function realpath_resolve_absolute_without_symlinks_data()
{
return array(
// Constant data
@ -49,7 +49,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case
);
}
public function realpath_resolve_relative_without_symlinks_data()
public static function realpath_resolve_relative_without_symlinks_data()
{
if (!function_exists('getcwd'))
{

View file

@ -65,7 +65,7 @@ class phpbb_functional_acp_bbcodes_test extends phpbb_functional_test_case
$this->assertStringContainsString($error, $text);
}
public function get_bbcode_error_tests()
public static function get_bbcode_error_tests()
{
return [
[

View file

@ -25,7 +25,7 @@ class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_te
return 'adm/index.php?i=groups&mode=manage&action=edit';
}
public function acp_group_test_data()
public static function acp_group_test_data()
{
return array(
'both_yes' => array(

View file

@ -48,7 +48,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
$this->assertStringContainsString($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text());
}
public function permissions_data()
public static function permissions_data()
{
return array(
// description

View file

@ -25,7 +25,7 @@ class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case
$this->add_lang('acp/profile');
}
public function data_add_profile_field()
public static function data_add_profile_field()
{
return array(
array('profilefields.type.bool',

View file

@ -23,7 +23,7 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av
return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5';
}
public function avatar_acp_groups_data()
public static function avatar_acp_groups_data()
{
return array(
// Correct Gravatar

View file

@ -23,7 +23,7 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava
return 'adm/index.php?i=acp_users&u=2&mode=avatar';
}
public function avatar_acp_users_data()
public static function avatar_acp_users_data()
{
return array(
// Gravatar with incorrect email

View file

@ -22,7 +22,7 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av
return 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5';
}
public function avatar_ucp_groups_data()
public static function avatar_ucp_groups_data()
{
return array(
// Gravatar with incorrect email

View file

@ -23,7 +23,7 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava
return 'ucp.php?i=ucp_profile&mode=avatar';
}
public function avatar_ucp_groups_data()
public static function avatar_ucp_groups_data()
{
return array(
// Gravatar with correct settings

View file

@ -57,7 +57,7 @@ abstract class phpbb_functional_common_groups_test_case extends phpbb_functional
$this->assertStringContainsString($this->lang('CONFIG_UPDATED'), $crawler->text());
}
public function groups_manage_test_data()
public static function groups_manage_test_data()
{
return array(
array('', 'GROUP_UPDATED'),

View file

@ -229,6 +229,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
if (!empty($data['forums']))
{
array_walk($data['forums'], function(&$value, $key)
{
$value = $this->db->sql_escape($value);
}
);
$sql = 'SELECT *
FROM phpbb_forums
WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']);
@ -245,6 +250,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
if (!empty($data['topics']))
{
array_walk($data['topics'], function(&$value, $key)
{
$value = $this->db->sql_escape($value);
}
);
$sql = 'SELECT *
FROM phpbb_topics
WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']);
@ -262,6 +272,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
$post_ids = array();
if (!empty($data['posts']))
{
array_walk($data['posts'], function(&$value, $key)
{
$value = $this->db->sql_escape($value);
}
);
$sql = 'SELECT *
FROM phpbb_posts
WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']);
@ -276,7 +291,7 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
}
$this->db->sql_freeresult($result);
if (isset($data['attachments']))
if (isset($data['attachments']) && !empty($post_ids))
{
$sql = 'SELECT *
FROM phpbb_attachments

View file

@ -255,6 +255,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$form = $crawler->selectButton('Submit')->form();
$form['minimum_stability']->select('dev');
$form['enable_packagist']->select('1');
$form['repositories'] = 'https://satis.phpbb.com/';
$crawler = self::submit($form);
$this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('div[class="successbox"] > p')->text());

View file

@ -23,16 +23,10 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
protected function setUp(): void
{
parent::setUp();
$this->purge_cache();
}
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$this->backupStaticAttributesExcludeList += [
$this->setBackupStaticPropertiesExcludeList([
'phpbb_functional_feed_test' => ['init_values'],
];
]);
$this->purge_cache();
}

View file

@ -34,7 +34,7 @@ class phpbb_functional_forum_password_test extends phpbb_functional_test_case
$crawler = self::submit($form);
}
public function data_enter_forum_with_password()
public static function data_enter_forum_with_password()
{
return array(
array('foowrong', 'WRONG_PASSWORD'),

View file

@ -16,6 +16,8 @@
*/
class phpbb_functional_jumpbox_test extends phpbb_functional_test_case
{
protected $crawler;
public function test_jumpbox()
{
$this->login();

View file

@ -72,7 +72,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case
return $post;
}
public function mcp_view_forum_actions_data()
public static function mcp_view_forum_actions_data()
{
// action, success message, require_confirmation
return [
@ -181,7 +181,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case
$this->assertStringContainsString($this->lang('TOPICS_DELETED_SUCCESS'), $crawler->filter('#message p')->text());
}
public function mcp_view_topic_actions_data()
public static function mcp_view_topic_actions_data()
{
// action, success message, require_confirmation
return [

View file

@ -16,7 +16,7 @@
*/
class functional_permission_roles_test extends phpbb_functional_test_case
{
public function data_permission_roles()
public static function data_permission_roles()
{
return array(
array(

View file

@ -60,7 +60,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
}
}
public function get_urls()
public static function get_urls()
{
return array(
array('posting.php?mode=reply&t=1'),

View file

@ -301,7 +301,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
);
}
public function nonexistent_post_id_data()
public static function nonexistent_post_id_data()
{
$nonexistent_post_id = 999999; // Random value
return [

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