1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/12620] Add support of the environments for the ext routing files

PHPBB3-12620
This commit is contained in:
Tristan Darricau
2014-09-05 16:33:57 +02:00
parent 7cd0fd83b8
commit 014eed385b
7 changed files with 40 additions and 8 deletions

View File

@@ -113,12 +113,6 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
)
);
$finder = new \phpbb\finder(
new \phpbb\filesystem(),
dirname(__FILE__) . '/',
new phpbb_mock_cache()
);
$finder->set_extensions(array_keys($this->extension_manager->all_enabled()));
$this->router = new phpbb_mock_router($this->extension_manager, dirname(__FILE__) . '/', 'php');
$this->router->find_routing_files($finder);
$this->router->find(dirname(__FILE__) . '/');

View File

@@ -30,6 +30,11 @@ class phpbb_controller_controller_test extends phpbb_test_case
'ext_active' => '1',
'ext_path' => 'ext/vendor2/foo/',
),
'vendor2/bar' => array(
'ext_name' => 'vendor2/bar',
'ext_active' => '1',
'ext_path' => 'ext/vendor2/bar/',
),
));
}
@@ -49,6 +54,9 @@ 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->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('controller3'));
$this->assertEquals('/bar', $routes->get('controller3')->getPath());
$this->assertNull($routes->get('controller_noroute'));
}

View File

@@ -0,0 +1,3 @@
controller3:
pattern: /bar
defaults: { _controller: bar.controller:handle }

View File

@@ -0,0 +1,3 @@
services:
bar.controller:
class: bar\controller

View File

@@ -0,0 +1,18 @@
<?php
namespace bar;
use Symfony\Component\HttpFoundation\Response;
class controller
{
/**
* Handle method
*
* @return null
*/
public function handle()
{
return new Response('Test', 200);
}
}