aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/acp_board/auth_provider/valid.php4
-rw-r--r--tests/bootstrap.php2
-rw-r--r--tests/class_loader/class_loader_test.php24
-rw-r--r--tests/controller/controller_test.php8
-rw-r--r--tests/controller/ext/foo/config/services.yml2
-rw-r--r--tests/controller/ext/foo/controller.php4
-rw-r--r--tests/extension/ext/bar/my/hidden_class.php4
-rw-r--r--tests/extension/ext/foo/acp/fail_info.php2
-rw-r--r--tests/functional/extension_controller_test.php2
-rw-r--r--tests/functional/extension_module_test.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/acp/main_info.php6
-rw-r--r--tests/functional/fixtures/ext/foo/bar/acp/main_module.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/config/services.yml2
-rw-r--r--tests/functional/fixtures/ext/foo/bar/controller/controller.php5
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/permission.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/user_setup.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/ext.php4
17 files changed, 52 insertions, 33 deletions
diff --git a/tests/acp_board/auth_provider/valid.php b/tests/acp_board/auth_provider/valid.php
index cfc3c24833..13ec1e3250 100644
--- a/tests/acp_board/auth_provider/valid.php
+++ b/tests/acp_board/auth_provider/valid.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_auth_provider_acp_board_valid extends \phpbb\auth\provider\base
+namespace phpbb\auth\provider\acp;
+
+class board_valid extends \phpbb\auth\provider\base
{
public function login($username, $password)
{
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 43efecce3b..afb586435c 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -18,7 +18,7 @@ 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->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_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->register();
diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php
index 255b634bd6..6e551f658a 100644
--- a/tests/class_loader/class_loader_test.php
+++ b/tests/class_loader/class_loader_test.php
@@ -36,22 +36,22 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
$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\\dir2'),
+ $class_loader->resolve_path('\\phpbb\\dir2\\dir2'),
'Class with name of dir within dir'
);
}
@@ -59,8 +59,8 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
public function test_resolve_cached()
{
$cache_map = array(
- 'class_loader_phpbb__' => array('phpbb\\a\\cached_name' => 'a/cached_name'),
- 'class_loader___' => array('phpbb\\ext\\foo' => 'foo'),
+ 'class_loader___phpbb__' => array('\\phpbb\\a\\cached_name' => 'a/cached_name'),
+ 'class_loader___' => array('\\phpbb\\ext\\foo' => 'foo'),
);
$cache = new phpbb_mock_cache($cache_map);
@@ -72,26 +72,26 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
$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/controller/controller_test.php b/tests/controller/controller_test.php
index 9445ea53d4..10fced05a2 100644
--- a/tests/controller/controller_test.php
+++ b/tests/controller/controller_test.php
@@ -53,11 +53,11 @@ class phpbb_controller_controller_test extends phpbb_test_case
// Autoloading classes within the tests folder does not work
// so I'll include them manually.
- if (!class_exists('phpbb_ext_foo_controller'))
+ if (!class_exists('foo\\controller'))
{
include(__DIR__.'/ext/foo/controller.php');
}
- if (!class_exists('phpbb_controller_foo'))
+ if (!class_exists('phpbb\\controller\\foo'))
{
include(__DIR__.'/phpbb/controller/foo.php');
}
@@ -66,11 +66,11 @@ class phpbb_controller_controller_test extends phpbb_test_case
$symfony_request = new Request();
$symfony_request->attributes->set('_controller', 'foo.controller:handle');
- $this->assertEquals($resolver->getController($symfony_request), array(new phpbb_ext_foo_controller, 'handle'));
+ $this->assertEquals($resolver->getController($symfony_request), array(new foo\controller, 'handle'));
$symfony_request = new Request();
$symfony_request->attributes->set('_controller', 'core_foo.controller:bar');
- $this->assertEquals($resolver->getController($symfony_request), array(new phpbb_controller_foo, 'bar'));
+ $this->assertEquals($resolver->getController($symfony_request), array(new phpbb\controller\foo, 'bar'));
}
}
diff --git a/tests/controller/ext/foo/config/services.yml b/tests/controller/ext/foo/config/services.yml
index ce0e18c610..9ed67d5bc2 100644
--- a/tests/controller/ext/foo/config/services.yml
+++ b/tests/controller/ext/foo/config/services.yml
@@ -1,3 +1,3 @@
services:
foo.controller:
- class: phpbb_ext_foo_controller
+ class: foo\controller
diff --git a/tests/controller/ext/foo/controller.php b/tests/controller/ext/foo/controller.php
index cfc5c20622..ce2233b3c9 100644
--- a/tests/controller/ext/foo/controller.php
+++ b/tests/controller/ext/foo/controller.php
@@ -1,8 +1,10 @@
<?php
+namespace foo;
+
use Symfony\Component\HttpFoundation\Response;
-class phpbb_ext_foo_controller
+class controller
{
/**
* Handle method
diff --git a/tests/extension/ext/bar/my/hidden_class.php b/tests/extension/ext/bar/my/hidden_class.php
index 0261d7c59a..504c1873dc 100644
--- a/tests/extension/ext/bar/my/hidden_class.php
+++ b/tests/extension/ext/bar/my/hidden_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_bar_my_hidden_class
+namespace bar\my;
+
+class hidden_class
{
}
diff --git a/tests/extension/ext/foo/acp/fail_info.php b/tests/extension/ext/foo/acp/fail_info.php
index caea441f99..01d29fc5eb 100644
--- a/tests/extension/ext/foo/acp/fail_info.php
+++ b/tests/extension/ext/foo/acp/fail_info.php
@@ -11,7 +11,7 @@ class foo_info
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_acp_fail_module',
+ 'filename' => 'foo\acp\fail_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index dc6d9c0f65..41bd48c204 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -78,7 +78,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
$this->phpbb_extension_manager->enable('foo/bar');
$crawler = self::request('GET', 'app.php/foo/baz', array(), false);
$this->assert_response_html(500);
- $this->assertContains('Missing value for argument #1: test in class phpbb_ext_foo_bar_controller:baz', $crawler->filter('body')->text());
+ $this->assertContains('Missing value for argument #1: test in class foo\bar\controller\controller:baz', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php
index c31a892ce9..0c9e0b1654 100644
--- a/tests/functional/extension_module_test.php
+++ b/tests/functional/extension_module_test.php
@@ -69,7 +69,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
$modules->update_module_data($parent_data, true);
$module_data = array(
- 'module_basename' => 'phpbb_ext_foo_bar_acp_main_module',
+ 'module_basename' => 'foo\\bar\\acp\\main_module',
'module_enabled' => 1,
'module_display' => 1,
'parent_id' => $parent_data['module_id'],
@@ -90,7 +90,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
{
$this->login();
$this->admin_login();
- $crawler = self::request('GET', 'adm/index.php?i=phpbb_ext_foo_bar_acp_main_module&mode=mode&sid=' . $this->sid);
+ $crawler = self::request('GET', 'adm/index.php?i=foo\\bar\\acp\\main_module&mode=mode&sid=' . $this->sid);
$this->assertContains("Bertie rulez!", $crawler->filter('#main')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
index 21e38b09b5..2ad6d08503 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\acp;
+
/**
* @ignore
*/
@@ -16,12 +18,12 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_ext_foo_bar_acp_main_info
+class main_info
{
function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_bar_acp_main_module',
+ 'filename' => 'foo\bar\acp\main_module',
'title' => 'ACP_FOOBAR_TITLE',
'version' => '1.0.0',
'modes' => array(
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
index c4ab69fb38..c59b3c6820 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\acp;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_ext_foo_bar_acp_main_module
+class main_module
{
var $u_action;
diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml
index 33ced55af9..3bca4c6567 100644
--- a/tests/functional/fixtures/ext/foo/bar/config/services.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml
@@ -1,6 +1,6 @@
services:
foo_bar.controller:
- class: phpbb_ext_foo_bar_controller
+ class: foo\bar\controller\controller
arguments:
- @controller.helper
- @template
diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
index 41b2be350b..259d548299 100644
--- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php
+++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
@@ -1,7 +1,10 @@
<?php
+
+namespace foo\bar\controller;
+
use Symfony\Component\HttpFoundation\Response;
-class phpbb_ext_foo_bar_controller
+class controller
{
protected $template;
diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php
index 48688a586a..92e24074ad 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/permission.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\event;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface
+class permission implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
index 3d2d0c5325..1409f97470 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\event;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class phpbb_ext_foo_bar_event_user_setup implements EventSubscriberInterface
+class user_setup implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php
index b839cef36c..1288edd5ec 100644
--- a/tests/functional/fixtures/ext/foo/bar/ext.php
+++ b/tests/functional/fixtures/ext/foo/bar/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_foo_bar_ext extends \phpbb\extension\base
+namespace foo\bar;
+
+class ext extends \phpbb\extension\base
{
}