aboutsummaryrefslogtreecommitdiffstats
path: root/tests/extension
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extension')
-rw-r--r--tests/extension/ext/bar/ext.php24
-rw-r--r--tests/extension/ext/bar/my/hidden_class.php5
-rw-r--r--tests/extension/ext/bar/styles/prosilver/template/foobar_body.html1
-rw-r--r--tests/extension/ext/barfoo/acp/a_info.php16
-rw-r--r--tests/extension/ext/barfoo/acp/a_module.php5
-rw-r--r--tests/extension/ext/barfoo/ext.php5
-rw-r--r--tests/extension/ext/foo/a_class.php5
-rw-r--r--tests/extension/ext/foo/acp/a_info.php16
-rw-r--r--tests/extension/ext/foo/acp/a_module.php5
-rw-r--r--tests/extension/ext/foo/acp/fail_info.php19
-rw-r--r--tests/extension/ext/foo/acp/fail_module.php8
-rw-r--r--tests/extension/ext/foo/b_class.php5
-rw-r--r--tests/extension/ext/foo/composer.json22
-rw-r--r--tests/extension/ext/foo/ext.php13
-rw-r--r--tests/extension/ext/foo/mcp/a_info.php16
-rw-r--r--tests/extension/ext/foo/mcp/a_module.php5
-rw-r--r--tests/extension/ext/foo/sub/type/alternative.php5
-rw-r--r--tests/extension/ext/foo/type/alternative.php5
-rw-r--r--tests/extension/ext/foo/type/dummy/empty.txt0
-rw-r--r--tests/extension/ext/foo/typewrong/error.php5
-rw-r--r--tests/extension/ext/vendor/moo/composer.json22
-rw-r--r--tests/extension/ext/vendor/moo/ext.php13
-rw-r--r--tests/extension/ext/vendor/moo/feature_class.php5
-rw-r--r--tests/extension/finder_test.php245
-rw-r--r--tests/extension/fixtures/extensions.xml18
-rw-r--r--tests/extension/includes/acp/acp_foobar.php28
-rw-r--r--tests/extension/includes/acp/info/acp_foobar.php26
-rw-r--r--tests/extension/manager_test.php124
-rw-r--r--tests/extension/metadata_manager_test.php432
-rw-r--r--tests/extension/modules_test.php192
-rw-r--r--tests/extension/phpbb/default/implementation.php5
-rw-r--r--tests/extension/style_path_provider_test.php50
-rw-r--r--tests/extension/subdir/style_path_provider_test.php18
33 files changed, 1363 insertions, 0 deletions
diff --git a/tests/extension/ext/bar/ext.php b/tests/extension/ext/bar/ext.php
new file mode 100644
index 0000000000..5585edf9ac
--- /dev/null
+++ b/tests/extension/ext/bar/ext.php
@@ -0,0 +1,24 @@
+<?php
+
+class phpbb_ext_bar_ext extends phpbb_extension_base
+{
+ static public $state;
+
+ public function enable_step($old_state)
+ {
+ // run 4 steps, then quit
+ if ($old_state === 4)
+ {
+ return false;
+ }
+
+ if ($old_state === false)
+ {
+ $old_state = 0;
+ }
+
+ self::$state = ++$old_state;
+
+ return self::$state;
+ }
+}
diff --git a/tests/extension/ext/bar/my/hidden_class.php b/tests/extension/ext/bar/my/hidden_class.php
new file mode 100644
index 0000000000..0261d7c59a
--- /dev/null
+++ b/tests/extension/ext/bar/my/hidden_class.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_bar_my_hidden_class
+{
+}
diff --git a/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html b/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html
new file mode 100644
index 0000000000..00c2a84a18
--- /dev/null
+++ b/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html
@@ -0,0 +1 @@
+bertie rules!
diff --git a/tests/extension/ext/barfoo/acp/a_info.php b/tests/extension/ext/barfoo/acp/a_info.php
new file mode 100644
index 0000000000..cd7e4e574b
--- /dev/null
+++ b/tests/extension/ext/barfoo/acp/a_info.php
@@ -0,0 +1,16 @@
+<?php
+
+class phpbb_ext_barfoo_acp_a_info
+{
+ public function module()
+ {
+ return array(
+ 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'title' => 'Barfoo',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ );
+ }
+}
diff --git a/tests/extension/ext/barfoo/acp/a_module.php b/tests/extension/ext/barfoo/acp/a_module.php
new file mode 100644
index 0000000000..5bedb49645
--- /dev/null
+++ b/tests/extension/ext/barfoo/acp/a_module.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_barfoo_acp_a_module
+{
+}
diff --git a/tests/extension/ext/barfoo/ext.php b/tests/extension/ext/barfoo/ext.php
new file mode 100644
index 0000000000..2e11ece8d1
--- /dev/null
+++ b/tests/extension/ext/barfoo/ext.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_barfoo_ext extends phpbb_extension_base
+{
+}
diff --git a/tests/extension/ext/foo/a_class.php b/tests/extension/ext/foo/a_class.php
new file mode 100644
index 0000000000..b7be1ad654
--- /dev/null
+++ b/tests/extension/ext/foo/a_class.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_a_class
+{
+}
diff --git a/tests/extension/ext/foo/acp/a_info.php b/tests/extension/ext/foo/acp/a_info.php
new file mode 100644
index 0000000000..3e9bbffaca
--- /dev/null
+++ b/tests/extension/ext/foo/acp/a_info.php
@@ -0,0 +1,16 @@
+<?php
+
+class phpbb_ext_foo_acp_a_info
+{
+ public function module()
+ {
+ return array(
+ 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ );
+ }
+}
diff --git a/tests/extension/ext/foo/acp/a_module.php b/tests/extension/ext/foo/acp/a_module.php
new file mode 100644
index 0000000000..093b4b1ad7
--- /dev/null
+++ b/tests/extension/ext/foo/acp/a_module.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_acp_a_module
+{
+}
diff --git a/tests/extension/ext/foo/acp/fail_info.php b/tests/extension/ext/foo/acp/fail_info.php
new file mode 100644
index 0000000000..99aa09551e
--- /dev/null
+++ b/tests/extension/ext/foo/acp/fail_info.php
@@ -0,0 +1,19 @@
+<?php
+/*
+* 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
+{
+ public function module()
+ {
+ return array(
+ 'filename' => 'phpbb_ext_foo_acp_fail_module',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ );
+ }
+}
diff --git a/tests/extension/ext/foo/acp/fail_module.php b/tests/extension/ext/foo/acp/fail_module.php
new file mode 100644
index 0000000000..a200d92d2f
--- /dev/null
+++ b/tests/extension/ext/foo/acp/fail_module.php
@@ -0,0 +1,8 @@
+<?php
+/*
+* 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
+{
+}
diff --git a/tests/extension/ext/foo/b_class.php b/tests/extension/ext/foo/b_class.php
new file mode 100644
index 0000000000..4645266122
--- /dev/null
+++ b/tests/extension/ext/foo/b_class.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_b_class
+{
+}
diff --git a/tests/extension/ext/foo/composer.json b/tests/extension/ext/foo/composer.json
new file mode 100644
index 0000000000..744f7be625
--- /dev/null
+++ b/tests/extension/ext/foo/composer.json
@@ -0,0 +1,22 @@
+{
+ "name": "foo/example",
+ "type": "phpbb3-extension",
+ "description": "An example/sample extension to be used for testing purposes in phpBB Development.",
+ "version": "1.0.0",
+ "time": "2012-02-15 01:01:01",
+ "licence": "GPL-2.0",
+ "authors": [{
+ "name": "Nathan Guse",
+ "username": "EXreaction",
+ "email": "email@phpbb.com",
+ "homepage": "http://lithiumstudios.org",
+ "role": "N/A"
+ }],
+ "require": {
+ "php": ">=5.3",
+ "phpbb": "3.1.0-dev"
+ },
+ "extra": {
+ "display-name": "phpBB Foo Extension"
+ }
+}
diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/foo/ext.php
new file mode 100644
index 0000000000..60b3ad1f16
--- /dev/null
+++ b/tests/extension/ext/foo/ext.php
@@ -0,0 +1,13 @@
+<?php
+
+class phpbb_ext_foo_ext extends phpbb_extension_base
+{
+ static public $disabled;
+
+ public function disable_step($old_state)
+ {
+ self::$disabled = true;
+
+ return false;
+ }
+}
diff --git a/tests/extension/ext/foo/mcp/a_info.php b/tests/extension/ext/foo/mcp/a_info.php
new file mode 100644
index 0000000000..84a36b9134
--- /dev/null
+++ b/tests/extension/ext/foo/mcp/a_info.php
@@ -0,0 +1,16 @@
+<?php
+
+class phpbb_ext_foo_mcp_a_info
+{
+ public function module()
+ {
+ return array(
+ 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')),
+ ),
+ );
+ }
+}
diff --git a/tests/extension/ext/foo/mcp/a_module.php b/tests/extension/ext/foo/mcp/a_module.php
new file mode 100644
index 0000000000..59d9f8cc6f
--- /dev/null
+++ b/tests/extension/ext/foo/mcp/a_module.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_mcp_a_module
+{
+}
diff --git a/tests/extension/ext/foo/sub/type/alternative.php b/tests/extension/ext/foo/sub/type/alternative.php
new file mode 100644
index 0000000000..2ea7353f4b
--- /dev/null
+++ b/tests/extension/ext/foo/sub/type/alternative.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_sub_type_alternative
+{
+}
diff --git a/tests/extension/ext/foo/type/alternative.php b/tests/extension/ext/foo/type/alternative.php
new file mode 100644
index 0000000000..404b66b965
--- /dev/null
+++ b/tests/extension/ext/foo/type/alternative.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_type_alternative
+{
+}
diff --git a/tests/extension/ext/foo/type/dummy/empty.txt b/tests/extension/ext/foo/type/dummy/empty.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/extension/ext/foo/type/dummy/empty.txt
diff --git a/tests/extension/ext/foo/typewrong/error.php b/tests/extension/ext/foo/typewrong/error.php
new file mode 100644
index 0000000000..ba22cfae9a
--- /dev/null
+++ b/tests/extension/ext/foo/typewrong/error.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_foo_typewrong_error
+{
+}
diff --git a/tests/extension/ext/vendor/moo/composer.json b/tests/extension/ext/vendor/moo/composer.json
new file mode 100644
index 0000000000..c91a5e027b
--- /dev/null
+++ b/tests/extension/ext/vendor/moo/composer.json
@@ -0,0 +1,22 @@
+{
+ "name": "moo/example",
+ "type": "phpbb3-extension",
+ "description": "An example/sample extension to be used for testing purposes in phpBB Development.",
+ "version": "1.0.0",
+ "time": "2012-02-15 01:01:01",
+ "licence": "GNU GPL v2",
+ "authors": [{
+ "name": "Nathan Guse",
+ "username": "EXreaction",
+ "email": "email@phpbb.com",
+ "homepage": "http://lithiumstudios.org",
+ "role": "N/A"
+ }],
+ "require": {
+ "php": ">=5.3",
+ "phpbb": "3.1.0-dev"
+ },
+ "extra": {
+ "display-name": "phpBB Moo Extension"
+ }
+}
diff --git a/tests/extension/ext/vendor/moo/ext.php b/tests/extension/ext/vendor/moo/ext.php
new file mode 100644
index 0000000000..e0ac1a22cc
--- /dev/null
+++ b/tests/extension/ext/vendor/moo/ext.php
@@ -0,0 +1,13 @@
+<?php
+
+class phpbb_ext_vendor_moo_ext extends phpbb_extension_base
+{
+ static public $purged;
+
+ public function purge_step($old_state)
+ {
+ self::$purged = true;
+
+ return false;
+ }
+}
diff --git a/tests/extension/ext/vendor/moo/feature_class.php b/tests/extension/ext/vendor/moo/feature_class.php
new file mode 100644
index 0000000000..c3bcc4451c
--- /dev/null
+++ b/tests/extension/ext/vendor/moo/feature_class.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_ext_vendor_moo_feature_class
+{
+}
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
new file mode 100644
index 0000000000..3bf2c42573
--- /dev/null
+++ b/tests/extension/finder_test.php
@@ -0,0 +1,245 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 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_finder_test extends phpbb_test_case
+{
+ protected $extension_manager;
+ protected $finder;
+
+ public function setUp()
+ {
+ $this->extension_manager = new phpbb_mock_extension_manager(
+ dirname(__FILE__) . '/',
+ 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/',
+ ),
+ ));
+
+ $this->finder = $this->extension_manager->get_finder();
+ }
+
+ public function test_suffix_get_classes()
+ {
+ $classes = $this->finder
+ ->core_path('phpbb/default/')
+ ->extension_suffix('_class')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_default_implementation',
+ 'phpbb_ext_bar_my_hidden_class',
+ 'phpbb_ext_foo_a_class',
+ 'phpbb_ext_foo_b_class',
+ ),
+ $classes
+ );
+ }
+
+ public function test_get_directories()
+ {
+ $dirs = $this->finder
+ ->directory('/type')
+ ->get_directories();
+
+ sort($dirs);
+ $this->assertEquals(array(
+ dirname(__FILE__) . '/ext/foo/type/',
+ ), $dirs);
+ }
+
+ public function test_prefix_get_directories()
+ {
+ $dirs = $this->finder
+ ->prefix('ty')
+ ->get_directories();
+
+ sort($dirs);
+ $this->assertEquals(array(
+ dirname(__FILE__) . '/ext/foo/sub/type/',
+ dirname(__FILE__) . '/ext/foo/type/',
+ dirname(__FILE__) . '/ext/foo/typewrong/',
+ ), $dirs);
+ }
+
+ public function test_prefix_get_classes()
+ {
+ $classes = $this->finder
+ ->core_path('phpbb/default/')
+ ->extension_prefix('hidden_')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_default_implementation',
+ 'phpbb_ext_bar_my_hidden_class',
+ ),
+ $classes
+ );
+ }
+
+ public function test_directory_get_classes()
+ {
+ $classes = $this->finder
+ ->core_path('phpbb/default/')
+ ->extension_directory('type')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_default_implementation',
+ 'phpbb_ext_foo_sub_type_alternative',
+ 'phpbb_ext_foo_type_alternative',
+ ),
+ $classes
+ );
+ }
+
+ public function test_absolute_directory_get_classes()
+ {
+ $classes = $this->finder
+ ->directory('/type/')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_ext_foo_type_alternative',
+ ),
+ $classes
+ );
+ }
+
+ public function test_sub_directory_get_classes()
+ {
+ $classes = $this->finder
+ ->directory('/sub/type')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_ext_foo_sub_type_alternative',
+ ),
+ $classes
+ );
+ }
+
+ public function test_uncleansub_directory_get_classes()
+ {
+ $classes = $this->finder
+ ->directory('/sub/../sub/type')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_ext_foo_sub_type_alternative',
+ ),
+ $classes
+ );
+ }
+
+ public function test_find_from_extension()
+ {
+ $files = $this->finder
+ ->extension_directory('/type')
+ ->find_from_extension('foo', dirname(__FILE__) . '/ext/foo/');
+ $classes = $this->finder->get_classes_from_files($files);
+
+ sort($classes);
+ $this->assertEquals(
+ array(
+ 'phpbb_ext_foo_type_alternative',
+ 'phpbb_ext_foo_type_dummy_empty',
+ ),
+ $classes
+ );
+ }
+
+ /**
+ * These do not work because of changes with PHPBB3-11386
+ * They do not seem neccessary to me, so I am commenting them out for now
+ 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');
+ $files = $finder->suffix('_class.php')->get_files();
+
+ $expected_files = array(
+ 'ext/bar/my/hidden_class.php' => 'bar',
+ 'ext/foo/a_class.php' => 'foo',
+ 'ext/foo/b_class.php' => 'foo',
+ );
+
+ $query = array(
+ 'core_path' => false,
+ 'core_suffix' => '_class.php',
+ 'core_prefix' => false,
+ 'core_directory' => false,
+ 'extension_suffix' => '_class.php',
+ 'extension_prefix' => false,
+ 'extension_directory' => false,
+ 'is_dir' => false,
+ );
+
+ $cache->checkAssociativeVar($this, '_custom_cache_name', array(
+ md5(serialize($query)) => $expected_files,
+ ), false);
+ }
+
+ public function test_cached_get_files()
+ {
+ $query = array(
+ 'core_path' => 'phpbb/foo',
+ 'core_suffix' => false,
+ 'core_prefix' => false,
+ 'core_directory' => 'bar',
+ 'extension_suffix' => false,
+ 'extension_prefix' => false,
+ 'extension_directory' => false,
+ 'is_dir' => false,
+ );
+
+ $finder = new phpbb_extension_finder(
+ $this->extension_manager,
+ new phpbb_filesystem(),
+ dirname(__FILE__) . '/',
+ new phpbb_mock_cache(array(
+ '_ext_finder' => array(
+ md5(serialize($query)) => array('file_name' => 'extension'),
+ ),
+ ))
+ );
+
+ $classes = $finder
+ ->core_path($query['core_path'])
+ ->core_directory($query['core_directory'])
+ ->get_files();
+
+ sort($classes);
+ $this->assertEquals(
+ array(dirname(__FILE__) . '/file_name'),
+ $classes
+ );
+ }
+ */
+}
diff --git a/tests/extension/fixtures/extensions.xml b/tests/extension/fixtures/extensions.xml
new file mode 100644
index 0000000000..6eb6fd11a5
--- /dev/null
+++ b/tests/extension/fixtures/extensions.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_ext">
+ <column>ext_name</column>
+ <column>ext_active</column>
+ <column>ext_state</column>
+ <row>
+ <value>foo</value>
+ <value>1</value>
+ <value></value>
+ </row>
+ <row>
+ <value>vendor/moo</value>
+ <value>0</value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/extension/includes/acp/acp_foobar.php b/tests/extension/includes/acp/acp_foobar.php
new file mode 100644
index 0000000000..c256a432e2
--- /dev/null
+++ b/tests/extension/includes/acp/acp_foobar.php
@@ -0,0 +1,28 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* @package acp
+*/
+class acp_foobar
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ }
+}
diff --git a/tests/extension/includes/acp/info/acp_foobar.php b/tests/extension/includes/acp/info/acp_foobar.php
new file mode 100644
index 0000000000..b89cfb9574
--- /dev/null
+++ b/tests/extension/includes/acp/info/acp_foobar.php
@@ -0,0 +1,26 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @package module_install
+*/
+class acp_foobar_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'acp_foobar',
+ 'title' => 'ACP Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
+ ),
+ );
+ }
+}
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
new file mode 100644
index 0000000000..a23e5a18d9
--- /dev/null
+++ b/tests/extension/manager_test.php
@@ -0,0 +1,124 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/ext/bar/ext.php';
+require_once dirname(__FILE__) . '/ext/foo/ext.php';
+require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php';
+
+class phpbb_extension_manager_test extends phpbb_database_test_case
+{
+ protected $extension_manager;
+ protected $class_loader;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/extensions.xml');
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->extension_manager = $this->create_extension_manager();
+ }
+
+ public function test_available()
+ {
+ $this->assertEquals(array('bar', 'barfoo', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_available()));
+ }
+
+ public function test_enabled()
+ {
+ $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
+ }
+
+ public function test_configured()
+ {
+ $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
+ }
+
+ public function test_enable()
+ {
+ phpbb_ext_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);
+ }
+
+ public function test_disable()
+ {
+ phpbb_ext_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);
+ }
+
+ public function test_purge()
+ {
+ phpbb_ext_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()));
+ $this->extension_manager->purge('vendor/moo');
+ $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);
+ }
+
+ public function test_enabled_no_cache()
+ {
+ $extension_manager = $this->create_extension_manager(false);
+
+ $this->assertEquals(array('foo'), array_keys($extension_manager->all_enabled()));
+ }
+
+ protected function create_extension_manager($with_cache = true)
+ {
+
+ $config = new phpbb_config(array());
+ $db = $this->new_dbal();
+ $db_tools = new phpbb_db_tools($db);
+ $phpbb_root_path = __DIR__ . './../../phpBB/';
+ $php_ext = 'php';
+ $table_prefix = 'phpbb_';
+
+ $migrator = new phpbb_db_migrator(
+ $config,
+ $db,
+ $db_tools,
+ 'phpbb_migrations',
+ $phpbb_root_path,
+ $php_ext,
+ $table_prefix,
+ array()
+ );
+ $container = new phpbb_mock_container_builder();
+ $container->set('migrator', $migrator);
+
+ return new phpbb_extension_manager(
+ $container,
+ $db,
+ $config,
+ new phpbb_filesystem(),
+ 'phpbb_ext',
+ dirname(__FILE__) . '/',
+ $php_ext,
+ ($with_cache) ? new phpbb_mock_cache() : null
+ );
+ }
+}
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
new file mode 100644
index 0000000000..e5bd29092e
--- /dev/null
+++ b/tests/extension/metadata_manager_test.php
@@ -0,0 +1,432 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
+{
+ protected $class_loader;
+ protected $extension_manager;
+
+ protected $cache;
+ protected $config;
+ protected $db;
+ protected $phpbb_root_path;
+ protected $phpEx;
+ protected $template;
+ protected $user;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/extensions.xml');
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->cache = new phpbb_mock_cache();
+ $this->config = new phpbb_config(array(
+ 'version' => '3.1.0',
+ ));
+ $this->db = $this->new_dbal();
+ $this->db_tools = new phpbb_db_tools($this->db);
+ $this->phpbb_root_path = dirname(__FILE__) . '/';
+ $this->phpEx = 'php';
+ $this->user = new phpbb_user();
+ $this->table_prefix = 'phpbb_';
+
+ $this->template = new phpbb_template_twig(
+ $this->phpbb_root_path,
+ $this->phpEx,
+ $this->config,
+ $this->user,
+ new phpbb_template_context()
+ );
+
+ $this->migrator = new phpbb_db_migrator(
+ $this->config,
+ $this->db,
+ $this->db_tools,
+ 'phpbb_migrations',
+ $this->phpbb_root_path,
+ 'php',
+ $this->table_prefix,
+ array()
+ );
+ $container = new phpbb_mock_container_builder();
+ $container->set('migrator', $migrator);
+
+ $this->extension_manager = new phpbb_extension_manager(
+ $container,
+ $this->db,
+ $this->config,
+ new phpbb_filesystem(),
+ 'phpbb_ext',
+ $this->phpbb_root_path,
+ $this->phpEx,
+ $this->cache
+ );
+ }
+
+ // Should fail from missing composer.json
+ public function test_bar()
+ {
+ $ext_name = 'bar';
+
+ $manager = $this->get_metadata_manager($ext_name);
+
+ try
+ {
+ $manager->get_metadata();
+ }
+ 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');
+ }
+
+ // Should be the same as a direct json_decode of the composer.json file
+ public function test_foo()
+ {
+ $ext_name = 'foo';
+
+ $manager = $this->get_metadata_manager($ext_name);
+
+ try
+ {
+ $metadata = $manager->get_metadata();
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+ $json = json_decode(file_get_contents($this->phpbb_root_path . 'ext/foo/composer.json'), true);
+
+ $this->assertEquals($metadata, $json);
+ }
+
+ public function test_validator_non_existant()
+ {
+ $ext_name = 'validator';
+
+ $manager = $this->get_metadata_manager($ext_name);
+
+ // Non-existant data
+ try
+ {
+ $manager->validate('name');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.');
+ }
+
+ try
+ {
+ $manager->validate('type');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.');
+ }
+
+ try
+ {
+ $manager->validate('licence');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Required meta field \'licence\' has not been set.');
+ }
+
+ try
+ {
+ $manager->validate('version');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.');
+ }
+
+ try
+ {
+ $manager->validate_authors();
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.');
+ }
+
+ $manager->merge_metadata(array(
+ 'authors' => array(
+ array(),
+ ),
+ ));
+
+ try
+ {
+ $manager->validate_authors();
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.');
+ }
+ }
+
+
+ public function test_validator_invalid()
+ {
+ $ext_name = 'validator';
+
+ $manager = $this->get_metadata_manager($ext_name);
+
+ // Invalid data
+ $manager->set_metadata(array(
+ 'name' => 'asdf',
+ 'type' => 'asdf',
+ 'licence' => '',
+ 'version' => '',
+ ));
+
+ try
+ {
+ $manager->validate('name');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Meta field \'name\' is invalid.');
+ }
+
+ try
+ {
+ $manager->validate('type');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Meta field \'type\' is invalid.');
+ }
+
+ try
+ {
+ $manager->validate('licence');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Meta field \'licence\' is invalid.');
+ }
+
+ try
+ {
+ $manager->validate('version');
+
+ $this->fail('Exception not triggered');
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->assertEquals((string) $e, 'Meta field \'version\' is invalid.');
+ }
+ }
+
+ public function test_validator_valid()
+ {
+ $ext_name = 'validator';
+
+ $manager = $this->get_metadata_manager($ext_name);
+
+ // Valid data
+ $manager->set_metadata(array(
+ 'name' => 'test/foo',
+ 'type' => 'phpbb3-extension',
+ 'licence' => 'GPL v2',
+ 'version' => '1.0.0',
+ ));
+
+ try
+ {
+ $this->assertEquals(true, $manager->validate('enable'));
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+ }
+
+
+ public function test_validator_requirements()
+ {
+ $ext_name = 'validator';
+
+ $manager = $this->get_metadata_manager($ext_name);
+ // Too high of requirements
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => '10.0.0',
+ 'phpbb' => '3.2.0', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(false, $manager->validate_require_php());
+ $this->assertEquals(false, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+
+ // Too high of requirements
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => '5.3.0',
+ 'phpbb' => '3.1.0-beta', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(true, $manager->validate_require_php());
+ $this->assertEquals(true, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+
+ // Too high of requirements
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => '>' . phpversion(),
+ 'phpbb' => '>3.1.0', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(false, $manager->validate_require_php());
+ $this->assertEquals(false, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+
+ // Too high of current install
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => '<' . phpversion(),
+ 'phpbb' => '<3.1.0', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(false, $manager->validate_require_php());
+ $this->assertEquals(false, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+
+ // Matching requirements
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => phpversion(),
+ 'phpbb' => '3.1.0', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(true, $manager->validate_require_php());
+ $this->assertEquals(true, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+
+ // Matching requirements
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => '>=' . phpversion(),
+ 'phpbb' => '>=3.1.0', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(true, $manager->validate_require_php());
+ $this->assertEquals(true, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+
+
+ // Matching requirements
+ $manager->merge_metadata(array(
+ 'require' => array(
+ 'php' => '<=' . phpversion(),
+ 'phpbb' => '<=3.1.0', // config is set to 3.1.0
+ ),
+ ));
+
+ try
+ {
+ $this->assertEquals(true, $manager->validate_require_php());
+ $this->assertEquals(true, $manager->validate_require_phpbb());
+ }
+ catch(phpbb_extension_exception $e)
+ {
+ $this->fail($e);
+ }
+ }
+
+ /**
+ * Get an instance of the metadata manager
+ *
+ * @param string $ext_name
+ * @return phpbb_mock_metadata_manager
+ */
+ private function get_metadata_manager($ext_name)
+ {
+ return new phpbb_mock_metadata_manager(
+ $ext_name,
+ $this->config,
+ $this->extension_manager,
+ $this->template,
+ $this->phpbb_root_path
+ );
+ }
+}
diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php
new file mode 100644
index 0000000000..fe71747c5d
--- /dev/null
+++ b/tests/extension/modules_test.php
@@ -0,0 +1,192 @@
+<?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__) . '/ext/foo/acp/a_info.php';
+require_once dirname(__FILE__) . '/ext/foo/mcp/a_info.php';
+require_once dirname(__FILE__) . '/ext/foo/acp/fail_info.php';
+require_once dirname(__FILE__) . '/ext/barfoo/acp/a_info.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
+
+class phpbb_extension_modules_test extends phpbb_test_case
+{
+ protected $extension_manager;
+ protected $finder;
+
+ public function setUp()
+ {
+ global $phpbb_extension_manager;
+
+ $this->extension_manager = new phpbb_mock_extension_manager(
+ dirname(__FILE__) . '/',
+ 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_extension_manager = $this->extension_manager;
+
+ $this->acp_modules = new acp_modules();
+ }
+
+ public function test_get_module_infos()
+ {
+ global $phpbb_root_path;
+
+ // Correctly set the root path for this test to this directory, so the classes can be found
+ $phpbb_root_path = dirname(__FILE__) . '/';
+
+ // Find acp module info files
+ $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',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ ),
+ 'acp_foobar' => array(
+ 'filename' => 'acp_foobar',
+ 'title' => 'ACP Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
+ ),
+ ),
+ ), $acp_modules);
+
+ // Find mcp module info files
+ $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',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')),
+ ),
+ ),
+ ), $acp_modules);
+
+ // Find a specific module info file (mcp_a_module)
+ $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',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')),
+ ),
+ ),
+ ), $acp_modules);
+
+ // Find a specific module info file (mcp_a_module) with passing the module_class
+ $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',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')),
+ ),
+ ),
+ ), $acp_modules);
+
+ // The mcp module info file we're looking for shouldn't exist
+ $this->acp_modules->module_class = 'mcp';
+ $acp_modules = $this->acp_modules->get_module_infos('mcp_a_fail');
+ $this->assertEquals(array(), $acp_modules);
+
+ // As there are no ucp modules we shouldn't find any
+ $this->acp_modules->module_class = 'ucp';
+ $acp_modules = $this->acp_modules->get_module_infos();
+ $this->assertEquals(array(), $acp_modules);
+
+ // 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');
+ $this->assertEquals(array(
+ 'phpbb_ext_foo_acp_a_module' => array (
+ 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array (
+ 'config' => array ('title' => 'Config', 'auth' => '', 'cat' => array ('ACP_MODS')),
+ ),
+ ),
+ ), $acp_modules);
+
+ // No specific module and module class set to an incorrect name
+ $acp_modules = $this->acp_modules->get_module_infos('', 'wcp', true);
+ $this->assertEquals(array(), $acp_modules);
+
+ // No specific module, no module_class set in the function parameter, and an incorrect module class
+ $this->acp_modules->module_class = 'wcp';
+ $acp_modules = $this->acp_modules->get_module_infos();
+ $this->assertEquals(array(), $acp_modules);
+
+ // No specific module, module class set to false (will default to the above acp)
+ // Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (barfoo)
+ $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',
+ 'title' => 'Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ ),
+ 'acp_foobar' => array(
+ 'filename' => 'acp_foobar',
+ 'title' => 'ACP Foobar',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
+ ),
+ ),
+ 'phpbb_ext_barfoo_acp_a_module' => array(
+ 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'title' => 'Barfoo',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ )
+ ), $acp_modules);
+
+ // Specific module set to disabled extension
+ $acp_modules = $this->acp_modules->get_module_infos('phpbb_ext_barfoo_acp_a_module', 'acp', true);
+ $this->assertEquals(array(
+ 'phpbb_ext_barfoo_acp_a_module' => array(
+ 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'title' => 'Barfoo',
+ 'version' => '3.1.0-dev',
+ 'modes' => array(
+ 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ ),
+ )
+ ), $acp_modules);
+ }
+}
diff --git a/tests/extension/phpbb/default/implementation.php b/tests/extension/phpbb/default/implementation.php
new file mode 100644
index 0000000000..91d5f8aa2f
--- /dev/null
+++ b/tests/extension/phpbb/default/implementation.php
@@ -0,0 +1,5 @@
+<?php
+
+class phpbb_default_impl_class implements phpbb_default_interface
+{
+}
diff --git a/tests/extension/style_path_provider_test.php b/tests/extension/style_path_provider_test.php
new file mode 100644
index 0000000000..e1021c20ac
--- /dev/null
+++ b/tests/extension/style_path_provider_test.php
@@ -0,0 +1,50 @@
+<?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
new file mode 100644
index 0000000000..1b5ce62e5f
--- /dev/null
+++ b/tests/extension/subdir/style_path_provider_test.php
@@ -0,0 +1,18 @@
+<?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__) . '/../';
+ }
+}