From 06158693c7b846518abfe9d72491fc7376e457f3 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 19 Oct 2012 19:54:19 -0400 Subject: [feature/controller] Implement a front controller PHPBB3-10864 --- tests/controller/controller_test.php | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/controller/controller_test.php (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php new file mode 100644 index 0000000000..38f58c80a0 --- /dev/null +++ b/tests/controller/controller_test.php @@ -0,0 +1,75 @@ +extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'foo' => array( + 'ext_name' => 'foo', + 'ext_active' => '1', + 'ext_path' => 'ext/foo/', + ), + )); + } + + public function test_provider() + { + $provider = new phpbb_controller_provider; + $routes = $provider + ->get_paths($this->extension_manager->get_finder()) + ->find('./tests/controller/'); + + // This will need to be updated if any new routes are defined + $this->assertEquals(2, count($routes)); + } + + public function test_controller_resolver() + { + $container = new ContainerBuilder(); + // For some reason, I cannot get it to load more than one services + // file at a time, even when givein multiple paths + // So instead, I am looping through all of the paths + foreach (array(__DIR__.'/config', __DIR__.'/ext/foo/config') as $path) + { + $loader = new YamlFileLoader($container, new FileLocator($path)); + $loader->load('services.yml'); + } + + // Autoloading classes within the tests folder does not work + // so I'll include them manually + if (!class_exists('phpbb_ext_foo_controller')) + { + include(__DIR__.'/ext/foo/controller.php'); + } + if (!class_exists('phpbb_controller_foo')) + { + include(__DIR__.'/includes/controller/foo.php'); + } + + $resolver = new phpbb_controller_resolver(new phpbb_user, $container); + $symfony_request = new Request(array(), array(), array('_controller' => 'foo.controller:handle')); + + $this->assertEquals($resolver->getController($symfony_request), array(new phpbb_ext_foo_controller, 'handle')); + + $symfony_request = new Request(array(), array(), array('_controller' => 'core_foo.controller:bar')); + + $this->assertEquals($resolver->getController($symfony_request), array(new phpbb_controller_foo, 'bar')); + } +} -- cgit v1.2.1 From 79bcbd3691a91e213a860dbcd1b11330752bd076 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 13 Nov 2012 09:48:12 -0500 Subject: [feature/controller] Add _controller attribute to Request after instantiation PHPBB3-10864 --- tests/controller/controller_test.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 38f58c80a0..b73019a6a0 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -64,11 +64,13 @@ class phpbb_controller_test extends phpbb_test_case } $resolver = new phpbb_controller_resolver(new phpbb_user, $container); - $symfony_request = new Request(array(), array(), array('_controller' => 'foo.controller:handle')); + $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')); - $symfony_request = new Request(array(), array(), array('_controller' => 'core_foo.controller:bar')); + $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')); } -- cgit v1.2.1 From a87a5dd566bd4b9481cdca86fa6f4bc3363d58de Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 15 Nov 2012 16:31:32 -0500 Subject: [feature/controller] Fix tests PHPBB3-10864 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index b73019a6a0..577feee517 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -33,7 +33,7 @@ class phpbb_controller_test extends phpbb_test_case { $provider = new phpbb_controller_provider; $routes = $provider - ->get_paths($this->extension_manager->get_finder()) + ->import_paths_from_finder($this->extension_manager->get_finder()) ->find('./tests/controller/'); // This will need to be updated if any new routes are defined -- cgit v1.2.1 From e516680859744e69b696ac0054ec3aefd94175b7 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Nov 2012 10:28:35 -0500 Subject: [feature/controller] Use sizeof() instead of count() as per guidelines PHPBB3-10864 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 577feee517..5a4c65e109 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -37,7 +37,7 @@ class phpbb_controller_test extends phpbb_test_case ->find('./tests/controller/'); // This will need to be updated if any new routes are defined - $this->assertEquals(2, count($routes)); + $this->assertEquals(2, sizeof($routes)); } public function test_controller_resolver() -- cgit v1.2.1 From 230897723c9e5fc5534d9781b04ffd8dac70d51b Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Nov 2012 10:29:35 -0500 Subject: [feature/controller] Reword comment for clarification PHPBB3-10864 --- tests/controller/controller_test.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 5a4c65e109..198fb3c6dd 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -43,9 +43,8 @@ class phpbb_controller_test extends phpbb_test_case public function test_controller_resolver() { $container = new ContainerBuilder(); - // For some reason, I cannot get it to load more than one services - // file at a time, even when givein multiple paths - // So instead, I am looping through all of the paths + // YamlFileLoader only uses one path at a time, so we need to loop + // through all of the ones we are using. foreach (array(__DIR__.'/config', __DIR__.'/ext/foo/config') as $path) { $loader = new YamlFileLoader($container, new FileLocator($path)); @@ -53,7 +52,7 @@ class phpbb_controller_test extends phpbb_test_case } // Autoloading classes within the tests folder does not work - // so I'll include them manually + // so I'll include them manually. if (!class_exists('phpbb_ext_foo_controller')) { include(__DIR__.'/ext/foo/controller.php'); -- cgit v1.2.1 From d3e2fae66d74f79ef7dcfe2e24f47efaa5c106e2 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 15 Feb 2013 16:48:43 -0500 Subject: [ticket/11334] Add a test for the controller helper URL method PHPBB3-11334 --- tests/controller/controller_test.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 198fb3c6dd..97f6d6152a 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -40,6 +40,12 @@ class phpbb_controller_test extends phpbb_test_case $this->assertEquals(2, sizeof($routes)); } + public function test_controller_url_helper() + { + $helper = new phpbb_controller_helper; + $this->assertEquals($helper->url('foo/bar'),'./app.php?controller=foo/bar'); + } + public function test_controller_resolver() { $container = new ContainerBuilder(); -- cgit v1.2.1 From 48aefb13b0f66dd84f5e7a2f18ca485fabe4833b Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 16 Feb 2013 19:18:16 -0500 Subject: [ticket/11334] Make $phpbb_dispatcher global, as done in append_sid test PHPBB3-11334 --- tests/controller/controller_test.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 97f6d6152a..c4818dbd6a 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -42,6 +42,9 @@ class phpbb_controller_test extends phpbb_test_case public function test_controller_url_helper() { + global $phpbb_dispatcher; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; $helper = new phpbb_controller_helper; $this->assertEquals($helper->url('foo/bar'),'./app.php?controller=foo/bar'); } -- cgit v1.2.1 From cd697e68129868dc811c141660652360e0f0f983 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 15 Mar 2013 13:35:00 +0100 Subject: [ticket/11334] Include functions.php and fix class name in tests PHPBB3-11334 --- tests/controller/controller_test.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c4818dbd6a..8cdedb27e2 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -7,6 +7,8 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; @@ -14,7 +16,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -class phpbb_controller_test extends phpbb_test_case +class phpbb_controller_controller_test extends phpbb_test_case { public function setUp() { -- cgit v1.2.1 From 9259e635cacce34699115b909f256f9302ec3aaa Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 15 Mar 2013 14:01:15 +0100 Subject: [ticket/11334] Move unit tests for helper->url() into own file PHPBB3-11334 --- tests/controller/controller_test.php | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 8cdedb27e2..c06bf7d548 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; @@ -42,15 +40,6 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->assertEquals(2, sizeof($routes)); } - public function test_controller_url_helper() - { - global $phpbb_dispatcher; - - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $helper = new phpbb_controller_helper; - $this->assertEquals($helper->url('foo/bar'),'./app.php?controller=foo/bar'); - } - public function test_controller_resolver() { $container = new ContainerBuilder(); -- cgit v1.2.1 From 7030578bbe9e11c18b5becaf8b06e670e3c2e3cd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 01:32:34 -0400 Subject: [ticket/11698] Moving all autoloadable files to phpbb/ PHPBB3-11698 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c06bf7d548..dfc4f80469 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -59,7 +59,7 @@ class phpbb_controller_controller_test extends phpbb_test_case } if (!class_exists('phpbb_controller_foo')) { - include(__DIR__.'/includes/controller/foo.php'); + include(__DIR__.'/phpbb/controller/foo.php'); } $resolver = new phpbb_controller_resolver(new phpbb_user, $container); -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- tests/controller/controller_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/controller/controller_test.php') 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'); -- cgit v1.2.1 From fe36375a36ec4f816eb07b41630b6c9fa7ff12c8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 18:29:08 +0200 Subject: [ticket/11700] Fix extension loading with namespaces class loader now expects all classes to be prefixed with a backslash when resolving paths PHPBB3-11700 --- tests/controller/controller_test.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/controller/controller_test.php') 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')); } } -- cgit v1.2.1 From 3cc2e619d2a3293aebfdef06f6298a71648112b1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 19 Oct 2013 12:11:09 +0200 Subject: [ticket/11948] Add second routing file to tests PHPBB3-11948 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 10fced05a2..0e7cac05ec 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -37,7 +37,7 @@ class phpbb_controller_controller_test extends phpbb_test_case ->find('./tests/controller/'); // This will need to be updated if any new routes are defined - $this->assertEquals(2, sizeof($routes)); + $this->assertEquals(3, sizeof($routes)); } public function test_controller_resolver() -- cgit v1.2.1 From 51561ed538450d0e3d8392f3073004751e0b03f1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Oct 2013 21:52:48 +0200 Subject: [ticket/11948] Allow resource importing for routing PHPBB3-11948 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 0e7cac05ec..c71fc92170 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -34,7 +34,7 @@ class phpbb_controller_controller_test extends phpbb_test_case $provider = new \phpbb\controller\provider; $routes = $provider ->import_paths_from_finder($this->extension_manager->get_finder()) - ->find('./tests/controller/'); + ->find(__DIR__); // This will need to be updated if any new routes are defined $this->assertEquals(3, sizeof($routes)); -- cgit v1.2.1 From 96317b2c4518976c683dd67f38a8a6f8faabdf15 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Oct 2013 22:18:03 +0200 Subject: [ticket/11948] Check actual result of routes PHPBB3-11948 --- tests/controller/controller_test.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c71fc92170..588adbcfb1 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -37,7 +37,14 @@ class phpbb_controller_controller_test extends phpbb_test_case ->find(__DIR__); // This will need to be updated if any new routes are defined - $this->assertEquals(3, sizeof($routes)); + $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('core_controller')); + $this->assertEquals('/core_foo', $routes->get('core_controller')->getPath()); + + $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('controller1')); + $this->assertEquals('/foo', $routes->get('controller1')->getPath()); + + $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('controller2')); + $this->assertEquals('/foo/bar', $routes->get('controller2')->getPath()); } public function test_controller_resolver() -- cgit v1.2.1 From 51273f6fb1421b68c1931c3960f68cd483f1ee95 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 7 Mar 2014 12:32:38 +0100 Subject: [ticket/12090] Pass route name to url() to allow admins to change the routes PHPBB3-12090 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 588adbcfb1..b65e677dbe 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -62,7 +62,7 @@ class phpbb_controller_controller_test extends phpbb_test_case // so I'll include them manually. if (!class_exists('foo\\controller')) { - include(__DIR__.'/ext/foo/controller.php'); + include(__DIR__ . '/ext/foo/controller.php'); } if (!class_exists('phpbb\\controller\\foo')) { -- cgit v1.2.1 From ecf1e94726a8a1e0f8d30aba3935e1899c2c6adc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 7 Mar 2014 12:42:06 +0100 Subject: [ticket/12090] Change redirect tests to use route() PHPBB3-12090 --- tests/controller/controller_test.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index b65e677dbe..8709f449db 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -21,10 +21,10 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( - 'foo' => array( - 'ext_name' => 'foo', + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', 'ext_active' => '1', - 'ext_path' => 'ext/foo/', + 'ext_path' => 'ext/vendor2/foo/', ), )); } @@ -52,7 +52,7 @@ class phpbb_controller_controller_test extends phpbb_test_case $container = new ContainerBuilder(); // YamlFileLoader only uses one path at a time, so we need to loop // through all of the ones we are using. - foreach (array(__DIR__.'/config', __DIR__.'/ext/foo/config') as $path) + foreach (array(__DIR__.'/config', __DIR__ . '/ext/vendor2/foo/config') as $path) { $loader = new YamlFileLoader($container, new FileLocator($path)); $loader->load('services.yml'); @@ -60,9 +60,9 @@ 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('foo\\controller')) + if (!class_exists('vendor2\\foo\\controller')) { - include(__DIR__ . '/ext/foo/controller.php'); + include(__DIR__ . '/ext/vendor2/foo/controller.php'); } if (!class_exists('phpbb\\controller\\foo')) { -- cgit v1.2.1 From 07c07171f9b70a49b592473b8a8400d3838333a3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 8 Mar 2014 16:32:43 +0100 Subject: [ticket/12090] Make provider a service and inject it into the helper PHPBB3-12090 --- tests/controller/controller_test.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 8709f449db..597f01fa0f 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -31,10 +31,8 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { - $provider = new \phpbb\controller\provider; - $routes = $provider - ->import_paths_from_finder($this->extension_manager->get_finder()) - ->find(__DIR__); + $provider = new \phpbb\controller\provider($this->extension_manager->get_finder()); + $routes = $provider->find(__DIR__); // This will need to be updated if any new routes are defined $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('core_controller')); -- cgit v1.2.1 From 2eb24d0ace239324086002db4582eaaddd07aa28 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 9 Mar 2014 18:38:21 +0100 Subject: [ticket/12090] Split finding routes and returning routes into 2 methods PHPBB3-12090 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 597f01fa0f..550679ff07 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -32,7 +32,7 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { $provider = new \phpbb\controller\provider($this->extension_manager->get_finder()); - $routes = $provider->find(__DIR__); + $routes = $provider->find(__DIR__)->get_routes(); // This will need to be updated if any new routes are defined $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('core_controller')); -- cgit v1.2.1 From a470b6c519065b932b2e41e021df52cde7eaa848 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 2 May 2014 22:48:28 +0200 Subject: [ticket/12480] Add subfolder/config/routing.yml which should not be found PHPBB3-12480 --- tests/controller/controller_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 550679ff07..998730589b 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -43,6 +43,8 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('controller2')); $this->assertEquals('/foo/bar', $routes->get('controller2')->getPath()); + + $this->assertNull($routes->get('controller_noroute')); } public function test_controller_resolver() -- cgit v1.2.1 From ed089f4b5fa072c9298bd1a2bffae97da4a2616c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 2 May 2014 22:52:20 +0200 Subject: [ticket/12480] Remove unused use statements PHPBB3-12480 --- tests/controller/controller_test.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 998730589b..7d9fe652eb 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -8,8 +8,6 @@ */ use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -- cgit v1.2.1 From dc6e2be884fdb8d869e7da03984014fd18e30ae2 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 23:03:03 +0200 Subject: [ticket/11497] Remove 'ext.finder' from services' list PHPBB3-11497 --- tests/controller/controller_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 7d9fe652eb..c6d58d70ab 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -29,7 +29,8 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { - $provider = new \phpbb\controller\provider($this->extension_manager->get_finder()); + $provider = new \phpbb\controller\provider(); + $provider->set_ext_finder($this->extension_manager->get_finder()); $routes = $provider->find(__DIR__)->get_routes(); // This will need to be updated if any new routes are defined -- cgit v1.2.1 From 346c6f39980fe060b57549a8364f2e5dece1eb83 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 5 May 2014 18:20:14 +0200 Subject: [ticket/11497] Rename set_ext_finder in find_routing_files PHPBB3-11497 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c6d58d70ab..7b8b78dd22 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -30,7 +30,7 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { $provider = new \phpbb\controller\provider(); - $provider->set_ext_finder($this->extension_manager->get_finder()); + $provider->find_routing_files($this->extension_manager->get_finder()); $routes = $provider->find(__DIR__)->get_routes(); // This will need to be updated if any new routes are defined -- cgit v1.2.1 From 197c801746b148e6bcf7b5824e9077c185bf4e5f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 14:10:19 +0200 Subject: [ticket/12529] Use root_path in controller\resolver to check the template dir PHPBB3-12529 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 7b8b78dd22..630757dfd7 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -68,7 +68,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, dirname(__FILE__) . '/', $container); $symfony_request = new Request(); $symfony_request->attributes->set('_controller', 'foo.controller:handle'); -- cgit v1.2.1 From 16cd1db59a3e089fd07b2b2a7586e32e73a780e9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 15:10:14 +0200 Subject: [ticket/12529] Move $phpbb_root_path to the end of the constructor PHPBB3-12529 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 630757dfd7..e0564f0a11 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -68,7 +68,7 @@ class phpbb_controller_controller_test extends phpbb_test_case include(__DIR__.'/phpbb/controller/foo.php'); } - $resolver = new \phpbb\controller\resolver(new \phpbb\user, dirname(__FILE__) . '/', $container); + $resolver = new \phpbb\controller\resolver(new \phpbb\user, $container, dirname(__FILE__) . '/'); $symfony_request = new Request(); $symfony_request->attributes->set('_controller', 'foo.controller:handle'); -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- tests/controller/controller_test.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index e0564f0a11..67faf83e29 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1 From 8d99b4afe1557a6ec0e760c4876bb06a3b9991d3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 10 Aug 2014 13:40:27 +0200 Subject: [ticket/12932] Fix tests and calls to create_datetime PHPBB3-12932 --- tests/controller/controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 67faf83e29..58bcf0ef81 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -72,7 +72,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, dirname(__FILE__) . '/'); + $resolver = new \phpbb\controller\resolver(new \phpbb\user('\phpbb\datetime'), $container, dirname(__FILE__) . '/'); $symfony_request = new Request(); $symfony_request->attributes->set('_controller', 'foo.controller:handle'); -- cgit v1.2.1 From 21c8985fe85d54facc9dce59f6b7cbd293b21ade Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 Nov 2014 01:35:13 +0100 Subject: [ticket/13338] Add include statements for dependencies. PHPBB3-13338 --- tests/controller/controller_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/controller/controller_test.php') diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 58bcf0ef81..62feee3fed 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -11,6 +11,8 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; -- cgit v1.2.1