diff options
Diffstat (limited to 'tests/controller')
-rw-r--r-- | tests/controller/config/services.yml | 2 | ||||
-rw-r--r-- | tests/controller/controller_test.php | 12 | ||||
-rw-r--r-- | tests/controller/ext/foo/config/services.yml | 2 | ||||
-rw-r--r-- | tests/controller/ext/foo/controller.php | 4 | ||||
-rw-r--r-- | tests/controller/helper_url_test.php | 26 | ||||
-rw-r--r-- | tests/controller/phpbb/controller/foo.php | 4 |
6 files changed, 28 insertions, 22 deletions
diff --git a/tests/controller/config/services.yml b/tests/controller/config/services.yml index f1bd047489..e4412af3d7 100644 --- a/tests/controller/config/services.yml +++ b/tests/controller/config/services.yml @@ -1,3 +1,3 @@ services: core_foo.controller: - class: phpbb_controller_foo + class: phpbb\controller\foo diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index dfc4f80469..10fced05a2 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/'); @@ -53,24 +53,24 @@ 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'); } - $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'); - $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/controller/helper_url_test.php b/tests/controller/helper_url_test.php index 2dd7269caa..33fc6c4f1b 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -48,19 +48,20 @@ 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'); - $phpbb_filesystem = new phpbb_filesystem( - new phpbb_symfony_request( + $this->user = $this->getMock('\phpbb\user'); + $phpbb_path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); - $this->template = new phpbb_template_twig($phpbb_filesystem, $config, $this->user, new phpbb_template_context()); + $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $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); } @@ -100,18 +101,19 @@ 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'); - $phpbb_filesystem = new phpbb_filesystem( - new phpbb_symfony_request( + $this->user = $this->getMock('\phpbb\user'); + $phpbb_path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); - $this->template = new phpbb_template_twig($phpbb_filesystem, $config, $this->user, new phpbb_template_context()); + $this->template = new \phpbb\template\twig\twig($phpbb_path_helper, $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/controller/phpbb/controller/foo.php b/tests/controller/phpbb/controller/foo.php index 04576e16c4..98669f428f 100644 --- a/tests/controller/phpbb/controller/foo.php +++ b/tests/controller/phpbb/controller/foo.php @@ -1,8 +1,10 @@ <?php +namespace phpbb\controller; + use Symfony\Component\HttpFoundation\Response; -class phpbb_controller_foo +class foo { /** * Bar method |