aboutsummaryrefslogtreecommitdiffstats
path: root/tests/extension
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extension')
-rw-r--r--tests/extension/ext/bar/ext.php4
-rw-r--r--tests/extension/ext/bar/my/hidden_class.php4
-rw-r--r--tests/extension/ext/barfoo/acp/a_info.php6
-rw-r--r--tests/extension/ext/barfoo/acp/a_module.php4
-rw-r--r--tests/extension/ext/barfoo/ext.php4
-rw-r--r--tests/extension/ext/foo/a_class.php4
-rw-r--r--tests/extension/ext/foo/acp/a_info.php6
-rw-r--r--tests/extension/ext/foo/acp/a_module.php4
-rw-r--r--tests/extension/ext/foo/acp/fail_info.php7
-rw-r--r--tests/extension/ext/foo/acp/fail_module.php5
-rw-r--r--tests/extension/ext/foo/b_class.php4
-rw-r--r--tests/extension/ext/foo/ext.php4
-rw-r--r--tests/extension/ext/foo/mcp/a_info.php6
-rw-r--r--tests/extension/ext/foo/mcp/a_module.php4
-rw-r--r--tests/extension/ext/foo/sub/type/alternative.php4
-rw-r--r--tests/extension/ext/foo/type/alternative.php4
-rw-r--r--tests/extension/ext/foo/typewrong/error.php4
-rw-r--r--tests/extension/ext/vendor/moo/ext.php4
-rw-r--r--tests/extension/ext/vendor/moo/feature_class.php4
-rw-r--r--tests/extension/finder_test.php36
-rw-r--r--tests/extension/manager_test.php28
-rw-r--r--tests/extension/metadata_manager_test.php71
-rw-r--r--tests/extension/modules_test.php38
-rw-r--r--tests/extension/style_path_provider_test.php50
-rw-r--r--tests/extension/subdir/style_path_provider_test.php18
25 files changed, 159 insertions, 168 deletions
diff --git a/tests/extension/ext/bar/ext.php b/tests/extension/ext/bar/ext.php
index 5585edf9ac..22ff5e8077 100644
--- a/tests/extension/ext/bar/ext.php
+++ b/tests/extension/ext/bar/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_bar_ext extends phpbb_extension_base
+namespace bar;
+
+class ext extends \phpbb\extension\base
{
static public $state;
diff --git a/tests/extension/ext/bar/my/hidden_class.php b/tests/extension/ext/bar/my/hidden_class.php
index 0261d7c59a..504c1873dc 100644
--- a/tests/extension/ext/bar/my/hidden_class.php
+++ b/tests/extension/ext/bar/my/hidden_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_bar_my_hidden_class
+namespace bar\my;
+
+class hidden_class
{
}
diff --git a/tests/extension/ext/barfoo/acp/a_info.php b/tests/extension/ext/barfoo/acp/a_info.php
index cd7e4e574b..ea07189f7a 100644
--- a/tests/extension/ext/barfoo/acp/a_info.php
+++ b/tests/extension/ext/barfoo/acp/a_info.php
@@ -1,11 +1,13 @@
<?php
-class phpbb_ext_barfoo_acp_a_info
+namespace barfoo\acp;
+
+class a_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'filename' => 'barfoo\\acp\\a_module',
'title' => 'Barfoo',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/barfoo/acp/a_module.php b/tests/extension/ext/barfoo/acp/a_module.php
index 5bedb49645..0ae8775013 100644
--- a/tests/extension/ext/barfoo/acp/a_module.php
+++ b/tests/extension/ext/barfoo/acp/a_module.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_barfoo_acp_a_module
+namespace barfoo\acp;
+
+class a_module
{
}
diff --git a/tests/extension/ext/barfoo/ext.php b/tests/extension/ext/barfoo/ext.php
index 2e11ece8d1..1b7bb7ca5e 100644
--- a/tests/extension/ext/barfoo/ext.php
+++ b/tests/extension/ext/barfoo/ext.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_barfoo_ext extends phpbb_extension_base
+namespace barfoo;
+
+class ext extends \phpbb\extension\base
{
}
diff --git a/tests/extension/ext/foo/a_class.php b/tests/extension/ext/foo/a_class.php
index b7be1ad654..9db45a697f 100644
--- a/tests/extension/ext/foo/a_class.php
+++ b/tests/extension/ext/foo/a_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_a_class
+namespace foo;
+
+class a_class
{
}
diff --git a/tests/extension/ext/foo/acp/a_info.php b/tests/extension/ext/foo/acp/a_info.php
index 3e9bbffaca..3b7d8cdd42 100644
--- a/tests/extension/ext/foo/acp/a_info.php
+++ b/tests/extension/ext/foo/acp/a_info.php
@@ -1,11 +1,13 @@
<?php
-class phpbb_ext_foo_acp_a_info
+namespace foo\acp;
+
+class a_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/foo/acp/a_module.php b/tests/extension/ext/foo/acp/a_module.php
index 093b4b1ad7..7aa2351ab3 100644
--- a/tests/extension/ext/foo/acp/a_module.php
+++ b/tests/extension/ext/foo/acp/a_module.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_acp_a_module
+namespace foo\acp;
+
+class a_module
{
}
diff --git a/tests/extension/ext/foo/acp/fail_info.php b/tests/extension/ext/foo/acp/fail_info.php
index 99aa09551e..01d29fc5eb 100644
--- a/tests/extension/ext/foo/acp/fail_info.php
+++ b/tests/extension/ext/foo/acp/fail_info.php
@@ -1,14 +1,17 @@
<?php
+
+namespace foo\acp;
+
/*
* Due to the mismatch between the class name and the file name, this module
* file shouldn't be found by the extension finder
*/
-class phpbb_ext_foo_acp_foo_info
+class foo_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_acp_fail_module',
+ 'filename' => 'foo\acp\fail_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/foo/acp/fail_module.php b/tests/extension/ext/foo/acp/fail_module.php
index a200d92d2f..8070929d3c 100644
--- a/tests/extension/ext/foo/acp/fail_module.php
+++ b/tests/extension/ext/foo/acp/fail_module.php
@@ -1,8 +1,11 @@
<?php
+
+namespace foo\acp;
+
/*
* Due to the mismatch between the class name and the file name of the module
* info file, this module's info file shouldn't be found
*/
-class phpbb_ext_foo_acp_fail_module
+class fail_module
{
}
diff --git a/tests/extension/ext/foo/b_class.php b/tests/extension/ext/foo/b_class.php
index 4645266122..bb2a77c05e 100644
--- a/tests/extension/ext/foo/b_class.php
+++ b/tests/extension/ext/foo/b_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_b_class
+namespace foo;
+
+class b_class
{
}
diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/foo/ext.php
index 60b3ad1f16..ac6098f2f1 100644
--- a/tests/extension/ext/foo/ext.php
+++ b/tests/extension/ext/foo/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_foo_ext extends phpbb_extension_base
+namespace foo;
+
+class ext extends \phpbb\extension\base
{
static public $disabled;
diff --git a/tests/extension/ext/foo/mcp/a_info.php b/tests/extension/ext/foo/mcp/a_info.php
index 84a36b9134..9a896ce808 100644
--- a/tests/extension/ext/foo/mcp/a_info.php
+++ b/tests/extension/ext/foo/mcp/a_info.php
@@ -1,11 +1,13 @@
<?php
-class phpbb_ext_foo_mcp_a_info
+namespace foo\mcp;
+
+class a_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/foo/mcp/a_module.php b/tests/extension/ext/foo/mcp/a_module.php
index 59d9f8cc6f..ca397e7004 100644
--- a/tests/extension/ext/foo/mcp/a_module.php
+++ b/tests/extension/ext/foo/mcp/a_module.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_mcp_a_module
+namespace foo\mcp;
+
+class a_module
{
}
diff --git a/tests/extension/ext/foo/sub/type/alternative.php b/tests/extension/ext/foo/sub/type/alternative.php
index 2ea7353f4b..1eaf794609 100644
--- a/tests/extension/ext/foo/sub/type/alternative.php
+++ b/tests/extension/ext/foo/sub/type/alternative.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_sub_type_alternative
+namespace foo\sub\type;
+
+class alternative
{
}
diff --git a/tests/extension/ext/foo/type/alternative.php b/tests/extension/ext/foo/type/alternative.php
index 404b66b965..8f753491ef 100644
--- a/tests/extension/ext/foo/type/alternative.php
+++ b/tests/extension/ext/foo/type/alternative.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_type_alternative
+namespace foo\type;
+
+class alternative
{
}
diff --git a/tests/extension/ext/foo/typewrong/error.php b/tests/extension/ext/foo/typewrong/error.php
index ba22cfae9a..5020926043 100644
--- a/tests/extension/ext/foo/typewrong/error.php
+++ b/tests/extension/ext/foo/typewrong/error.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_typewrong_error
+namespace foo\typewrong;
+
+class error
{
}
diff --git a/tests/extension/ext/vendor/moo/ext.php b/tests/extension/ext/vendor/moo/ext.php
index e0ac1a22cc..41ef570452 100644
--- a/tests/extension/ext/vendor/moo/ext.php
+++ b/tests/extension/ext/vendor/moo/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_vendor_moo_ext extends phpbb_extension_base
+namespace vendor\moo;
+
+class ext extends \phpbb\extension\base
{
static public $purged;
diff --git a/tests/extension/ext/vendor/moo/feature_class.php b/tests/extension/ext/vendor/moo/feature_class.php
index c3bcc4451c..cb8bb3da56 100644
--- a/tests/extension/ext/vendor/moo/feature_class.php
+++ b/tests/extension/ext/vendor/moo/feature_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_vendor_moo_feature_class
+namespace vendor\moo;
+
+class feature_class
{
}
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
index 3bf2c42573..8e6e71aaf8 100644
--- a/tests/extension/finder_test.php
+++ b/tests/extension/finder_test.php
@@ -43,10 +43,10 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_default_implementation',
- 'phpbb_ext_bar_my_hidden_class',
- 'phpbb_ext_foo_a_class',
- 'phpbb_ext_foo_b_class',
+ '\bar\my\hidden_class',
+ '\foo\a_class',
+ '\foo\b_class',
+ '\phpbb\default\implementation',
),
$classes
);
@@ -67,7 +67,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_prefix_get_directories()
{
$dirs = $this->finder
- ->prefix('ty')
+ ->prefix('ty')
->get_directories();
sort($dirs);
@@ -88,8 +88,8 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_default_implementation',
- 'phpbb_ext_bar_my_hidden_class',
+ '\bar\my\hidden_class',
+ '\phpbb\default\implementation',
),
$classes
);
@@ -105,9 +105,9 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_default_implementation',
- 'phpbb_ext_foo_sub_type_alternative',
- 'phpbb_ext_foo_type_alternative',
+ '\foo\sub\type\alternative',
+ '\foo\type\alternative',
+ '\phpbb\default\implementation',
),
$classes
);
@@ -122,7 +122,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_type_alternative',
+ '\foo\type\alternative',
),
$classes
);
@@ -137,7 +137,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_sub_type_alternative',
+ '\foo\sub\type\alternative',
),
$classes
);
@@ -152,7 +152,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_sub_type_alternative',
+ '\foo\sub\type\alternative',
),
$classes
);
@@ -168,8 +168,8 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_type_alternative',
- 'phpbb_ext_foo_type_dummy_empty',
+ '\foo\type\alternative',
+ '\foo\type\dummy\empty',
),
$classes
);
@@ -181,7 +181,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_get_classes_create_cache()
{
$cache = new phpbb_mock_cache;
- $finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
+ $finder = new \phpbb\extension\finder($this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
$files = $finder->suffix('_class.php')->get_files();
$expected_files = array(
@@ -219,9 +219,9 @@ class phpbb_extension_finder_test extends phpbb_test_case
'is_dir' => false,
);
- $finder = new phpbb_extension_finder(
+ $finder = new \phpbb\extension\finder(
$this->extension_manager,
- new phpbb_filesystem(),
+ new \phpbb\filesystem(),
dirname(__FILE__) . '/',
new phpbb_mock_cache(array(
'_ext_finder' => array(
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index a23e5a18d9..c4a32f53ab 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -45,31 +45,31 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_enable()
{
- phpbb_ext_bar_ext::$state = 0;
+ bar\ext::$state = 0;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->extension_manager->enable('bar');
$this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('bar', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
- $this->assertEquals(4, phpbb_ext_bar_ext::$state);
+ $this->assertEquals(4, bar\ext::$state);
}
public function test_disable()
{
- phpbb_ext_foo_ext::$disabled = false;
+ foo\ext::$disabled = false;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->extension_manager->disable('foo');
$this->assertEquals(array(), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
- $this->assertTrue(phpbb_ext_foo_ext::$disabled);
+ $this->assertTrue(foo\ext::$disabled);
}
public function test_purge()
{
- phpbb_ext_vendor_moo_ext::$purged = false;
+ vendor\moo\ext::$purged = false;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
@@ -77,7 +77,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured()));
- $this->assertTrue(phpbb_ext_vendor_moo_ext::$purged);
+ $this->assertTrue(vendor\moo\ext::$purged);
}
public function test_enabled_no_cache()
@@ -90,14 +90,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
protected function create_extension_manager($with_cache = true)
{
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$db = $this->new_dbal();
- $db_tools = new phpbb_db_tools($db);
+ $db_tools = new \phpbb\db\tools($db);
$phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php';
$table_prefix = 'phpbb_';
- $migrator = new phpbb_db_migrator(
+ $migrator = new \phpbb\db\migrator(
$config,
$db,
$db_tools,
@@ -110,11 +110,17 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- return new phpbb_extension_manager(
+ return new \phpbb\extension\manager(
$container,
$db,
$config,
- new phpbb_filesystem(),
+ new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $php_ext
+ ),
'phpbb_ext',
dirname(__FILE__) . '/',
$php_ext,
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index e5bd29092e..2b27a1bae2 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -30,25 +30,30 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
parent::setUp();
$this->cache = new phpbb_mock_cache();
- $this->config = new phpbb_config(array(
+ $this->config = new \phpbb\config\config(array(
'version' => '3.1.0',
));
$this->db = $this->new_dbal();
- $this->db_tools = new phpbb_db_tools($this->db);
+ $this->db_tools = new \phpbb\db\tools($this->db);
$this->phpbb_root_path = dirname(__FILE__) . '/';
$this->phpEx = 'php';
- $this->user = new phpbb_user();
+ $this->user = new \phpbb\user();
$this->table_prefix = 'phpbb_';
- $this->template = new phpbb_template_twig(
- $this->phpbb_root_path,
- $this->phpEx,
+ $this->template = new \phpbb\template\twig\twig(
+ new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path,
+ $this->phpEx
+ ),
$this->config,
$this->user,
- new phpbb_template_context()
+ new \phpbb\template\context()
);
- $this->migrator = new phpbb_db_migrator(
+ $this->migrator = new \phpbb\db\migrator(
$this->config,
$this->db,
$this->db_tools,
@@ -61,11 +66,17 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $this->extension_manager = new phpbb_extension_manager(
+ $this->extension_manager = new \phpbb\extension\manager(
$container,
$this->db,
$this->config,
- new phpbb_filesystem(),
+ new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path,
+ $this->phpEx
+ ),
'phpbb_ext',
$this->phpbb_root_path,
$this->phpEx,
@@ -84,7 +95,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
$manager->get_metadata();
}
- catch(phpbb_extension_exception $e){}
+ catch(\phpbb\extension\exception $e){}
$this->assertEquals((string) $e, 'The required file does not exist: ' . $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json');
}
@@ -100,7 +111,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
$metadata = $manager->get_metadata();
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -123,7 +134,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.');
}
@@ -134,7 +145,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.');
}
@@ -145,7 +156,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'licence\' has not been set.');
}
@@ -156,7 +167,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.');
}
@@ -167,7 +178,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.');
}
@@ -184,7 +195,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.');
}
@@ -211,7 +222,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'name\' is invalid.');
}
@@ -222,7 +233,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'type\' is invalid.');
}
@@ -233,7 +244,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'licence\' is invalid.');
}
@@ -244,7 +255,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'version\' is invalid.');
}
@@ -268,7 +279,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
$this->assertEquals(true, $manager->validate('enable'));
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -293,7 +304,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(false, $manager->validate_require_php());
$this->assertEquals(false, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -312,7 +323,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -331,7 +342,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(false, $manager->validate_require_php());
$this->assertEquals(false, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -350,7 +361,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(false, $manager->validate_require_php());
$this->assertEquals(false, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -369,7 +380,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -388,7 +399,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -407,7 +418,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php
index fe71747c5d..ef21c943c2 100644
--- a/tests/extension/modules_test.php
+++ b/tests/extension/modules_test.php
@@ -45,6 +45,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
{
global $phpbb_root_path;
+// $this->markTestIncomplete('Modules no speak namespace! Going to get rid of db modules altogether and fix this test after.');
+
// Correctly set the root path for this test to this directory, so the classes can be found
$phpbb_root_path = dirname(__FILE__) . '/';
@@ -52,8 +54,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'acp';
$acp_modules = $this->acp_modules->get_module_infos();
$this->assertEquals(array(
- 'phpbb_ext_foo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'foo\\acp\\a_module' => array(
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -74,8 +76,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'mcp';
$acp_modules = $this->acp_modules->get_module_infos();
$this->assertEquals(array(
- 'phpbb_ext_foo_mcp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'foo\\mcp\\a_module' => array(
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -88,8 +90,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'mcp';
$acp_modules = $this->acp_modules->get_module_infos('mcp_a_module');
$this->assertEquals(array(
- 'phpbb_ext_foo_mcp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'foo\\mcp\\a_module' => array(
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -102,8 +104,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = '';
$acp_modules = $this->acp_modules->get_module_infos('mcp_a_module', 'mcp');
$this->assertEquals(array(
- 'phpbb_ext_foo_mcp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'foo\\mcp\\a_module' => array(
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -124,10 +126,10 @@ class phpbb_extension_modules_test extends phpbb_test_case
// Get module info of specified extension module
$this->acp_modules->module_class = 'acp';
- $acp_modules = $this->acp_modules->get_module_infos('phpbb_ext_foo_acp_a_module');
+ $acp_modules = $this->acp_modules->get_module_infos('foo_acp_a_module');
$this->assertEquals(array(
- 'phpbb_ext_foo_acp_a_module' => array (
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'foo\\acp\\a_module' => array (
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array (
@@ -150,8 +152,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'acp';
$acp_modules = $this->acp_modules->get_module_infos('', false, true);
$this->assertEquals(array(
- 'phpbb_ext_foo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'foo\\acp\\a_module' => array(
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -166,8 +168,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
),
),
- 'phpbb_ext_barfoo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'barfoo\\acp\\a_module' => array(
+ 'filename' => 'barfoo\\acp\\a_module',
'title' => 'Barfoo',
'version' => '3.1.0-dev',
'modes' => array(
@@ -177,10 +179,10 @@ class phpbb_extension_modules_test extends phpbb_test_case
), $acp_modules);
// Specific module set to disabled extension
- $acp_modules = $this->acp_modules->get_module_infos('phpbb_ext_barfoo_acp_a_module', 'acp', true);
+ $acp_modules = $this->acp_modules->get_module_infos('barfoo_acp_a_module', 'acp', true);
$this->assertEquals(array(
- 'phpbb_ext_barfoo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'barfoo\\acp\\a_module' => array(
+ 'filename' => 'barfoo\\acp\\a_module',
'title' => 'Barfoo',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/style_path_provider_test.php b/tests/extension/style_path_provider_test.php
deleted file mode 100644
index e1021c20ac..0000000000
--- a/tests/extension/style_path_provider_test.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-
-class phpbb_extension_style_path_provider_test extends phpbb_test_case
-{
- protected $relative_root_path;
- protected $root_path;
-
- public function setUp()
- {
- $this->relative_root_path = './';
- $this->root_path = dirname(__FILE__) . '/';
- }
-
- public function test_find()
- {
- $phpbb_style_path_provider = new phpbb_style_path_provider();
- $phpbb_style_path_provider->set_styles(array($this->relative_root_path . 'styles/prosilver'));
- $phpbb_style_extension_path_provider = new phpbb_style_extension_path_provider(new phpbb_mock_extension_manager(
- $this->root_path,
- array(
- 'foo' => array(
- 'ext_name' => 'foo',
- 'ext_active' => '1',
- 'ext_path' => 'ext/foo/',
- ),
- 'bar' => array(
- 'ext_name' => 'bar',
- 'ext_active' => '1',
- 'ext_path' => 'ext/bar/',
- ),
- )), $phpbb_style_path_provider, $this->relative_root_path);
-
- $this->assertEquals(array(
- 'style' => array(
- $this->relative_root_path . 'styles/prosilver',
- ),
- 'bar' => array(
- $this->root_path . 'ext/bar/styles/prosilver',
- ),
- ), $phpbb_style_extension_path_provider->find());
- }
-}
diff --git a/tests/extension/subdir/style_path_provider_test.php b/tests/extension/subdir/style_path_provider_test.php
deleted file mode 100644
index 1b5ce62e5f..0000000000
--- a/tests/extension/subdir/style_path_provider_test.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-require_once dirname(__FILE__) . '/../style_path_provider_test.php';
-
-class phpbb_extension_subdir_style_path_provider_test extends phpbb_extension_style_path_provider_test
-{
- public function setUp()
- {
- $this->relative_root_path = '../';
- $this->root_path = dirname(__FILE__) . '/../';
- }
-}