diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/avatar/manager_test.php | 16 | ||||
-rw-r--r-- | tests/controller/controller_test.php | 11 | ||||
-rw-r--r-- | tests/controller/ext/foo/config/routing.yml | 4 | ||||
-rw-r--r-- | tests/controller/ext/foo/config/routing_2.yml | 3 |
4 files changed, 28 insertions, 6 deletions
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index ba1fb04b33..0db3f13617 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -25,9 +25,17 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase $config = new \phpbb\config\config(array()); $request = $this->getMock('\phpbb\request\request'); $cache = $this->getMock('\phpbb\cache\driver\driver_interface'); + $path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() + ), + new \phpbb\filesystem(), + $this->phpbb_root_path, + $this->phpEx + ); // $this->avatar_foobar will be needed later on - $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache)); + $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $cache)); $this->avatar_foobar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.foobar')); @@ -40,7 +48,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase foreach ($this->avatar_drivers() as $driver) { - $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache)); + $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $cache)); $cur_avatar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.' . $driver)); @@ -104,7 +112,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase public function test_get_driver_enabled($driver_name, $expected) { $driver = $this->manager->get_driver($driver_name); - $this->assertEquals($expected, $driver); + $this->assertEquals($expected, ($driver === null) ? null : $driver->get_name()); } public function get_driver_data_all() @@ -125,7 +133,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase public function test_get_driver_all($driver_name, $expected) { $driver = $this->manager->get_driver($driver_name, false); - $this->assertEquals($expected, $driver); + $this->assertEquals($expected, ($driver === null) ? $driver : $driver->get_name()); } public function test_get_avatar_settings() diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 10fced05a2..588adbcfb1 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -34,10 +34,17 @@ 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(2, 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() diff --git a/tests/controller/ext/foo/config/routing.yml b/tests/controller/ext/foo/config/routing.yml index 4799fec37d..6cc275d96d 100644 --- a/tests/controller/ext/foo/config/routing.yml +++ b/tests/controller/ext/foo/config/routing.yml @@ -1,3 +1,7 @@ controller1: pattern: /foo defaults: { _controller: foo.controller:handle } + +include_controller2: + resource: "routing_2.yml" + prefix: /foo diff --git a/tests/controller/ext/foo/config/routing_2.yml b/tests/controller/ext/foo/config/routing_2.yml new file mode 100644 index 0000000000..35fff27037 --- /dev/null +++ b/tests/controller/ext/foo/config/routing_2.yml @@ -0,0 +1,3 @@ +controller2: + pattern: /bar + defaults: { _controller: foo.controller:handle } |