diff options
Diffstat (limited to 'tests')
111 files changed, 479 insertions, 471 deletions
diff --git a/tests/acp_board/auth_provider/valid.php b/tests/acp_board/auth_provider/valid.php index 42b14cb0af..cfc3c24833 100644 --- a/tests/acp_board/auth_provider/valid.php +++ b/tests/acp_board/auth_provider/valid.php @@ -7,7 +7,7 @@ * */ -class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base +class phpbb_auth_provider_acp_board_valid extends \phpbb\auth\provider\base { public function login($username, $password) { diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php index 0ca6ef763e..e135a1f002 100644 --- a/tests/auth/provider_apache_test.php +++ b/tests/auth/provider_apache_test.php @@ -22,11 +22,11 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case global $phpbb_root_path, $phpEx; $db = $this->new_dbal(); - $config = new phpbb_config(array()); - $this->request = $this->getMock('phpbb_request'); - $this->user = $this->getMock('phpbb_user'); + $config = new \phpbb\config\config(array()); + $this->request = $this->getMock('\phpbb\request\request'); + $this->user = $this->getMock('\phpbb\user'); - $this->provider = new phpbb_auth_provider_apache($db, $config, $this->request, $this->user, $phpbb_root_path, $phpEx); + $this->provider = new \phpbb\auth\provider\apache($db, $config, $this->request, $this->user, $phpbb_root_path, $phpEx); } public function getDataSet() @@ -43,7 +43,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $this->request->expects($this->once()) ->method('is_set') ->with('PHP_AUTH_USER', - phpbb_request_interface::SERVER) + \phpbb\request\request_interface::SERVER) ->will($this->returnValue(true)); $this->request->expects($this->once()) ->method('server') @@ -61,7 +61,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $this->request->expects($this->once()) ->method('is_set') ->with('PHP_AUTH_USER', - phpbb_request_interface::SERVER) + \phpbb\request\request_interface::SERVER) ->will($this->returnValue(true)); $this->request->expects($this->at(1)) ->method('server') @@ -93,7 +93,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $this->request->expects($this->once()) ->method('is_set') ->with('PHP_AUTH_USER', - phpbb_request_interface::SERVER) + \phpbb\request\request_interface::SERVER) ->will($this->returnValue(true)); $this->request->expects($this->at(1)) ->method('server') @@ -194,7 +194,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $this->request->expects($this->once()) ->method('is_set') ->with('PHP_AUTH_USER', - phpbb_request_interface::SERVER) + \phpbb\request\request_interface::SERVER) ->will($this->returnValue(true)); $this->request->expects($this->once()) ->method('server') diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php index d876683f84..140a28cd3d 100644 --- a/tests/auth/provider_db_test.php +++ b/tests/auth/provider_db_test.php @@ -21,14 +21,14 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case global $phpbb_root_path, $phpEx; $db = $this->new_dbal(); - $config = new phpbb_config(array( + $config = new \phpbb\config\config(array( 'ip_login_limit_max' => 0, 'ip_login_limit_use_forwarded' => 0, 'max_login_attempts' => 0, )); - $request = $this->getMock('phpbb_request'); - $user = $this->getMock('phpbb_user'); - $provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx); + $request = $this->getMock('\phpbb\request\request'); + $user = $this->getMock('\phpbb\user'); + $provider = new \phpbb\auth\provider\db($db, $config, $request, $user, $phpbb_root_path, $phpEx); $expected = array( 'status' => LOGIN_SUCCESS, diff --git a/tests/avatar/driver/barfoo.php b/tests/avatar/driver/barfoo.php index 0b701a4d70..11c100db36 100644 --- a/tests/avatar/driver/barfoo.php +++ b/tests/avatar/driver/barfoo.php @@ -1,6 +1,8 @@ <?php
-class phpbb_avatar_driver_barfoo extends phpbb_avatar_driver
+namespace phpbb\avatar\driver;
+
+class barfoo extends \phpbb\avatar\driver\driver
{
public function get_data($row)
{
diff --git a/tests/avatar/driver/foobar.php b/tests/avatar/driver/foobar.php index 995f35818b..a1e7bdf7cc 100644 --- a/tests/avatar/driver/foobar.php +++ b/tests/avatar/driver/foobar.php @@ -1,6 +1,8 @@ <?php
-class phpbb_avatar_driver_foobar extends phpbb_avatar_driver
+namespace phpbb\avatar\driver;
+
+class foobar extends \phpbb\avatar\driver\driver
{
public function get_data($row)
{
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 4ebe79c9cd..ba1fb04b33 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -22,17 +22,17 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase ->will($this->returnArgument(0)); // Prepare dependencies for avatar manager and driver - $config = new phpbb_config(array()); - $request = $this->getMock('phpbb_request'); - $cache = $this->getMock('phpbb_cache_driver_interface'); + $config = new \phpbb\config\config(array()); + $request = $this->getMock('\phpbb\request\request'); + $cache = $this->getMock('\phpbb\cache\driver\driver_interface'); // $this->avatar_foobar will be needed later on - $this->avatar_foobar = $this->getMock('phpbb_avatar_driver_foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache)); + $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache)); $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->getMock('phpbb_avatar_driver_barfoo', array('get_name')); + $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name')); $this->avatar_barfoo->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.barfoo')); @@ -40,7 +40,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase foreach ($this->avatar_drivers() as $driver) { - $cur_avatar = $this->getMock('phpbb_avatar_driver_' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache)); + $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache)); $cur_avatar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.' . $driver)); @@ -52,7 +52,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase $config['allow_avatar_' . get_class($this->avatar_barfoo)] = false; // Set up avatar manager - $this->manager = new phpbb_avatar_manager($config, $avatar_drivers, $this->phpbb_container); + $this->manager = new \phpbb\avatar\manager($config, $avatar_drivers, $this->phpbb_container); } protected function avatar_drivers() @@ -203,7 +203,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase { $cleaned_row = array(); - $cleaned_row = phpbb_avatar_manager::clean_row($input); + $cleaned_row = \phpbb\avatar\manager::clean_row($input); foreach ($output as $key => $null) { $this->assertArrayHasKey($key, $cleaned_row); @@ -222,7 +222,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase public function test_localize_errors() { - $user = $this->getMock('phpbb_user'); + $user = $this->getMock('\phpbb\user'); $lang_array = array( array('FOOBAR_OFF', 'foobar_off'), array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'), diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 68cbb64c03..43efecce3b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -16,11 +16,11 @@ $table_prefix = 'phpbb_'; require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx; -$phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php"); +$phpbb_class_loader_mock = new \phpbb\class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php"); $phpbb_class_loader_mock->register(); -$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php"); +$phpbb_class_loader_ext = new \phpbb\class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php"); $phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'phpbb/', "php"); +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', "php"); $phpbb_class_loader->register(); require_once 'test_framework/phpbb_test_case_helpers.php'; diff --git a/tests/cache/apc_driver_test.php b/tests/cache/apc_driver_test.php index 3380762878..51f3ac24b6 100644 --- a/tests/cache/apc_driver_test.php +++ b/tests/cache/apc_driver_test.php @@ -30,7 +30,7 @@ class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case self::markTestSkipped('APC extension is not loaded'); } - $php_ini = new phpbb_php_ini; + $php_ini = new \phpbb\php\ini; if (!$php_ini->get_bool('apc.enabled')) { @@ -47,7 +47,7 @@ class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case { parent::setUp(); - $this->driver = new phpbb_cache_driver_apc; + $this->driver = new \phpbb\cache\driver\apc; $this->driver->purge(); } } diff --git a/tests/cache/common_test_case.php b/tests/cache/common_test_case.php index a5bc2bfda9..3fe10c63e1 100644 --- a/tests/cache/common_test_case.php +++ b/tests/cache/common_test_case.php @@ -65,9 +65,9 @@ abstract class phpbb_cache_common_test_case extends phpbb_database_test_case public function test_cache_sql() { global $db, $cache, $phpbb_root_path, $phpEx; - $config = new phpbb_config(array()); + $config = new phpbb\config\config(array()); $db = $this->new_dbal(); - $cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx); + $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); $sql = "SELECT * FROM phpbb_config WHERE config_name = 'foo'"; diff --git a/tests/cache/file_driver_test.php b/tests/cache/file_driver_test.php index 745c6bb081..c0843e8ed9 100644 --- a/tests/cache/file_driver_test.php +++ b/tests/cache/file_driver_test.php @@ -36,7 +36,7 @@ class phpbb_cache_file_driver_test extends phpbb_cache_common_test_case } $this->create_cache_dir(); - $this->driver = new phpbb_cache_driver_file($this->cache_dir); + $this->driver = new \phpbb\cache\driver\file($this->cache_dir); } protected function tearDown() diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 43a0cc806c..58e57f2b3a 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -20,7 +20,7 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case { parent::setUp(); - $this->driver = new phpbb_cache_driver_null; + $this->driver = new \phpbb\cache\driver\null; } public function test_get_put() @@ -48,9 +48,9 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case public function test_cache_sql() { global $db, $cache, $phpbb_root_path, $phpEx; - $config = new phpbb_config(array()); + $config = new phpbb\config\config(array()); $db = $this->new_dbal(); - $cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx); + $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); $sql = "SELECT * FROM phpbb_config WHERE config_name = 'foo'"; diff --git a/tests/cache/redis_driver_test.php b/tests/cache/redis_driver_test.php index 1308519a18..3d954dc0db 100644 --- a/tests/cache/redis_driver_test.php +++ b/tests/cache/redis_driver_test.php @@ -43,7 +43,7 @@ class phpbb_cache_redis_driver_test extends phpbb_cache_common_test_case { parent::setUp(); - $this->driver = new phpbb_cache_driver_redis(self::$config['host'], self::$config['port']); + $this->driver = new \phpbb\cache\driver\redis(self::$config['host'], self::$config['port']); $this->driver->purge(); } } diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 2b55c1ff8d..eb50ac1ecd 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -30,74 +30,68 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase public function test_resolve_path() { $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/'); + $class_loader = new \phpbb\class_loader('phpbb\\', $prefix . 'phpbb/'); $prefix .= 'phpbb/'; $this->assertEquals( - '', - $class_loader->resolve_path('phpbb_dir'), - 'Class with same name as a directory is unloadable' - ); - - $this->assertEquals( $prefix . 'class_name.php', - $class_loader->resolve_path('phpbb_class_name'), + $class_loader->resolve_path('phpbb\\class_name'), 'Top level class' ); $this->assertEquals( $prefix . 'dir/class_name.php', - $class_loader->resolve_path('phpbb_dir_class_name'), + $class_loader->resolve_path('phpbb\\dir\\class_name'), 'Class in a directory' ); $this->assertEquals( $prefix . 'dir/subdir/class_name.php', - $class_loader->resolve_path('phpbb_dir_subdir_class_name'), + $class_loader->resolve_path('phpbb\\dir\\subdir\\class_name'), 'Class in a sub-directory' ); $this->assertEquals( $prefix . 'dir2/dir2.php', - $class_loader->resolve_path('phpbb_dir2'), - 'Class with name of dir within dir (short class name)' + $class_loader->resolve_path('phpbb\\dir2\\dir2'), + 'Class with name of dir within dir' ); } public function test_resolve_cached() { $cache_map = array( - 'class_loader_phpbb_' => array('phpbb_a_cached_name' => 'a/cached_name'), - 'class_loader_phpbb_ext_' => array('phpbb_ext_foo' => 'foo'), + 'class_loader_phpbb__' => array('phpbb\\a\\cached_name' => 'a/cached_name'), + 'class_loader_phpbb__ext__' => array('phpbb\\ext\\foo' => 'foo'), ); $cache = new phpbb_mock_cache($cache_map); $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/', 'php', $cache); - $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'phpbb/', 'php', $cache); + $class_loader = new \phpbb\class_loader('phpbb\\', $prefix . 'phpbb/', 'php', $cache); + $class_loader_ext = new \phpbb\class_loader('phpbb\\ext\\', $prefix . 'phpbb/', 'php', $cache); $prefix .= 'phpbb/'; $this->assertEquals( $prefix . 'dir/class_name.php', - $class_loader->resolve_path('phpbb_dir_class_name'), + $class_loader->resolve_path('phpbb\\dir\\class_name'), 'Class in a directory' ); - $this->assertFalse($class_loader->resolve_path('phpbb_ext_foo')); - $this->assertFalse($class_loader_ext->resolve_path('phpbb_a_cached_name')); + $this->assertFalse($class_loader->resolve_path('phpbb\\ext\\foo')); + $this->assertFalse($class_loader_ext->resolve_path('phpbb\\a\\cached_name')); $this->assertEquals( $prefix . 'a/cached_name.php', - $class_loader->resolve_path('phpbb_a_cached_name'), + $class_loader->resolve_path('phpbb\\a\\cached_name'), 'Cached class found' ); $this->assertEquals( $prefix . 'foo.php', - $class_loader_ext->resolve_path('phpbb_ext_foo'), + $class_loader_ext->resolve_path('phpbb\\ext\\foo'), 'Cached class found in alternative loader' ); - $cache_map['class_loader_phpbb_']['phpbb_dir_class_name'] = 'dir/class_name'; + $cache_map['class_loader_phpbb__']['phpbb\\dir\\class_name'] = 'dir/class_name'; $cache->check($this, $cache_map); } } diff --git a/tests/class_loader/phpbb/class_name.php b/tests/class_loader/phpbb/class_name.php index e941173cdd..64a3fa646e 100644 --- a/tests/class_loader/phpbb/class_name.php +++ b/tests/class_loader/phpbb/class_name.php @@ -1,6 +1,8 @@ <?php -class phpbb_class_name +namespace phpbb; + +class class_name { } diff --git a/tests/class_loader/phpbb/dir.php b/tests/class_loader/phpbb/dir.php deleted file mode 100644 index 1c8930d8e7..0000000000 --- a/tests/class_loader/phpbb/dir.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class phpbb_dir -{ -} - diff --git a/tests/class_loader/phpbb/dir/class_name.php b/tests/class_loader/phpbb/dir/class_name.php index 0675aa8fc5..1cd39a1181 100644 --- a/tests/class_loader/phpbb/dir/class_name.php +++ b/tests/class_loader/phpbb/dir/class_name.php @@ -1,6 +1,8 @@ <?php -class phpbb_dir_class_name +namespace phpbb\dir; + +class class_name { } diff --git a/tests/class_loader/phpbb/dir/subdir/class_name.php b/tests/class_loader/phpbb/dir/subdir/class_name.php index 7321a609cc..89affbc847 100644 --- a/tests/class_loader/phpbb/dir/subdir/class_name.php +++ b/tests/class_loader/phpbb/dir/subdir/class_name.php @@ -1,6 +1,8 @@ <?php -class phpbb_dir_subdir_class_name +namespace phpbb\dir\subdir; + +class class_name { } diff --git a/tests/class_loader/phpbb/dir2/dir2.php b/tests/class_loader/phpbb/dir2/dir2.php index 01cf4086ff..b273511fcd 100644 --- a/tests/class_loader/phpbb/dir2/dir2.php +++ b/tests/class_loader/phpbb/dir2/dir2.php @@ -1,6 +1,8 @@ <?php -class phpbb_dir2 +namespace phpbb; + +class dir2 { } diff --git a/tests/config/config_test.php b/tests/config/config_test.php index 5845cc4590..5373fcef5f 100644 --- a/tests/config/config_test.php +++ b/tests/config/config_test.php @@ -11,7 +11,7 @@ class phpbb_config_test extends phpbb_test_case { public function test_offset_exists() { - $config = new phpbb_config(array('foo' => 'bar')); + $config = new \phpbb\config\config(array('foo' => 'bar')); $this->assertTrue(isset($config['foo'])); $this->assertFalse(isset($config['foobar'])); @@ -19,19 +19,19 @@ class phpbb_config_test extends phpbb_test_case public function test_offset_get() { - $config = new phpbb_config(array('foo' => 'bar')); + $config = new \phpbb\config\config(array('foo' => 'bar')); $this->assertEquals('bar', $config['foo']); } public function test_offset_get_missing() { - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $this->assertEquals('', $config['foo']); } public function test_offset_set() { - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $config['foo'] = 'x'; $this->assertEquals('x', $config['foo']); } @@ -39,20 +39,20 @@ class phpbb_config_test extends phpbb_test_case public function test_offset_unset_fails() { $this->setExpectedTriggerError(E_USER_ERROR); - $config = new phpbb_config(array('foo' => 'x')); + $config = new \phpbb\config\config(array('foo' => 'x')); unset($config['foo']); } public function test_count() { - $config = new phpbb_config(array('foo' => 'bar')); + $config = new \phpbb\config\config(array('foo' => 'bar')); $this->assertEquals(1, count($config)); } public function test_iterate() { $vars = array('foo' => '23', 'bar' => '42'); - $config = new phpbb_config($vars); + $config = new \phpbb\config\config($vars); $count = 0; foreach ($config as $key => $value) @@ -68,42 +68,42 @@ class phpbb_config_test extends phpbb_test_case public function test_set_overwrite() { - $config = new phpbb_config(array('foo' => 'x')); + $config = new \phpbb\config\config(array('foo' => 'x')); $config->set('foo', 'bar'); $this->assertEquals('bar', $config['foo']); } public function test_set_new() { - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $config->set('foo', 'bar'); $this->assertEquals('bar', $config['foo']); } public function test_set_atomic_overwrite() { - $config = new phpbb_config(array('foo' => 'bar')); + $config = new \phpbb\config\config(array('foo' => 'bar')); $this->assertTrue($config->set_atomic('foo', 'bar', '23')); $this->assertEquals('23', $config['foo']); } public function test_set_atomic_new() { - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $this->assertTrue($config->set_atomic('foo', false, '23')); $this->assertEquals('23', $config['foo']); } public function test_set_atomic_failure() { - $config = new phpbb_config(array('foo' => 'bar')); + $config = new \phpbb\config\config(array('foo' => 'bar')); $this->assertFalse($config->set_atomic('foo', 'wrong', '23')); $this->assertEquals('bar', $config['foo']); } public function test_increment() { - $config = new phpbb_config(array('foo' => '23')); + $config = new \phpbb\config\config(array('foo' => '23')); $config->increment('foo', 3); $this->assertEquals(26, $config['foo']); $config->increment('foo', 1); @@ -112,7 +112,7 @@ class phpbb_config_test extends phpbb_test_case public function test_delete() { - $config = new phpbb_config(array('foo' => 'bar')); + $config = new \phpbb\config\config(array('foo' => 'bar')); $config->delete('foo'); $this->assertFalse(isset($config['foo'])); diff --git a/tests/config/db_test.php b/tests/config/db_test.php index 0b8f73d53a..dd1c88f707 100644 --- a/tests/config/db_test.php +++ b/tests/config/db_test.php @@ -24,7 +24,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->cache = new phpbb_mock_cache; $this->db = $this->new_dbal(); - $this->config = new phpbb_config_db($this->db, $this->cache, 'phpbb_config'); + $this->config = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); } public function test_load_config() @@ -36,7 +36,7 @@ class phpbb_config_db_test extends phpbb_database_test_case public function test_load_cached() { $cache = new phpbb_mock_cache(array('config' => array('x' => 'y'))); - $this->config = new phpbb_config_db($this->db, $cache, 'phpbb_config'); + $this->config = new \phpbb\config\db($this->db, $cache, 'phpbb_config'); $this->assertTrue(!isset($this->config['foo'])); $this->assertEquals('42', $this->config['bar']); @@ -49,7 +49,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->config['foo'] = 'x'; // temporary set $this->assertEquals('x', $this->config['foo']); - $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config'); + $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); $this->assertEquals('23', $config2['foo']); } @@ -59,7 +59,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->assertEquals('17', $this->config['foo']); // re-read config and populate cache - $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config'); + $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); $this->cache->checkVar($this, 'config', array('foo' => '17')); } @@ -68,7 +68,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->config->set('bar', '17', false); // re-read config and populate cache - $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config'); + $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); $this->cache->checkVar($this, 'config', array('foo' => '23')); } @@ -78,7 +78,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->assertEquals('5', $this->config['foobar']); // re-read config and populate cache - $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config'); + $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); $this->cache->checkVar($this, 'config', array('foo' => '23', 'foobar' => '5')); } @@ -88,7 +88,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->assertEquals('5', $this->config['foobar']); // re-read config and populate cache - $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config'); + $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); $this->cache->checkVar($this, 'config', array('foo' => '23')); } @@ -133,7 +133,7 @@ class phpbb_config_db_test extends phpbb_database_test_case // re-read config and populate cache $cache2 = new phpbb_mock_cache; - $config2 = new phpbb_config_db($this->db, $cache2, 'phpbb_config'); + $config2 = new \phpbb\config\db($this->db, $cache2, 'phpbb_config'); $cache2->checkVarUnset($this, 'foo'); $this->assertFalse(isset($config2['foo'])); } @@ -145,7 +145,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->config->delete('bar'); $this->cache->checkVarUnset($this, 'bar'); $this->assertFalse(isset($this->config['bar'])); - + $this->config->set('bar', 'new bar', false); $this->assertEquals('new bar', $this->config['bar']); } @@ -157,7 +157,7 @@ class phpbb_config_db_test extends phpbb_database_test_case $this->config->delete('foo'); $this->cache->checkVarUnset($this, 'foo'); $this->assertFalse(isset($this->config['foo'])); - + $this->config->set('foo', 'new foo', true); $this->assertEquals('new foo', $this->config['foo']); } diff --git a/tests/config/db_text_test.php b/tests/config/db_text_test.php index 4818bba8c9..354c0efacf 100644 --- a/tests/config/db_text_test.php +++ b/tests/config/db_text_test.php @@ -22,7 +22,7 @@ class phpbb_config_db_text_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->config_text = new phpbb_config_db_text($this->db, 'phpbb_config_text'); + $this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text'); } public function test_get() diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index 6234aac9ad..b2bdcb3b49 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -267,21 +267,21 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $config['search_type'] = 'phpbb_mock_search'; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - set_config_count(null, null, null, new phpbb_config(array('num_posts' => 3, 'num_topics' => 1))); + set_config_count(null, null, null, new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1))); // Create auth mock - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap(array( array('m_approve', 1, true), ))); - $user = $this->getMock('phpbb_user'); + $user = $this->getMock('\phpbb\user'); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); - $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason); diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index aa44fa4013..22f210c406 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -125,13 +125,13 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); - $user = $this->getMock('phpbb_user'); - $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $user = $this->getMock('\phpbb\user'); + $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 0f019ffa50..9488a8c0b3 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -125,13 +125,13 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); - $user = $this->getMock('phpbb_user'); - $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $user = $this->getMock('\phpbb\user'); + $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index cc6c10c649..111e735650 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -72,13 +72,13 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); - $user = $this->getMock('phpbb_user'); - $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $user = $this->getMock('\phpbb\user'); + $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index 81abf56c75..f81b83ff86 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -119,9 +119,9 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('phpbb_auth'); - $user = $this->getMock('phpbb_user'); - $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $auth = $this->getMock('\phpbb\auth\auth'); + $user = $this->getMock('\phpbb\user'); + $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest); diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 6b5d884a2b..92b1253a15 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -83,9 +83,9 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('phpbb_auth'); - $user = $this->getMock('phpbb_user'); - $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $auth = $this->getMock('\phpbb\auth\auth'); + $user = $this->getMock('\phpbb\user'); + $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all); diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index dfc4f80469..9445ea53d4 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -31,7 +31,7 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { - $provider = new phpbb_controller_provider; + $provider = new \phpbb\controller\provider; $routes = $provider ->import_paths_from_finder($this->extension_manager->get_finder()) ->find('./tests/controller/'); @@ -62,7 +62,7 @@ class phpbb_controller_controller_test extends phpbb_test_case include(__DIR__.'/phpbb/controller/foo.php'); } - $resolver = new phpbb_controller_resolver(new phpbb_user, $container); + $resolver = new \phpbb\controller\resolver(new \phpbb\user, $container); $symfony_request = new Request(); $symfony_request->attributes->set('_controller', 'foo.controller:handle'); diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index da90947bb5..9a75015c9f 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -48,12 +48,12 @@ class phpbb_controller_helper_url_test extends phpbb_test_case global $phpbb_dispatcher, $phpbb_root_path, $phpEx; $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = $this->getMock('phpbb_user'); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); + $this->user = $this->getMock('\phpbb\user'); + $this->template = new \phpbb\template\twig\twig($phpbb_root_path, $phpEx, $config, $this->user, new \phpbb\template\context()); // We don't use mod_rewrite in these tests - $config = new phpbb_config(array('enable_mod_rewrite' => '0')); - $helper = new phpbb_controller_helper($this->template, $this->user, $config, '', 'php'); + $config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); } @@ -93,11 +93,11 @@ class phpbb_controller_helper_url_test extends phpbb_test_case global $phpbb_dispatcher, $phpbb_root_path, $phpEx; $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = $this->getMock('phpbb_user'); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); + $this->user = $this->getMock('\phpbb\user'); + $this->template = new \phpbb\template\twig\twig($phpbb_root_path, $phpEx, $config, $this->user, new \phpbb\template\context()); - $config = new phpbb_config(array('enable_mod_rewrite' => '1')); - $helper = new phpbb_controller_helper($this->template, $this->user, $config, '', 'php'); + $config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); + $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); } } diff --git a/tests/cron/ext/testext/cron/dummy_task.php b/tests/cron/ext/testext/cron/dummy_task.php index 3e81db1895..8cdb6b09d5 100644 --- a/tests/cron/ext/testext/cron/dummy_task.php +++ b/tests/cron/ext/testext/cron/dummy_task.php @@ -7,7 +7,7 @@ * */ -class phpbb_ext_testext_cron_dummy_task extends phpbb_cron_task_base +class phpbb_ext_testext_cron_dummy_task extends \phpbb\cron\task\base { static public $was_run = 0; diff --git a/tests/cron/includes/cron/task/core/dummy_task.php b/tests/cron/includes/cron/task/core/dummy_task.php index c94455603f..c34684701b 100644 --- a/tests/cron/includes/cron/task/core/dummy_task.php +++ b/tests/cron/includes/cron/task/core/dummy_task.php @@ -7,7 +7,7 @@ * */ -class phpbb_cron_task_core_dummy_task extends phpbb_cron_task_base +class phpbb_cron_task_core_dummy_task extends \phpbb\cron\task\base { static public $was_run = 0; diff --git a/tests/cron/includes/cron/task/core/second_dummy_task.php b/tests/cron/includes/cron/task/core/second_dummy_task.php index 77ef6f70ed..1b212ab05d 100644 --- a/tests/cron/includes/cron/task/core/second_dummy_task.php +++ b/tests/cron/includes/cron/task/core/second_dummy_task.php @@ -7,7 +7,7 @@ * */ -class phpbb_cron_task_core_second_dummy_task extends phpbb_cron_task_base +class phpbb_cron_task_core_second_dummy_task extends \phpbb\cron\task\base { static public $was_run = 0; diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index 3c541be2a6..713f44c1e2 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -29,7 +29,7 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase public function test_manager_finds_shipped_task_by_name() { $task = $this->manager->find_task($this->task_name); - $this->assertInstanceOf('phpbb_cron_task_wrapper', $task); + $this->assertInstanceOf('\phpbb\cron\task\wrapper', $task); $this->assertEquals($this->task_name, $task->get_name()); } @@ -42,7 +42,7 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase public function test_manager_finds_one_ready_task() { $task = $this->manager->find_one_ready_task(); - $this->assertInstanceOf('phpbb_cron_task_wrapper', $task); + $this->assertInstanceOf('\phpbb\cron\task\wrapper', $task); } public function test_manager_finds_only_ready_tasks() @@ -71,6 +71,6 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase { global $phpbb_root_path, $phpEx; - return new phpbb_cron_manager($tasks, $phpbb_root_path, $phpEx); + return new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); } } diff --git a/tests/cron/tasks/simple_not_runnable.php b/tests/cron/tasks/simple_not_runnable.php index 56d484eacd..4951b5b4b9 100644 --- a/tests/cron/tasks/simple_not_runnable.php +++ b/tests/cron/tasks/simple_not_runnable.php @@ -1,6 +1,6 @@ <?php -class phpbb_cron_task_core_simple_not_runnable extends phpbb_cron_task_base +class phpbb_cron_task_core_simple_not_runnable extends \phpbb\cron\task\base { public function get_name() { diff --git a/tests/cron/tasks/simple_ready.php b/tests/cron/tasks/simple_ready.php index 8aa0507406..245d9ba738 100644 --- a/tests/cron/tasks/simple_ready.php +++ b/tests/cron/tasks/simple_ready.php @@ -1,6 +1,6 @@ <?php -class phpbb_cron_task_core_simple_ready extends phpbb_cron_task_base +class phpbb_cron_task_core_simple_ready extends \phpbb\cron\task\base { public function get_name() { diff --git a/tests/cron/tasks/simple_should_not_run.php b/tests/cron/tasks/simple_should_not_run.php index 58f6df2616..7bd9df31b6 100644 --- a/tests/cron/tasks/simple_should_not_run.php +++ b/tests/cron/tasks/simple_should_not_run.php @@ -1,6 +1,6 @@ <?php -class phpbb_cron_task_core_simple_should_not_run extends phpbb_cron_task_base +class phpbb_cron_task_core_simple_should_not_run extends \phpbb\cron\task\base { public function get_name() { diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 2d97672878..34f7f9ae44 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -35,7 +35,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case { global $user; - $user = new phpbb_user(); + $user = new \phpbb\user(); $user->timezone = new DateTimeZone($timezone); $user->lang['datetime'] = array( 'TODAY' => 'Today', diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index 077bfad933..2196292e83 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -26,7 +26,7 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new phpbb_db_tools($this->db); + $this->tools = new \phpbb\db\tools($this->db); $this->table_data = array( 'COLUMNS' => array( diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index 7bdbc696e7..e25335165a 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -26,7 +26,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new phpbb_db_tools($this->db); + $this->tools = new \phpbb\db\tools($this->db); $this->table_data = array( 'COLUMNS' => array( @@ -254,7 +254,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_peform_schema_changes_drop_tables() { - $db_tools = $this->getMock('phpbb_db_tools', array( + $db_tools = $this->getMock('\phpbb\db\tools', array( 'sql_table_exists', 'sql_table_drop', ), array(&$this->db)); @@ -280,7 +280,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_peform_schema_changes_drop_columns() { - $db_tools = $this->getMock('phpbb_db_tools', array( + $db_tools = $this->getMock('\phpbb\db\tools', array( 'sql_column_exists', 'sql_column_remove', ), array(&$this->db)); diff --git a/tests/dbal/migration/dummy.php b/tests/dbal/migration/dummy.php index 0ac6e733a1..041c529855 100644 --- a/tests/dbal/migration/dummy.php +++ b/tests/dbal/migration/dummy.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_dummy extends phpbb_db_migration +class phpbb_dbal_migration_dummy extends \phpbb\db\migration\migration { static public function depends_on() { diff --git a/tests/dbal/migration/fail.php b/tests/dbal/migration/fail.php index f88d8169f5..d90972720d 100644 --- a/tests/dbal/migration/fail.php +++ b/tests/dbal/migration/fail.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_fail extends phpbb_db_migration +class phpbb_dbal_migration_fail extends \phpbb\db\migration\migration { function update_schema() { diff --git a/tests/dbal/migration/if.php b/tests/dbal/migration/if.php index 83fe21bd21..bbbda60ea3 100644 --- a/tests/dbal/migration/if.php +++ b/tests/dbal/migration/if.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_if extends phpbb_db_migration +class phpbb_dbal_migration_if extends \phpbb\db\migration\migration { function update_schema() { diff --git a/tests/dbal/migration/installed.php b/tests/dbal/migration/installed.php index 01829f7a99..4b86896d9c 100644 --- a/tests/dbal/migration/installed.php +++ b/tests/dbal/migration/installed.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_installed extends phpbb_db_migration +class phpbb_dbal_migration_installed extends \phpbb\db\migration\migration { function effectively_installed() { diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php index 6c2f04bf08..041d12ad27 100644 --- a/tests/dbal/migration/recall.php +++ b/tests/dbal/migration/recall.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_recall extends phpbb_db_migration +class phpbb_dbal_migration_recall extends \phpbb\db\migration\migration { function update_schema() { diff --git a/tests/dbal/migration/revert.php b/tests/dbal/migration/revert.php index ac01987cd4..1882b20492 100644 --- a/tests/dbal/migration/revert.php +++ b/tests/dbal/migration/revert.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_revert extends phpbb_db_migration +class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration { function update_schema() { diff --git a/tests/dbal/migration/revert_with_dependency.php b/tests/dbal/migration/revert_with_dependency.php index ca2c070e8c..0b09fb784d 100644 --- a/tests/dbal/migration/revert_with_dependency.php +++ b/tests/dbal/migration/revert_with_dependency.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_revert_with_dependency extends phpbb_db_migration +class phpbb_dbal_migration_revert_with_dependency extends \phpbb\db\migration\migration { static public function depends_on() { diff --git a/tests/dbal/migration/unfulfillable.php b/tests/dbal/migration/unfulfillable.php index 6d375e6880..a1cdef9a23 100644 --- a/tests/dbal/migration/unfulfillable.php +++ b/tests/dbal/migration/unfulfillable.php @@ -7,7 +7,7 @@ * */ -class phpbb_dbal_migration_unfulfillable extends phpbb_db_migration +class phpbb_dbal_migration_unfulfillable extends \phpbb\db\migration\migration { static public function depends_on() { diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 9e55e4dd35..6679ae407b 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -33,15 +33,15 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->db_tools = new phpbb_db_tools($this->db); + $this->db_tools = new \phpbb\db\tools($this->db); - $this->config = new phpbb_config_db($this->db, new phpbb_mock_cache, 'phpbb_config'); + $this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config'); $tools = array( - new phpbb_db_migration_tool_config($this->config), + new \phpbb\db\migration\tool\config($this->config), ); - $this->migrator = new phpbb_db_migrator( + $this->migrator = new \phpbb\db\migrator( $this->config, $this->db, $this->db_tools, @@ -55,11 +55,11 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); - $this->extension_manager = new phpbb_extension_manager( + $this->extension_manager = new \phpbb\extension\manager( $container, $this->db, $this->config, - new phpbb_filesystem(), + new \phpbb\filesystem(), 'phpbb_ext', dirname(__FILE__) . '/../../phpBB/', 'php', @@ -232,7 +232,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $this->migrator->update(); } } - catch (phpbb_db_migration_exception $e) {} + catch (\phpbb\db\migration\exception $e) {} // Failure should have caused an automatic roll-back, so this should not exist. $this->assertFalse(isset($this->config['foobar3'])); diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index b82d1ef48d..a8d8966839 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -11,9 +11,9 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case { public function setup() { - $this->config = new phpbb_config(array()); + $this->config = new \phpbb\config\config(array()); - $this->tool = new phpbb_db_migration_tool_config($this->config); + $this->tool = new \phpbb\db\migration\tool\config($this->config); parent::setup(); } diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 828fb76c65..3c23891348 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -27,15 +27,15 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $skip_add_log = true; $db = $this->db = $this->new_dbal(); - $this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx); - $user = $this->user = new phpbb_user(); + $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx); + $user = $this->user = new \phpbb\user(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $auth = $this->getMock('phpbb_auth'); - $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $auth = $this->getMock('\phpbb\auth\auth'); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); - $this->tool = new phpbb_db_migration_tool_module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules'); + $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules'); } public function exists_data() diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index 79d9db66da..1090b4726a 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -24,10 +24,10 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case parent::setup(); $db = $this->db = $this->new_dbal(); - $cache = $this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx); - $this->auth = new phpbb_auth(); + $cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx); + $this->auth = new \phpbb\auth\auth(); - $this->tool = new phpbb_db_migration_tool_permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx); + $this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx); } public function exists_data() diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php index 45339a6b50..a70eea4f7e 100644 --- a/tests/dbal/sql_insert_buffer_test.php +++ b/tests/dbal/sql_insert_buffer_test.php @@ -17,7 +17,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->buffer = new phpbb_db_sql_insert_buffer($this->db, 'phpbb_config', 2); + $this->buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_config', 2); $this->assert_config_count(2); } diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index 987161a831..c069d9a796 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -64,7 +64,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case FROM phpbb_config'; $result = $db->sql_query($sql); $rows = $db->sql_fetchrowset($result); - + $this->assertEquals(1, sizeof($rows)); $this->assertEquals('config2', $rows[0]['config_name']); diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index c570f19ebd..a3a1ad3597 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -7,66 +7,72 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php'; - -class phpbb_di_container_test extends phpbb_test_case +namespace { - public function test_phpbb_create_container() - { - $phpbb_root_path = __DIR__ . '/../../phpBB/'; - $extensions = array( - new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path . 'config'), - ); - $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); + require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php'; + + class phpbb_di_container_test extends phpbb_test_case + { + public function test_phpbb_create_container() + { + $phpbb_root_path = __DIR__ . '/../../phpBB/'; + $extensions = array( + new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'), + new \phpbb\di\extension\core($phpbb_root_path . 'config'), + ); + $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); - } + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + } - public function test_phpbb_create_install_container() - { - $phpbb_root_path = __DIR__ . '/../../phpBB/'; - $extensions = array( - new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path . 'config'), - ); - $container = phpbb_create_install_container($phpbb_root_path, 'php'); + public function test_phpbb_create_install_container() + { + $phpbb_root_path = __DIR__ . '/../../phpBB/'; + $extensions = array( + new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'), + new \phpbb\di\extension\core($phpbb_root_path . 'config'), + ); + $container = phpbb_create_install_container($phpbb_root_path, 'php'); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); - $this->assertTrue($container->isFrozen()); - } + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + $this->assertTrue($container->isFrozen()); + } - public function test_phpbb_create_compiled_container() - { - $phpbb_root_path = __DIR__ . '/../../phpBB/'; - $config_file = __DIR__ . '/fixtures/config.php'; - $extensions = array( - new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path . 'config'), - ); - $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php'); + public function test_phpbb_create_compiled_container() + { + $phpbb_root_path = __DIR__ . '/../../phpBB/'; + $config_file = __DIR__ . '/fixtures/config.php'; + $extensions = array( + new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'), + new \phpbb\di\extension\core($phpbb_root_path . 'config'), + ); + $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php'); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); - $this->assertTrue($container->isFrozen()); - } + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + $this->assertTrue($container->isFrozen()); + } + } } -class phpbb_db_driver_container_mock extends phpbb_db_driver +namespace phpbb\db\driver { - public function sql_connect() - { - } + class container_mock extends \phpbb\db\driver\driver + { + public function sql_connect() + { + } - public function sql_query() - { - } + public function sql_query() + { + } - public function sql_fetchrow() - { - } + public function sql_fetchrow() + { + } - public function sql_freeresult() - { - } + public function sql_freeresult() + { + } + } } diff --git a/tests/di/fixtures/config.php b/tests/di/fixtures/config.php index 5033d2dc9f..04e20f63d8 100644 --- a/tests/di/fixtures/config.php +++ b/tests/di/fixtures/config.php @@ -8,4 +8,4 @@ $dbname = 'phpbb'; $dbuser = 'root'; $dbpasswd = ''; $table_prefix = 'phpbb_'; -$acm_type = 'phpbb_cache_driver_null'; +$acm_type = '\phpbb\cache\driver\null'; diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index fceb8aa3d8..0804c64f6f 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -13,7 +13,7 @@ class phpbb_error_collector_test extends phpbb_test_case { public function test_collection() { - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); // Cause a warning diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php index 9b9203e06a..a76df90809 100644 --- a/tests/event/dispatcher_test.php +++ b/tests/event/dispatcher_test.php @@ -11,9 +11,9 @@ class phpbb_event_dispatcher_test extends phpbb_test_case { public function test_trigger_event() { - $dispatcher = new phpbb_event_dispatcher(new phpbb_mock_container_builder()); + $dispatcher = new \phpbb\event\dispatcher(new phpbb_mock_container_builder()); - $dispatcher->addListener('core.test_event', function (phpbb_event_data $event) { + $dispatcher->addListener('core.test_event', function (\phpbb\event\data $event) { $event['foo'] = $event['foo'] . '2'; $event['bar'] = $event['bar'] . '2'; }); diff --git a/tests/extension/ext/bar/ext.php b/tests/extension/ext/bar/ext.php index 5585edf9ac..edae25663a 100644 --- a/tests/extension/ext/bar/ext.php +++ b/tests/extension/ext/bar/ext.php @@ -1,6 +1,6 @@ <?php -class phpbb_ext_bar_ext extends phpbb_extension_base +class phpbb_ext_bar_ext extends \phpbb\extension\base { static public $state; diff --git a/tests/extension/ext/barfoo/ext.php b/tests/extension/ext/barfoo/ext.php index 2e11ece8d1..c1425369fa 100644 --- a/tests/extension/ext/barfoo/ext.php +++ b/tests/extension/ext/barfoo/ext.php @@ -1,5 +1,5 @@ <?php -class phpbb_ext_barfoo_ext extends phpbb_extension_base +class phpbb_ext_barfoo_ext extends \phpbb\extension\base { } diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/foo/ext.php index 60b3ad1f16..f604dcab5f 100644 --- a/tests/extension/ext/foo/ext.php +++ b/tests/extension/ext/foo/ext.php @@ -1,6 +1,6 @@ <?php -class phpbb_ext_foo_ext extends phpbb_extension_base +class phpbb_ext_foo_ext extends \phpbb\extension\base { static public $disabled; diff --git a/tests/extension/ext/vendor/moo/ext.php b/tests/extension/ext/vendor/moo/ext.php index e0ac1a22cc..82657ece77 100644 --- a/tests/extension/ext/vendor/moo/ext.php +++ b/tests/extension/ext/vendor/moo/ext.php @@ -1,6 +1,6 @@ <?php -class phpbb_ext_vendor_moo_ext extends phpbb_extension_base +class phpbb_ext_vendor_moo_ext extends \phpbb\extension\base { static public $purged; diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 3bf2c42573..f1e7bc02b9 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -43,10 +43,10 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_default_implementation', - 'phpbb_ext_bar_my_hidden_class', - 'phpbb_ext_foo_a_class', - 'phpbb_ext_foo_b_class', + 'phpbb\default\implementation', + 'phpbb\ext\bar\my\hidden_class', + 'phpbb\ext\foo\a_class', + 'phpbb\ext\foo\b_class', ), $classes ); @@ -88,8 +88,8 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_default_implementation', - 'phpbb_ext_bar_my_hidden_class', + 'phpbb\default\implementation', + 'phpbb\ext\bar\my\hidden_class', ), $classes ); @@ -105,9 +105,9 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_default_implementation', - 'phpbb_ext_foo_sub_type_alternative', - 'phpbb_ext_foo_type_alternative', + 'phpbb\default\implementation', + 'phpbb\ext\foo\sub\type\alternative', + 'phpbb\ext\foo\type\alternative', ), $classes ); @@ -122,7 +122,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_ext_foo_type_alternative', + 'phpbb\ext\foo\type\alternative', ), $classes ); @@ -137,7 +137,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_ext_foo_sub_type_alternative', + 'phpbb\ext\foo\sub\type\alternative', ), $classes ); @@ -152,7 +152,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_ext_foo_sub_type_alternative', + 'phpbb\ext\foo\sub\type\alternative', ), $classes ); @@ -168,8 +168,8 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - 'phpbb_ext_foo_type_alternative', - 'phpbb_ext_foo_type_dummy_empty', + 'phpbb\ext\foo\type\alternative', + 'phpbb\ext\foo\type\dummy\empty', ), $classes ); @@ -181,7 +181,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_get_classes_create_cache() { $cache = new phpbb_mock_cache; - $finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name'); + $finder = new \phpbb\extension\finder($this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name'); $files = $finder->suffix('_class.php')->get_files(); $expected_files = array( @@ -219,9 +219,9 @@ class phpbb_extension_finder_test extends phpbb_test_case 'is_dir' => false, ); - $finder = new phpbb_extension_finder( + $finder = new \phpbb\extension\finder( $this->extension_manager, - new phpbb_filesystem(), + new \phpbb\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache(array( '_ext_finder' => array( diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index a23e5a18d9..fd9e800c02 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -90,14 +90,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case protected function create_extension_manager($with_cache = true) { - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $db = $this->new_dbal(); - $db_tools = new phpbb_db_tools($db); + $db_tools = new \phpbb\db\tools($db); $phpbb_root_path = __DIR__ . './../../phpBB/'; $php_ext = 'php'; $table_prefix = 'phpbb_'; - $migrator = new phpbb_db_migrator( + $migrator = new \phpbb\db\migrator( $config, $db, $db_tools, @@ -110,11 +110,11 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); - return new phpbb_extension_manager( + return new \phpbb\extension\manager( $container, $db, $config, - new phpbb_filesystem(), + new \phpbb\filesystem(), 'phpbb_ext', dirname(__FILE__) . '/', $php_ext, diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index e5bd29092e..984ae63fa2 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -30,25 +30,25 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case parent::setUp(); $this->cache = new phpbb_mock_cache(); - $this->config = new phpbb_config(array( + $this->config = new \phpbb\config\config(array( 'version' => '3.1.0', )); $this->db = $this->new_dbal(); - $this->db_tools = new phpbb_db_tools($this->db); + $this->db_tools = new \phpbb\db\tools($this->db); $this->phpbb_root_path = dirname(__FILE__) . '/'; $this->phpEx = 'php'; - $this->user = new phpbb_user(); + $this->user = new \phpbb\user(); $this->table_prefix = 'phpbb_'; - $this->template = new phpbb_template_twig( + $this->template = new \phpbb\template\twig\twig( $this->phpbb_root_path, $this->phpEx, $this->config, $this->user, - new phpbb_template_context() + new \phpbb\template\context() ); - $this->migrator = new phpbb_db_migrator( + $this->migrator = new \phpbb\db\migrator( $this->config, $this->db, $this->db_tools, @@ -61,11 +61,11 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); - $this->extension_manager = new phpbb_extension_manager( + $this->extension_manager = new \phpbb\extension\manager( $container, $this->db, $this->config, - new phpbb_filesystem(), + new \phpbb\filesystem(), 'phpbb_ext', $this->phpbb_root_path, $this->phpEx, @@ -84,7 +84,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $manager->get_metadata(); } - catch(phpbb_extension_exception $e){} + catch(\phpbb\extension\exception $e){} $this->assertEquals((string) $e, 'The required file does not exist: ' . $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json'); } @@ -100,7 +100,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $metadata = $manager->get_metadata(); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -123,7 +123,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.'); } @@ -134,7 +134,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.'); } @@ -145,7 +145,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Required meta field \'licence\' has not been set.'); } @@ -156,7 +156,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.'); } @@ -167,7 +167,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.'); } @@ -184,7 +184,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.'); } @@ -211,7 +211,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Meta field \'name\' is invalid.'); } @@ -222,7 +222,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Meta field \'type\' is invalid.'); } @@ -233,7 +233,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Meta field \'licence\' is invalid.'); } @@ -244,7 +244,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail('Exception not triggered'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->assertEquals((string) $e, 'Meta field \'version\' is invalid.'); } @@ -268,7 +268,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $this->assertEquals(true, $manager->validate('enable')); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -293,7 +293,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(false, $manager->validate_require_php()); $this->assertEquals(false, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -312,7 +312,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(true, $manager->validate_require_php()); $this->assertEquals(true, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -331,7 +331,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(false, $manager->validate_require_php()); $this->assertEquals(false, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -350,7 +350,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(false, $manager->validate_require_php()); $this->assertEquals(false, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -369,7 +369,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(true, $manager->validate_require_php()); $this->assertEquals(true, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -388,7 +388,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(true, $manager->validate_require_php()); $this->assertEquals(true, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } @@ -407,7 +407,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals(true, $manager->validate_require_php()); $this->assertEquals(true, $manager->validate_require_phpbb()); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->fail($e); } diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 50951fc88c..fedadc103b 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -14,7 +14,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case public function setUp() { parent::setUp(); - $this->filesystem = new phpbb_filesystem(); + $this->filesystem = new \phpbb\filesystem(); } public function clean_path_data() diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php index a3d272906f..e17f33dc96 100644 --- a/tests/functional/acp_permissions_test.php +++ b/tests/functional/acp_permissions_test.php @@ -91,12 +91,12 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case $crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=$mode&${object_name}[0]=$object_id&type=$permission_type&sid=" . $this->sid); $this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); - // XXX globals for phpbb_auth, refactor it later + // XXX globals for \phpbb\auth\auth, refactor it later global $db, $cache; $db = $this->get_db(); $cache = new phpbb_mock_null_cache; - $auth = new phpbb_auth; + $auth = new \phpbb\auth\auth; // XXX hardcoded id $user_data = $auth->obtain_user_data(2); $auth->acl($user_data); @@ -114,7 +114,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case $this->assertContains($this->lang('AUTH_UPDATED'), $crawler->text()); // check acl again - $auth = new phpbb_auth; + $auth = new \phpbb\auth\auth; // XXX hardcoded id $user_data = $auth->obtain_user_data(2); $auth->acl($user_data); diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php index 5a91b5f681..41b2be350b 100644 --- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php +++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php @@ -5,7 +5,7 @@ class phpbb_ext_foo_bar_controller { protected $template; - public function __construct(phpbb_controller_helper $helper, phpbb_template $template) + public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template) { $this->template = $template; $this->helper = $helper; @@ -30,6 +30,6 @@ class phpbb_ext_foo_bar_controller public function exception() { - throw new phpbb_controller_exception('Exception thrown from foo/exception route'); + throw new \phpbb\controller\exception('Exception thrown from foo/exception route'); } } diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php index 74359d51ab..b839cef36c 100644 --- a/tests/functional/fixtures/ext/foo/bar/ext.php +++ b/tests/functional/fixtures/ext/foo/bar/ext.php @@ -1,6 +1,6 @@ <?php -class phpbb_ext_foo_bar_ext extends phpbb_extension_base +class phpbb_ext_foo_bar_ext extends \phpbb\extension\base { } diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php index d08bf87f15..4d210d7b29 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -31,7 +31,7 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case */ public function test_convert_30_dbms_to_31($input) { - $expected = "phpbb_db_driver_$input"; + $expected = "phpbb\\db\\driver\\$input"; $output = phpbb_convert_30_dbms_to_31($input); diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index fe372431a9..624e05f77f 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -160,7 +160,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $config['load_online_guests'] = $display_guests; $user = new phpbb_mock_lang(); $user->lang = $this->load_language(); - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $acl_get_map = array( array('u_viewonline', true), array('u_viewprofile', true), diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index 4336fd894e..f8d52a9a6a 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -131,17 +131,17 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes $cache = new phpbb_mock_cache; $db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_clear_prefetch'); - $cache_driver = new phpbb_cache_driver_null(); + $cache_driver = new \phpbb\cache\driver\null(); $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) ->method('get') ->with('cache.driver') ->will($this->returnValue($cache_driver)); - $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); group_user_attributes('default', $group_id, array($user_id), false, 'group_name', $group_row); diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php index 16e33b390c..ac54a86b8e 100644 --- a/tests/groupposition/legend_test.php +++ b/tests/groupposition/legend_test.php @@ -20,7 +20,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case return array( array(1, 0, ''), array(3, 2, ''), - array(4, 0, 'phpbb_groupposition_exception'), + array(4, 0, '\phpbb\groupposition\exception'), ); } @@ -33,7 +33,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); if ($throws_exception) @@ -41,7 +41,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->setExpectedException($throws_exception); } - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals($expected, $test_class->get_group_value($group_id)); } @@ -51,10 +51,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals(2, $test_class->get_group_count()); } @@ -91,10 +91,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals($expected_added, $test_class->add_group($group_id)); $result = $db->sql_query('SELECT group_id, group_legend @@ -179,10 +179,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals($expected_deleted, $test_class->delete_group($group_id, $skip_group)); $result = $db->sql_query('SELECT group_id, group_legend @@ -234,10 +234,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals($excepted_moved, $test_class->move_up($group_id)); $result = $db->sql_query('SELECT group_id, group_legend @@ -289,10 +289,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals($excepted_moved, $test_class->move_down($group_id)); $result = $db->sql_query('SELECT group_id, group_legend @@ -387,10 +387,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_legend($db, $user); + $test_class = new \phpbb\groupposition\legend($db, $user); $this->assertEquals($excepted_moved, $test_class->move($group_id, $increment)); $result = $db->sql_query('SELECT group_id, group_legend diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php index db26cd09d5..ec89f56775 100644 --- a/tests/groupposition/teampage_test.php +++ b/tests/groupposition/teampage_test.php @@ -22,7 +22,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case return array( array(2, 3, ''), array(6, 8, ''), - array(10, 0, 'phpbb_groupposition_exception'), + array(10, 0, '\phpbb\groupposition\exception'), ); } @@ -35,7 +35,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); if ($throws_exception) @@ -43,7 +43,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->setExpectedException($throws_exception); } - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($expected, $test_class->get_group_value($group_id)); } @@ -53,10 +53,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals(8, $test_class->get_group_count()); } @@ -137,10 +137,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($expected_added, $test_class->add_group_teampage($group_id, $parent_id)); $result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name @@ -180,10 +180,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($expected_added, $test_class->add_category_teampage($group_name)); $result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name @@ -247,10 +247,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($expected_deleted, $test_class->delete_group($group_id, false)); $result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name @@ -299,10 +299,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($expected_deleted, $test_class->delete_teampage($teampage_id, false)); $result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name @@ -462,10 +462,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($excepted_moved, $test_class->move($group_id, $move_delta)); $result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name @@ -625,10 +625,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array(); - $test_class = new phpbb_groupposition_teampage($db, $user, $cache); + $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $this->assertEquals($excepted_moved, $test_class->move_teampage($teampage_id, $move_delta)); $result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name diff --git a/tests/lock/db_test.php b/tests/lock/db_test.php index de7a23fd05..da689b7fa3 100644 --- a/tests/lock/db_test.php +++ b/tests/lock/db_test.php @@ -25,9 +25,9 @@ class phpbb_lock_db_test extends phpbb_database_test_case global $db, $config; $db = $this->db = $this->new_dbal(); - $config = $this->config = new phpbb_config(array('rand_seed' => '', 'rand_seed_last_update' => '0')); + $config = $this->config = new \phpbb\config\config(array('rand_seed' => '', 'rand_seed_last_update' => '0')); set_config(null, null, null, $this->config); - $this->lock = new phpbb_lock_db('test_lock', $this->config, $this->db); + $this->lock = new \phpbb\lock\db('test_lock', $this->config, $this->db); } public function test_new_lock() @@ -38,7 +38,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case $this->assertTrue($this->lock->owns_lock()); $this->assertTrue(isset($this->config['test_lock']), 'Lock was created'); - $lock2 = new phpbb_lock_db('test_lock', $this->config, $this->db); + $lock2 = new \phpbb\lock\db('test_lock', $this->config, $this->db); $this->assertFalse($lock2->acquire()); $this->assertFalse($lock2->owns_lock()); @@ -49,7 +49,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case public function test_expire_lock() { - $lock = new phpbb_lock_db('foo_lock', $this->config, $this->db); + $lock = new \phpbb\lock\db('foo_lock', $this->config, $this->db); $this->assertTrue($lock->acquire()); } @@ -82,7 +82,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case $this->assertFalse($this->lock->owns_lock()); $this->assertEquals('0', $this->config['test_lock'], 'First lock is released'); - $lock2 = new phpbb_lock_db('test_lock', $this->config, $this->db); + $lock2 = new \phpbb\lock\db('test_lock', $this->config, $this->db); $this->assertTrue($lock2->acquire()); $this->assertTrue($lock2->owns_lock()); $this->assertFalse(empty($this->config['test_lock']), 'Second lock is acquired'); diff --git a/tests/lock/flock_test.php b/tests/lock/flock_test.php index 8f0b866ab3..5e5ac5aa78 100644 --- a/tests/lock/flock_test.php +++ b/tests/lock/flock_test.php @@ -13,7 +13,7 @@ class phpbb_lock_flock_test extends phpbb_test_case { $path = __DIR__ . '/../tmp/precious'; - $lock = new phpbb_lock_flock($path); + $lock = new \phpbb\lock\flock($path); $ok = $lock->acquire(); $this->assertTrue($ok); $lock->release(); @@ -23,7 +23,7 @@ class phpbb_lock_flock_test extends phpbb_test_case { $path = __DIR__ . '/../tmp/precious'; - $lock = new phpbb_lock_flock($path); + $lock = new \phpbb\lock\flock($path); $ok = $lock->acquire(); $this->assertTrue($ok); $this->assertTrue($lock->owns_lock()); @@ -48,11 +48,11 @@ class phpbb_lock_flock_test extends phpbb_test_case { $path = __DIR__ . '/../tmp/precious'; - $lock1 = new phpbb_lock_flock($path); + $lock1 = new \phpbb\lock\flock($path); $ok = $lock1->acquire(); $this->assertTrue($ok); - $lock2 = new phpbb_lock_flock($path); + $lock2 = new \phpbb\lock\flock($path); $ok = $lock2->acquire(); $this->assertFalse($ok); @@ -78,7 +78,7 @@ class phpbb_lock_flock_test extends phpbb_test_case // wait 0.5 s, acquire the lock, note how long it took sleep(1); - $lock = new phpbb_lock_flock($path); + $lock = new \phpbb\lock\flock($path); $start = time(); $ok = $lock->acquire(); $delta = time() - $start; @@ -105,7 +105,7 @@ class phpbb_lock_flock_test extends phpbb_test_case { // child // immediately acquire the lock and sleep for 2 s - $lock = new phpbb_lock_flock($path); + $lock = new \phpbb\lock\flock($path); $ok = $lock->acquire(); $this->assertTrue($ok); $this->assertTrue($lock->owns_lock()); diff --git a/tests/log/add_test.php b/tests/log/add_test.php index a5f93232f2..032546f002 100644 --- a/tests/log/add_test.php +++ b/tests/log/add_test.php @@ -23,10 +23,10 @@ class phpbb_log_add_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('phpbb_user'); - $auth = $this->getMock('phpbb_auth'); + $user = $this->getMock('\phpbb\user'); + $auth = $this->getMock('\phpbb\auth\auth'); - $log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $this->assertTrue($log->is_enabled(), 'Initialise failed'); @@ -52,10 +52,10 @@ class phpbb_log_add_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('phpbb_user'); - $auth = $this->getMock('phpbb_auth'); + $user = $this->getMock('\phpbb\user'); + $auth = $this->getMock('\phpbb\auth\auth'); - $log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $mode = 'critical'; $user_id = ANONYMOUS; diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php index 7aa42be6df..e1bcd4acaf 100644 --- a/tests/log/function_add_log_test.php +++ b/tests/log/function_add_log_test.php @@ -157,10 +157,10 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('phpbb_user'); - $auth = $this->getMock('phpbb_auth'); + $user = $this->getMock('\phpbb\user'); + $auth = $this->getMock('\phpbb\auth\auth'); - $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $user->ip = 'user_ip'; if ($user_id) diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 6827aaa1b6..017484e8a7 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -306,7 +306,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $acl_get_map = array( array('f_read', 23, true), array('m_', 23, true), @@ -333,7 +333,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'LOG_INSTALL_INSTALLED' => 'installed: %s', ); - $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $log = array(); $this->assertEquals($expected_returned, view_log($mode, $log, $log_count, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords)); diff --git a/tests/mock/cache.php b/tests/mock/cache.php index 440592665a..83bbb8ef30 100644 --- a/tests/mock/cache.php +++ b/tests/mock/cache.php @@ -7,7 +7,7 @@ * */ -class phpbb_mock_cache implements phpbb_cache_driver_interface +class phpbb_mock_cache implements \phpbb\cache\driver\driver_interface { protected $data; @@ -140,7 +140,7 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface /** * {@inheritDoc} */ - public function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl) + public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) { return $query_result; } diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 10b3595206..7049cbdc50 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -7,13 +7,13 @@ * */ -class phpbb_mock_extension_manager extends phpbb_extension_manager +class phpbb_mock_extension_manager extends \phpbb\extension\manager { public function __construct($phpbb_root_path, $extensions = array()) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = 'php'; $this->extensions = $extensions; - $this->filesystem = new phpbb_filesystem(); + $this->filesystem = new \phpbb\filesystem(); } } diff --git a/tests/mock/metadata_manager.php b/tests/mock/metadata_manager.php index a7fbf0681c..b6489acfa4 100644 --- a/tests/mock/metadata_manager.php +++ b/tests/mock/metadata_manager.php @@ -7,7 +7,7 @@ * */ -class phpbb_mock_metadata_manager extends phpbb_extension_metadata_manager +class phpbb_mock_metadata_manager extends \phpbb\extension\metadata_manager { public function set_metadata($metadata) { diff --git a/tests/mock/notifications_auth.php b/tests/mock/notifications_auth.php index d960acb81a..2d387d8c00 100644 --- a/tests/mock/notifications_auth.php +++ b/tests/mock/notifications_auth.php @@ -7,7 +7,7 @@ * */ -class phpbb_mock_notifications_auth extends phpbb_auth +class phpbb_mock_notifications_auth extends \phpbb\auth\auth { function acl_get_list($user_id = false, $opts = false, $forum_id = false) { diff --git a/tests/mock/request.php b/tests/mock/request.php index d671621460..ed0744c8cf 100644 --- a/tests/mock/request.php +++ b/tests/mock/request.php @@ -7,33 +7,33 @@ * */ -class phpbb_mock_request implements phpbb_request_interface +class phpbb_mock_request implements \phpbb\request\request_interface { protected $data; public function __construct($get = array(), $post = array(), $cookie = array(), $server = array(), $request = false, $files = array()) { - $this->data[phpbb_request_interface::GET] = $get; - $this->data[phpbb_request_interface::POST] = $post; - $this->data[phpbb_request_interface::COOKIE] = $cookie; - $this->data[phpbb_request_interface::REQUEST] = ($request === false) ? $post + $get : $request; - $this->data[phpbb_request_interface::SERVER] = $server; - $this->data[phpbb_request_interface::FILES] = $files; + $this->data[\phpbb\request\request_interface::GET] = $get; + $this->data[\phpbb\request\request_interface::POST] = $post; + $this->data[\phpbb\request\request_interface::COOKIE] = $cookie; + $this->data[\phpbb\request\request_interface::REQUEST] = ($request === false) ? $post + $get : $request; + $this->data[\phpbb\request\request_interface::SERVER] = $server; + $this->data[\phpbb\request\request_interface::FILES] = $files; } - public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST) + public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST) { $this->data[$super_global][$var_name] = $value; } - public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST) + public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) { return isset($this->data[$super_global][$var_name]) ? $this->data[$super_global][$var_name] : $default; } public function server($var_name, $default = '') { - $super_global = phpbb_request_interface::SERVER; + $super_global = \phpbb\request\request_interface::SERVER; return isset($this->data[$super_global][$var_name]) ? $this->data[$super_global][$var_name] : $default; } @@ -45,16 +45,16 @@ class phpbb_mock_request implements phpbb_request_interface public function file($form_name) { - $super_global = phpbb_request_interface::FILES; + $super_global = \phpbb\request\request_interface::FILES; return isset($this->data[$super_global][$form_name]) ? $this->data[$super_global][$form_name] : array(); } public function is_set_post($name) { - return $this->is_set($name, phpbb_request_interface::POST); + return $this->is_set($name, \phpbb\request\request_interface::POST); } - public function is_set($var, $super_global = phpbb_request_interface::REQUEST) + public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST) { return isset($this->data[$super_global][$var]); } @@ -69,7 +69,7 @@ class phpbb_mock_request implements phpbb_request_interface return false; } - public function variable_names($super_global = phpbb_request_interface::REQUEST) + public function variable_names($super_global = \phpbb\request\request_interface::REQUEST) { return array_keys($this->data[$super_global]); } @@ -84,10 +84,10 @@ class phpbb_mock_request implements phpbb_request_interface public function set_header($header_name, $value) { $var_name = 'HTTP_' . str_replace('-', '_', strtoupper($header_name)); - $this->data[phpbb_request_interface::SERVER][$var_name] = $value; + $this->data[\phpbb\request\request_interface::SERVER][$var_name] = $value; } - public function merge($super_global = phpbb_request_interface::REQUEST, $values) + public function merge($super_global = \phpbb\request\request_interface::REQUEST, $values) { $this->data[$super_global] = array_merge($this->data[$super_global], $values); } diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php index 283f9af192..d81ae3163e 100644 --- a/tests/mock/session_testable.php +++ b/tests/mock/session_testable.php @@ -16,7 +16,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; * test it without warnings about sent headers. This class only stores cookie * data for later verification. */ -class phpbb_mock_session_testable extends phpbb_session +class phpbb_mock_session_testable extends \phpbb\session { private $_cookies = array(); diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php index ba09aa8d7f..aa7c54dddd 100644 --- a/tests/mock/sql_insert_buffer.php +++ b/tests/mock/sql_insert_buffer.php @@ -7,7 +7,7 @@ * */ -class phpbb_mock_sql_insert_buffer extends phpbb_db_sql_insert_buffer +class phpbb_mock_sql_insert_buffer extends \phpbb\db\sql_insert_buffer { public function flush() { diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index c038020385..ed1fa9b1bf 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -25,10 +25,10 @@ class phpbb_notification_convert_test extends phpbb_database_test_case $this->db = $this->new_dbal(); - $this->migration = new phpbb_db_migration_data_310_notification_options_reconvert( - new phpbb_config(array()), + $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert( + new \phpbb\config\config(array()), $this->db, - new phpbb_db_tools($this->db), + new \phpbb\db\tools($this->db), $phpbb_root_path, $phpEx, 'phpbb_' diff --git a/tests/notification/ext/test/notification/type/test.php b/tests/notification/ext/test/notification/type/test.php index 0d0c584e0d..cdb921ca3b 100644 --- a/tests/notification/ext/test/notification/type/test.php +++ b/tests/notification/ext/test/notification/type/test.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\notification\type; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_notification_type_test extends phpbb_notification_type_base +class test extends \phpbb\notification\type\base { public function get_type() { diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php index 7a794f922f..731dd00b7a 100644 --- a/tests/notification/manager_helper.php +++ b/tests/notification/manager_helper.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) * Notifications service class * @package notifications */ -class phpbb_notification_manager_helper extends phpbb_notification_manager +class phpbb_notification_manager_helper extends \phpbb\notification\manager { public function set_var($name, $value) { @@ -40,7 +40,7 @@ class phpbb_notification_manager_helper extends phpbb_notification_manager */ public function get_item_type_class($item_type, $data = array()) { - $item_type = 'phpbb_notification_type_' . $item_type; + $item_type = 'phpbb\notification\type\\' . $item_type; $item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table); @@ -56,7 +56,7 @@ class phpbb_notification_manager_helper extends phpbb_notification_manager */ public function get_method_class($method_name) { - $method_name = 'phpbb_notification_method_' . $method_name; + $method_name = 'phpbb\notification\method\\' . $method_name; $method = new $method_name($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table); diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 4e564ce23c..8597c626a4 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -53,7 +53,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case $db = $this->db; // Auth - $auth = $this->getMock('phpbb_auth'); + $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), @@ -65,12 +65,12 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case ))); // Config - $config = new phpbb_config(array('num_topics' => 1,'num_posts' => 1,)); + $config = new \phpbb\config\config(array('num_topics' => 1,'num_posts' => 1,)); set_config(null, null, null, $config); set_config_count(null, null, null, $config); - $cache = new phpbb_cache_service( - new phpbb_cache_driver_null(), + $cache = new \phpbb\cache\service( + new \phpbb\cache\driver\null(), $config, $db, $phpbb_root_path, @@ -81,7 +81,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // User - $user = $this->getMock('phpbb_user'); + $user = $this->getMock('\phpbb\user'); $user->ip = ''; $user->data = array( 'user_id' => 2, @@ -91,21 +91,21 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case ); // Request - $type_cast_helper = $this->getMock('phpbb_request_type_cast_helper_interface'); - $request = $this->getMock('phpbb_request'); + $type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); + $request = $this->getMock('\phpbb\request\request'); // Container $phpbb_container = new phpbb_mock_container_builder(); - $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); - $user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); + $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); // Notification Types $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'approve_topic', 'approve_post'); $notification_types_array = array(); foreach ($notification_types as $type) { - $class_name = 'phpbb_notification_type_' . $type; + $class_name = '\phpbb\notification\type\\' . $type; $class = new $class_name( $user_loader, $db, $cache->get_driver(), $user, $auth, $config, $phpbb_root_path, $phpEx, @@ -117,7 +117,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case } // Notification Manager - $phpbb_notifications = new phpbb_notification_manager($notification_types_array, array(), + $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), $phpbb_container, $user_loader, $db, $cache, $user, $phpbb_root_path, $phpEx, NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE); diff --git a/tests/request/deactivated_super_global_test.php b/tests/request/deactivated_super_global_test.php index 2e19928a5a..d28bd87eec 100644 --- a/tests/request/deactivated_super_global_test.php +++ b/tests/request/deactivated_super_global_test.php @@ -16,7 +16,7 @@ class phpbb_deactivated_super_global_test extends phpbb_test_case public function test_write_triggers_error() { $this->setExpectedTriggerError(E_USER_ERROR); - $obj = new phpbb_request_deactivated_super_global($this->getMock('phpbb_request_interface'), 'obj', phpbb_request_interface::POST); + $obj = new \phpbb\request\deactivated_super_global($this->getMock('\phpbb\request\request_interface'), 'obj', \phpbb\request\request_interface::POST); $obj->offsetSet(0, 0); } } diff --git a/tests/request/request_test.php b/tests/request/request_test.php index 52c21abd2a..a25792e051 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -33,8 +33,8 @@ class phpbb_request_test extends phpbb_test_case $_SERVER['HTTP_ACCEPT'] = 'application/json'; $_SERVER['HTTP_SOMEVAR'] = '<value>'; - $this->type_cast_helper = $this->getMock('phpbb_request_type_cast_helper_interface'); - $this->request = new phpbb_request($this->type_cast_helper); + $this->type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); + $this->request = new \phpbb\request\request($this->type_cast_helper); } public function test_toggle_super_globals() @@ -135,7 +135,7 @@ class phpbb_request_test extends phpbb_test_case { $this->request->enable_super_globals(); $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; - $this->request = new phpbb_request($this->type_cast_helper); + $this->request = new \phpbb\request\request($this->type_cast_helper); $this->assertTrue($this->request->is_ajax()); } @@ -146,7 +146,7 @@ class phpbb_request_test extends phpbb_test_case $this->request->enable_super_globals(); $_SERVER['HTTPS'] = 'on'; - $this->request = new phpbb_request($this->type_cast_helper); + $this->request = new \phpbb\request\request($this->type_cast_helper); $this->assertTrue($this->request->is_secure()); } diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index 0e85d4694b..d126fe1e8b 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -90,7 +90,7 @@ class phpbb_request_var_test extends phpbb_test_case { $this->unset_variables('var'); - // cannot set $_REQUEST directly because in phpbb_request implementation + // cannot set $_REQUEST directly because in \phpbb\request\request implementation // $_REQUEST = $_POST + $_GET $_POST['var'] = array( 0 => array( diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php index f41db005af..98f4538c08 100644 --- a/tests/request/type_cast_helper_test.php +++ b/tests/request/type_cast_helper_test.php @@ -16,7 +16,7 @@ class phpbb_type_cast_helper_test extends phpbb_test_case protected function setUp() { - $this->type_cast_helper = new phpbb_request_type_cast_helper(); + $this->type_cast_helper = new \phpbb\request\type_cast_helper(); } public function test_addslashes_recursively() diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php index 3ad15bd806..c08484c78d 100644 --- a/tests/search/mysql_test.php +++ b/tests/search/mysql_test.php @@ -34,7 +34,7 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case $this->db = $this->new_dbal(); $error = null; - $class = self::get_search_wrapper('phpbb_search_fulltext_mysql'); + $class = self::get_search_wrapper('\phpbb\search\fulltext_mysql'); $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user); } } diff --git a/tests/search/native_test.php b/tests/search/native_test.php index 4a2c210013..18c6df2445 100644 --- a/tests/search/native_test.php +++ b/tests/search/native_test.php @@ -30,7 +30,7 @@ class phpbb_search_native_test extends phpbb_search_test_case $this->db = $this->new_dbal(); $error = null; - $class = self::get_search_wrapper('phpbb_search_fulltext_native'); + $class = self::get_search_wrapper('\phpbb\search\fulltext_native'); $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user); } diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php index 923af6f854..a59f5abc7d 100644 --- a/tests/search/postgres_test.php +++ b/tests/search/postgres_test.php @@ -34,7 +34,7 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case $this->db = $this->new_dbal(); $error = null; - $class = self::get_search_wrapper('phpbb_search_fulltext_postgres'); + $class = self::get_search_wrapper('\phpbb\search\fulltext_postgres'); $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user); } } diff --git a/tests/security/base.php b/tests/security/base.php index 08878ad60d..8cd24ff145 100644 --- a/tests/security/base.php +++ b/tests/security/base.php @@ -39,13 +39,13 @@ abstract class phpbb_security_test_base extends phpbb_test_case $request = new phpbb_mock_request(array(), array(), array(), $server); // Set no user and trick a bit to circumvent errors - $user = new phpbb_user(); + $user = new \phpbb\user(); $user->lang = true; $user->browser = $server['HTTP_USER_AGENT']; $user->referer = ''; $user->forwarded_for = ''; $user->host = $server['HTTP_HOST']; - $user->page = phpbb_session::extract_current_page($phpbb_root_path); + $user->page = \phpbb\session::extract_current_page($phpbb_root_path); } protected function tearDown() diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index d77cbbcaf3..e42f446b31 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -28,12 +28,12 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base { global $request; - $request->merge(phpbb_request_interface::SERVER, array( + $request->merge(\phpbb\request\request_interface::SERVER, array( 'PHP_SELF' => $url, 'QUERY_STRING' => $query_string, )); - $result = phpbb_session::extract_current_page('./'); + $result = \phpbb\session::extract_current_page('./'); $label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.'; $this->assertEquals($expected, $result['query_string'], $label); @@ -46,12 +46,12 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base { global $request; - $request->merge(phpbb_request_interface::SERVER, array( + $request->merge(\phpbb\request\request_interface::SERVER, array( 'PHP_SELF' => $url, 'QUERY_STRING' => $query_string, )); - $result = phpbb_session::extract_current_page('./'); + $result = \phpbb\session::extract_current_page('./'); $label = 'Running extract_current_page on ' . $query_string . ' with REQUEST_URI filled.'; $this->assertEquals($expected, $result['query_string'], $label); diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index 8733ce15ef..a58e208efc 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -63,10 +63,10 @@ class phpbb_session_testable_factory /** * Retrieve the configured session class instance * - * @param phpbb_db_driver $dbal The database connection to use for session data + * @param \phpbb\db\driver\driver $dbal The database connection to use for session data * @return phpbb_mock_session_testable A session instance */ - public function get_session(phpbb_db_driver $dbal) + public function get_session(\phpbb\db\driver\driver $dbal) { // set up all the global variables used by session global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container; @@ -79,7 +79,7 @@ class phpbb_session_testable_factory ); request_var(null, null, null, null, $request); - $config = $this->config = new phpbb_config($this->get_config_data()); + $config = $this->config = new \phpbb\config\config($this->get_config_data()); set_config(null, null, null, $config); $db = $dbal; diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 4280a7e7ff..801f0055c8 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -110,13 +110,13 @@ Zeta test event in all', global $phpbb_root_path, $phpEx, $user; $defaults = $this->config_defaults(); - $config = new phpbb_config(array_merge($defaults, $new_config)); + $config = new \phpbb\config\config(array_merge($defaults, $new_config)); $this->template_path = dirname(__FILE__) . "/datasets/$dataset/styles/silver/template"; $this->extension_manager = new phpbb_mock_filesystem_extension_manager( dirname(__FILE__) . "/datasets/$dataset/" ); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager); + $this->template = new \phpbb\template\twig\twig($phpbb_root_path, $phpEx, $config, $user, new \phpbb\template\context, $this->extension_manager); $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path)); } } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 91895502ad..7251151ef0 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -60,11 +60,11 @@ class phpbb_template_template_test_case extends phpbb_test_case global $phpbb_root_path, $phpEx; $defaults = $this->config_defaults(); - $config = new phpbb_config(array_merge($defaults, $new_config)); - $this->user = new phpbb_user; + $config = new \phpbb\config\config(array_merge($defaults, $new_config)); + $this->user = new \phpbb\user; $this->template_path = $this->test_path . '/templates'; - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); + $this->template = new \phpbb\template\twig\twig($phpbb_root_path, $phpEx, $config, $this->user, new \phpbb\template\context()); $this->template->set_custom_style('tests', $this->template_path); } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 477192c28a..461534a49d 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -16,11 +16,11 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat global $phpbb_root_path, $phpEx, $user; $defaults = $this->config_defaults(); - $config = new phpbb_config(array_merge($defaults, $new_config)); + $config = new \phpbb\config\config(array_merge($defaults, $new_config)); $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); + $this->template = new \phpbb\template\twig($phpbb_root_path, $phpEx, $config, $user, new \phpbb\template\context()); $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } } diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index c72ea5f765..1a9edcb181 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -82,7 +82,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $db_config = $this->get_database_config(); // Firebird requires table and column names to be uppercase - if ($db_config['dbms'] == 'phpbb_db_driver_firebird') + if ($db_config['dbms'] == '\phpbb\db\driver\firebird') { $xml_data = file_get_contents($path); $xml_data = preg_replace_callback('/(?:(<table name="))([a-z_]+)(?:(">))/', 'phpbb_database_test_case::to_upper', $xml_data); diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 9d2cfebd29..af9bd22662 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -108,7 +108,7 @@ class phpbb_database_test_connection_manager // These require different connection strings on the phpBB side than they do in PDO // so you must provide a DSN string for ODBC separately - if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb_db_driver_mssql' || $this->config['dbms'] == 'phpbb_db_driver_firebird')) + if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb\db\driver\mssql' || $this->config['dbms'] == 'phpbb\db\driver\firebird')) { $dsn = 'odbc:' . $this->config['custom_dsn']; } @@ -117,12 +117,12 @@ class phpbb_database_test_connection_manager { switch ($this->config['dbms']) { - case 'phpbb_db_driver_mssql': - case 'phpbb_db_driver_mssql_odbc': + case 'phpbb\db\driver\mssql': + case 'phpbb\db\driver\mssql_odbc': $this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('mssql', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']); break; - case 'phpbb_db_driver_firebird': + case 'phpbb\db\driver\firebird': if (!empty($this->config['custom_dsn'])) { $this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('firebird', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']); @@ -145,8 +145,8 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { - case 'phpbb_db_driver_mysql': - case 'phpbb_db_driver_mysqli': + case 'phpbb\db\driver\mysql': + case 'phpbb\db\driver\mysqli': $this->pdo->exec('SET NAMES utf8'); /* @@ -187,8 +187,8 @@ class phpbb_database_test_connection_manager { switch ($this->config['dbms']) { - case 'phpbb_db_driver_sqlite': - case 'phpbb_db_driver_firebird': + case 'phpbb\db\driver\sqlite': + case 'phpbb\db\driver\firebird': $this->connect(); // Drop all of the tables foreach ($this->get_tables() as $table) @@ -198,7 +198,7 @@ class phpbb_database_test_connection_manager $this->purge_extras(); break; - case 'phpbb_db_driver_oracle': + case 'phpbb\db\driver\oracle': $this->connect(); // Drop all of the tables foreach ($this->get_tables() as $table) @@ -208,7 +208,7 @@ class phpbb_database_test_connection_manager $this->purge_extras(); break; - case 'phpbb_db_driver_postgres': + case 'phpbb\db\driver\postgres': $this->connect(); // Drop all of the tables foreach ($this->get_tables() as $table) @@ -258,38 +258,38 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { - case 'phpbb_db_driver_mysql': - case 'phpbb_db_driver_mysqli': + case 'phpbb\db\driver\mysql': + case 'phpbb\db\driver\mysqli': $sql = 'SHOW TABLES'; break; - case 'phpbb_db_driver_sqlite': + case 'phpbb\db\driver\sqlite': $sql = 'SELECT name FROM sqlite_master WHERE type = "table"'; break; - case 'phpbb_db_driver_mssql': - case 'phpbb_db_driver_mssql_odbc': - case 'phpbb_db_driver_mssqlnative': + case 'phpbb\db\driver\mssql': + case 'phpbb\db\driver\mssql_odbc': + case 'phpbb\db\driver\mssqlnative': $sql = "SELECT name FROM sysobjects WHERE type='U'"; break; - case 'phpbb_db_driver_postgres': + case 'phpbb\db\driver\postgres': $sql = 'SELECT relname FROM pg_stat_user_tables'; break; - case 'phpbb_db_driver_firebird': + case 'phpbb\db\driver\firebird': $sql = 'SELECT rdb$relation_name FROM rdb$relations WHERE rdb$view_source is null AND rdb$system_flag = 0'; break; - case 'phpbb_db_driver_oracle': + case 'phpbb\db\driver\oracle': $sql = 'SELECT table_name FROM USER_TABLES'; break; @@ -325,7 +325,7 @@ class phpbb_database_test_connection_manager { $schema = $this->dbms['SCHEMA']; - if ($this->config['dbms'] == 'phpbb_db_driver_mysql') + if ($this->config['dbms'] == 'phpbb\db\driver\mysql') { $sth = $this->pdo->query('SELECT VERSION() AS version'); $row = $sth->fetch(PDO::FETCH_ASSOC); @@ -359,47 +359,47 @@ class phpbb_database_test_connection_manager protected function get_dbms_data($dbms) { $available_dbms = array( - 'phpbb_db_driver_firebird' => array( + 'phpbb\db\driver\firebird' => array( 'SCHEMA' => 'firebird', 'DELIM' => ';;', 'PDO' => 'firebird', ), - 'phpbb_db_driver_mysqli' => array( + 'phpbb\db\driver\mysqli' => array( 'SCHEMA' => 'mysql_41', 'DELIM' => ';', 'PDO' => 'mysql', ), - 'phpbb_db_driver_mysql' => array( + 'phpbb\db\driver\mysql' => array( 'SCHEMA' => 'mysql', 'DELIM' => ';', 'PDO' => 'mysql', ), - 'phpbb_db_driver_mssql' => array( + 'phpbb\db\driver\mssql' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'odbc', ), - 'phpbb_db_driver_mssql_odbc'=> array( + 'phpbb\db\driver\mssql_odbc'=> array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'odbc', ), - 'phpbb_db_driver_mssqlnative' => array( + 'phpbb\db\driver\mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'sqlsrv', ), - 'phpbb_db_driver_oracle' => array( + 'phpbb\db\driver\oracle' => array( 'SCHEMA' => 'oracle', 'DELIM' => '/', 'PDO' => 'oci', ), - 'phpbb_db_driver_postgres' => array( + 'phpbb\db\driver\postgres' => array( 'SCHEMA' => 'postgres', 'DELIM' => ';', 'PDO' => 'pgsql', ), - 'phpbb_db_driver_sqlite' => array( + 'phpbb\db\driver\sqlite' => array( 'SCHEMA' => 'sqlite', 'DELIM' => ';', 'PDO' => 'sqlite2', @@ -428,7 +428,7 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { - case 'phpbb_db_driver_firebird': + case 'phpbb\db\driver\firebird': $sql = 'SELECT RDB$GENERATOR_NAME FROM RDB$GENERATORS WHERE RDB$SYSTEM_FLAG = 0'; @@ -440,7 +440,7 @@ class phpbb_database_test_connection_manager } break; - case 'phpbb_db_driver_oracle': + case 'phpbb\db\driver\oracle': $sql = 'SELECT sequence_name FROM USER_SEQUENCES'; $result = $this->pdo->query($sql); @@ -451,7 +451,7 @@ class phpbb_database_test_connection_manager } break; - case 'phpbb_db_driver_postgres': + case 'phpbb\db\driver\postgres': $sql = 'SELECT sequence_name FROM information_schema.sequences'; $result = $this->pdo->query($sql); @@ -509,7 +509,7 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { - case 'phpbb_db_driver_oracle': + case 'phpbb\db\driver\oracle': // Get all of the information about the sequences $sql = "SELECT t.table_name, tc.column_name, d.referenced_name as sequence_name, s.increment_by, s.min_value FROM USER_TRIGGERS t @@ -544,14 +544,14 @@ class phpbb_database_test_connection_manager * Since we have no objects attached to our sequencers (triggers aren't attached), this works fine. */ $queries[] = 'DROP SEQUENCE ' . $row['SEQUENCE_NAME']; - $queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']} - MINVALUE {$row['MIN_VALUE']} - INCREMENT BY {$row['INCREMENT_BY']} + $queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']} + MINVALUE {$row['MIN_VALUE']} + INCREMENT BY {$row['INCREMENT_BY']} START WITH $max_val"; } break; - case 'phpbb_db_driver_postgres': + case 'phpbb\db\driver\postgres': // Get the sequences attached to the tables $sql = 'SELECT column_name, table_name FROM information_schema.columns WHERE table_name IN (' . implode(', ', $table_names) . ") diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 5028f9206a..d5d3258b1b 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -150,7 +150,7 @@ class phpbb_functional_test_case extends phpbb_test_case { global $phpbb_root_path, $phpEx; // so we don't reopen an open connection - if (!($this->db instanceof phpbb_db_driver)) + if (!($this->db instanceof \phpbb\db\driver\driver)) { $dbms = self::$config['dbms']; $this->db = new $dbms(); @@ -163,7 +163,7 @@ class phpbb_functional_test_case extends phpbb_test_case { if (!$this->cache) { - $this->cache = new phpbb_cache_driver_file; + $this->cache = new \phpbb\cache\driver\file; } return $this->cache; @@ -182,11 +182,11 @@ class phpbb_functional_test_case extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $db = $this->get_db(); - $db_tools = new phpbb_db_tools($db); + $db_tools = new \phpbb\db\tools($db); - $migrator = new phpbb_db_migrator( + $migrator = new \phpbb\db\migrator( $config, $db, $db_tools, @@ -199,11 +199,11 @@ class phpbb_functional_test_case extends phpbb_test_case $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); - $extension_manager = new phpbb_extension_manager( + $extension_manager = new \phpbb\extension\manager( $container, $db, $config, - new phpbb_filesystem(), + new \phpbb\filesystem(), self::$config['table_prefix'] . 'ext', dirname(__FILE__) . '/', $php_ext, @@ -471,7 +471,7 @@ class phpbb_functional_test_case extends phpbb_test_case // Required by unique_id global $config; - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; @@ -484,7 +484,7 @@ class phpbb_functional_test_case extends phpbb_test_case } $cache = new phpbb_mock_null_cache; - $cache_driver = new phpbb_cache_driver_null(); + $cache_driver = new \phpbb\cache\driver\null(); $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) @@ -521,15 +521,15 @@ class phpbb_functional_test_case extends phpbb_test_case { global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx; - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $config['coppa_enable'] = 0; $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('phpbb_user'); - $auth = $this->getMock('phpbb_auth'); + $user = $this->getMock('\phpbb\user'); + $auth = $this->getMock('\phpbb\auth\auth'); - $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; $cache_driver = new phpbb_cache_driver_null(); @@ -560,18 +560,18 @@ class phpbb_functional_test_case extends phpbb_test_case { global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx; - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $config['coppa_enable'] = 0; $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('phpbb_user'); - $auth = $this->getMock('phpbb_auth'); + $user = $this->getMock('\phpbb\user'); + $auth = $this->getMock('\phpbb\auth\auth'); - $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; - $cache_driver = new phpbb_cache_driver_null(); + $cache_driver = new \phpbb\cache\driver\null(); $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) diff --git a/tests/test_framework/phpbb_search_test_case.php b/tests/test_framework/phpbb_search_test_case.php index 418d352c17..b929e740ea 100644 --- a/tests/test_framework/phpbb_search_test_case.php +++ b/tests/test_framework/phpbb_search_test_case.php @@ -11,7 +11,7 @@ abstract class phpbb_search_test_case extends phpbb_database_test_case { static protected function get_search_wrapper($class) { - $wrapped = $class . '_wrapper'; + $wrapped = str_replace('\\', '_', $class) . '_wrapper'; if (!class_exists($wrapped)) { $code = " diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 3d9cd10f32..4463ce19de 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -107,7 +107,7 @@ class phpbb_test_case_helpers if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) { $config = array_merge($config, array( - 'dbms' => 'phpbb_db_driver_sqlite', + 'dbms' => '\phpbb\db\driver\sqlite', 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename 'dbport' => '', 'dbname' => '', diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php index 43680609f8..ce03c1fc21 100644 --- a/tests/tree/nestedset_forum_base.php +++ b/tests/tree/nestedset_forum_base.php @@ -52,11 +52,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case global $config; - $config = $this->config = new phpbb_config(array('nestedset_forum_lock' => 0)); + $config = $this->config = new \phpbb\config\config(array('nestedset_forum_lock' => 0)); set_config(null, null, null, $this->config); - $this->lock = new phpbb_lock_db('nestedset_forum_lock', $this->config, $this->db); - $this->set = new phpbb_tree_nestedset_forum($this->db, $this->lock, 'phpbb_forums'); + $this->lock = new \phpbb\lock\db('nestedset_forum_lock', $this->config, $this->db); + $this->set = new \phpbb\tree\nestedset_forum($this->db, $this->lock, 'phpbb_forums'); $this->set_up_forums(); } @@ -97,7 +97,7 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case } else { - $buffer = new phpbb_db_sql_insert_buffer($this->db, 'phpbb_forums'); + $buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_forums'); $buffer->insert_all($forums); $buffer->flush(); diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index d7ff451a70..c7c858c59d 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -11,7 +11,7 @@ class phpbb_user_lang_test extends phpbb_test_case { public function test_user_lang_sprintf() { - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array( 'FOO' => 'BAR', 'BARZ' => 'PENG', @@ -93,7 +93,7 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array( 'PLURAL_RULE' => 13, 'ARRY' => array( diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 5cdb654b18..13c35030f9 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -24,7 +24,7 @@ class phpbb_user_loader_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->user_loader = new phpbb_user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); + $this->user_loader = new \phpbb\user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); } public function test_load_get() diff --git a/tests/wrapper/phpbb_php_ini_fake.php b/tests/wrapper/phpbb_php_ini_fake.php index 49bc5936e5..d9e96447e3 100644 --- a/tests/wrapper/phpbb_php_ini_fake.php +++ b/tests/wrapper/phpbb_php_ini_fake.php @@ -7,7 +7,7 @@ * */ -class phpbb_php_ini_fake extends phpbb_php_ini +class phpbb_php_ini_fake extends \phpbb\php\ini { function get($varname) { |