aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2014-08-24 22:32:54 +0200
committerAndreas Fischer <bantu@phpbb.com>2014-08-24 22:32:54 +0200
commit9fc5073540fe23c0b32d6eac667560f1b7204b50 (patch)
treedb6f81ad7cf6662ee35e3b4f177ba376d144f749
parent154710aa50f8277c72958f181c676d9d0d72317d (diff)
parent0386b1788a56ef36c435796c74924d35331a1779 (diff)
downloadforums-9fc5073540fe23c0b32d6eac667560f1b7204b50.tar
forums-9fc5073540fe23c0b32d6eac667560f1b7204b50.tar.gz
forums-9fc5073540fe23c0b32d6eac667560f1b7204b50.tar.bz2
forums-9fc5073540fe23c0b32d6eac667560f1b7204b50.tar.xz
forums-9fc5073540fe23c0b32d6eac667560f1b7204b50.zip
Merge pull request #2905 from Nicofuma/ticket/13008
[ticket/13008] Use an absolute path with the FileLocator for the routing files * Nicofuma/ticket/13008: [ticket/13008] Add functionnal test [ticket/13008] Use an absolute path with the FileLocator for the routing files
-rw-r--r--phpBB/phpbb/controller/provider.php2
-rw-r--r--tests/functional/extension_controller_test.php14
-rw-r--r--tests/functional/fixtures/ext/foo/foo/composer.json24
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/resource.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/routing.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/services.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/controller/controller.php13
-rw-r--r--tests/functional/fixtures/ext/foo/foo/ext.php8
8 files changed, 69 insertions, 1 deletions
diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php
index fffd4f0428..7e26848290 100644
--- a/phpBB/phpbb/controller/provider.php
+++ b/phpBB/phpbb/controller/provider.php
@@ -73,7 +73,7 @@ class provider
$this->routes = new RouteCollection;
foreach ($this->routing_files as $file_path)
{
- $loader = new YamlFileLoader(new FileLocator($base_path));
+ $loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path)));
$this->routes->addCollection($loader->load($file_path));
}
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 532a160a47..18eb9ad4c6 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -26,6 +26,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
'foo/bar/event/',
'foo/bar/language/en/',
'foo/bar/styles/prosilver/template/',
+ 'foo/foo/config/',
+ 'foo/foo/controller/',
);
static public function setUpBeforeClass()
@@ -65,6 +67,18 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
}
/**
+ * Check a controller for extension foo/bar.
+ */
+ public function test_routing_resources()
+ {
+ $this->phpbb_extension_manager->enable('foo/foo');
+ $crawler = self::request('GET', 'app.php/foo/foo', array(), false);
+ self::assert_response_status_code();
+ $this->assertContains("foo/foo controller handle() method", $crawler->filter('body')->text());
+ $this->phpbb_extension_manager->purge('foo/foo');
+ }
+
+ /**
* Check the output of a controller using the template system
*/
public function test_controller_with_template()
diff --git a/tests/functional/fixtures/ext/foo/foo/composer.json b/tests/functional/fixtures/ext/foo/foo/composer.json
new file mode 100644
index 0000000000..d85c76a6a2
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/composer.json
@@ -0,0 +1,24 @@
+{
+ "name": "foo/foo",
+ "type": "phpbb-extension",
+ "description": "Testing extensions",
+ "homepage": "",
+ "version": "1.0.0",
+ "time": "2013-03-21 01:01:01",
+ "license": "GPL-2.0",
+ "authors": [{
+ "name": "Tristan Darricau",
+ "email": "nicofuma@phpbb.com",
+ "homepage": "http://www.phpbb.com",
+ "role": "Developer"
+ }],
+ "require": {
+ "php": ">=5.3"
+ },
+ "extra": {
+ "display-name": "phpBB 3.1 Extension Testing",
+ "soft-require": {
+ "phpbb/phpbb": "3.1.*@dev"
+ }
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/foo/config/resource.yml b/tests/functional/fixtures/ext/foo/foo/config/resource.yml
new file mode 100644
index 0000000000..ed1d018016
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/resource.yml
@@ -0,0 +1,3 @@
+foo_foo_controller:
+ pattern: /foo
+ defaults: { _controller: foo_foo.controller:handle }
diff --git a/tests/functional/fixtures/ext/foo/foo/config/routing.yml b/tests/functional/fixtures/ext/foo/foo/config/routing.yml
new file mode 100644
index 0000000000..c2c401687d
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/routing.yml
@@ -0,0 +1,3 @@
+foo_foo.general:
+ resource: "resource.yml"
+ prefix: /foo
diff --git a/tests/functional/fixtures/ext/foo/foo/config/services.yml b/tests/functional/fixtures/ext/foo/foo/config/services.yml
new file mode 100644
index 0000000000..b3c7719715
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/services.yml
@@ -0,0 +1,3 @@
+services:
+ foo_foo.controller:
+ class: foo\foo\controller\controller
diff --git a/tests/functional/fixtures/ext/foo/foo/controller/controller.php b/tests/functional/fixtures/ext/foo/foo/controller/controller.php
new file mode 100644
index 0000000000..771eaeacfc
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/controller/controller.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace foo\foo\controller;
+
+use Symfony\Component\HttpFoundation\Response;
+
+class controller
+{
+ public function handle()
+ {
+ return new Response('foo/foo controller handle() method', 200);
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/foo/ext.php b/tests/functional/fixtures/ext/foo/foo/ext.php
new file mode 100644
index 0000000000..80acda74fe
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/ext.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace foo\foo;
+
+class ext extends \phpbb\extension\base
+{
+
+}