diff options
author | Cesar G <prototech91@gmail.com> | 2013-12-12 04:29:48 -0800 |
---|---|---|
committer | Cesar G <prototech91@gmail.com> | 2013-12-12 10:52:51 -0800 |
commit | 31234b26d892bb4d98c9bc869d340a8ccf3cfe88 (patch) | |
tree | 435d11d23051c7a6eb086380e795927464c96f2b /tests/extension | |
parent | 4d65727accb097641f72e8bf24c5a194873affc7 (diff) | |
download | forums-31234b26d892bb4d98c9bc869d340a8ccf3cfe88.tar forums-31234b26d892bb4d98c9bc869d340a8ccf3cfe88.tar.gz forums-31234b26d892bb4d98c9bc869d340a8ccf3cfe88.tar.bz2 forums-31234b26d892bb4d98c9bc869d340a8ccf3cfe88.tar.xz forums-31234b26d892bb4d98c9bc869d340a8ccf3cfe88.zip |
[ticket/12009] Move valid extensions in tests to correct dir structure.
PHPBB3-12009
Diffstat (limited to 'tests/extension')
-rw-r--r-- | tests/extension/ext/vendor/moo/composer.json | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/bar/acp/a_info.php (renamed from tests/extension/ext/barfoo/acp/a_info.php) | 6 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/bar/acp/a_module.php (renamed from tests/extension/ext/barfoo/acp/a_module.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/bar/composer.json | 21 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/bar/ext.php (renamed from tests/extension/ext/bar/ext.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/a_class.php (renamed from tests/extension/ext/foo/a_class.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/acp/a_info.php (renamed from tests/extension/ext/foo/acp/a_info.php) | 4 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/acp/a_module.php (renamed from tests/extension/ext/foo/mcp/a_module.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/acp/fail_info.php (renamed from tests/extension/ext/foo/acp/fail_info.php) | 4 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/acp/fail_module.php (renamed from tests/extension/ext/foo/acp/fail_module.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/b_class.php (renamed from tests/extension/ext/foo/b_class.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/composer.json (renamed from tests/extension/ext/foo/composer.json) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/ext.php (renamed from tests/extension/ext/foo/ext.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/mcp/a_info.php (renamed from tests/extension/ext/foo/mcp/a_info.php) | 4 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/mcp/a_module.php (renamed from tests/extension/ext/foo/acp/a_module.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/sub/type/alternative.php (renamed from tests/extension/ext/foo/sub/type/alternative.php) | 0 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/type/alternative.php (renamed from tests/extension/ext/foo/type/alternative.php) | 0 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/type/dummy/empty.txt (renamed from tests/extension/ext/foo/type/dummy/empty.txt) | 0 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/foo/typewrong/error.php (renamed from tests/extension/ext/foo/typewrong/error.php) | 0 | ||||
-rw-r--r-- | tests/extension/ext/vendor3/bar/ext.php | 26 | ||||
-rw-r--r-- | tests/extension/ext/vendor3/bar/my/hidden_class.php (renamed from tests/extension/ext/bar/my/hidden_class.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor3/bar/styles/prosilver/template/foobar_body.html (renamed from tests/extension/ext/bar/styles/prosilver/template/foobar_body.html) | 0 | ||||
-rw-r--r-- | tests/extension/finder_test.php | 44 | ||||
-rw-r--r-- | tests/extension/fixtures/extensions.xml | 2 | ||||
-rw-r--r-- | tests/extension/manager_test.php | 43 | ||||
-rw-r--r-- | tests/extension/metadata_manager_test.php | 6 | ||||
-rw-r--r-- | tests/extension/modules_test.php | 60 |
27 files changed, 145 insertions, 97 deletions
diff --git a/tests/extension/ext/vendor/moo/composer.json b/tests/extension/ext/vendor/moo/composer.json index 4dc36963b3..901cb7f17a 100644 --- a/tests/extension/ext/vendor/moo/composer.json +++ b/tests/extension/ext/vendor/moo/composer.json @@ -1,5 +1,5 @@ { - "name": "moo/example", + "name": "vendor/moo", "type": "phpbb-extension", "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", diff --git a/tests/extension/ext/barfoo/acp/a_info.php b/tests/extension/ext/vendor2/bar/acp/a_info.php index ea07189f7a..8132df587f 100644 --- a/tests/extension/ext/barfoo/acp/a_info.php +++ b/tests/extension/ext/vendor2/bar/acp/a_info.php @@ -1,14 +1,14 @@ <?php -namespace barfoo\acp; +namespace vendor2\bar\acp; class a_info { public function module() { return array( - 'filename' => 'barfoo\\acp\\a_module', - 'title' => 'Barfoo', + 'filename' => 'vendor2\\bar\\acp\\a_module', + 'title' => 'Bar', '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/vendor2/bar/acp/a_module.php index 0ae8775013..3a3d105790 100644 --- a/tests/extension/ext/barfoo/acp/a_module.php +++ b/tests/extension/ext/vendor2/bar/acp/a_module.php @@ -1,6 +1,6 @@ <?php -namespace barfoo\acp; +namespace vendor2\bar\acp; class a_module { diff --git a/tests/extension/ext/vendor2/bar/composer.json b/tests/extension/ext/vendor2/bar/composer.json new file mode 100644 index 0000000000..5d60ec031e --- /dev/null +++ b/tests/extension/ext/vendor2/bar/composer.json @@ -0,0 +1,21 @@ +{ + "name": "vendor2/bar", + "type": "phpbb-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": "John Smith", + "email": "email@phpbb.com", + "homepage": "http://phpbb.com", + "role": "N/A" + }], + "require": { + "php": ">=5.3", + "phpbb/phpbb": "3.1.*@dev" + }, + "extra": { + "display-name": "phpBB Bar Extension" + } +} diff --git a/tests/extension/ext/bar/ext.php b/tests/extension/ext/vendor2/bar/ext.php index 22ff5e8077..f94ab9ad81 100644 --- a/tests/extension/ext/bar/ext.php +++ b/tests/extension/ext/vendor2/bar/ext.php @@ -1,6 +1,6 @@ <?php -namespace bar; +namespace vendor2\bar; class ext extends \phpbb\extension\base { diff --git a/tests/extension/ext/foo/a_class.php b/tests/extension/ext/vendor2/foo/a_class.php index 9db45a697f..06278c0e0c 100644 --- a/tests/extension/ext/foo/a_class.php +++ b/tests/extension/ext/vendor2/foo/a_class.php @@ -1,6 +1,6 @@ <?php -namespace foo; +namespace vendor2\foo; class a_class { diff --git a/tests/extension/ext/foo/acp/a_info.php b/tests/extension/ext/vendor2/foo/acp/a_info.php index 3b7d8cdd42..27e67c1556 100644 --- a/tests/extension/ext/foo/acp/a_info.php +++ b/tests/extension/ext/vendor2/foo/acp/a_info.php @@ -1,13 +1,13 @@ <?php -namespace foo\acp; +namespace vendor2\foo\acp; class a_info { public function module() { return array( - 'filename' => 'foo\\acp\\a_module', + 'filename' => 'vendor2\\foo\\acp\\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/vendor2/foo/acp/a_module.php index ca397e7004..78d91af2fe 100644 --- a/tests/extension/ext/foo/mcp/a_module.php +++ b/tests/extension/ext/vendor2/foo/acp/a_module.php @@ -1,6 +1,6 @@ <?php -namespace foo\mcp; +namespace vendor2\foo\acp; class a_module { diff --git a/tests/extension/ext/foo/acp/fail_info.php b/tests/extension/ext/vendor2/foo/acp/fail_info.php index 01d29fc5eb..d9b4353957 100644 --- a/tests/extension/ext/foo/acp/fail_info.php +++ b/tests/extension/ext/vendor2/foo/acp/fail_info.php @@ -1,6 +1,6 @@ <?php -namespace foo\acp; +namespace vendor2\foo\acp; /* * Due to the mismatch between the class name and the file name, this module @@ -11,7 +11,7 @@ class foo_info public function module() { return array( - 'filename' => 'foo\acp\fail_module', + 'filename' => 'vendor2\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/vendor2/foo/acp/fail_module.php index 8070929d3c..c8a5eae745 100644 --- a/tests/extension/ext/foo/acp/fail_module.php +++ b/tests/extension/ext/vendor2/foo/acp/fail_module.php @@ -1,6 +1,6 @@ <?php -namespace foo\acp; +namespace vendor2\foo\acp; /* * Due to the mismatch between the class name and the file name of the module diff --git a/tests/extension/ext/foo/b_class.php b/tests/extension/ext/vendor2/foo/b_class.php index bb2a77c05e..3d0f193908 100644 --- a/tests/extension/ext/foo/b_class.php +++ b/tests/extension/ext/vendor2/foo/b_class.php @@ -1,6 +1,6 @@ <?php -namespace foo; +namespace vendor2\foo; class b_class { diff --git a/tests/extension/ext/foo/composer.json b/tests/extension/ext/vendor2/foo/composer.json index 5367eaf593..8821d9d50e 100644 --- a/tests/extension/ext/foo/composer.json +++ b/tests/extension/ext/vendor2/foo/composer.json @@ -1,5 +1,5 @@ { - "name": "foo/example", + "name": "vendor2/foo", "type": "phpbb-extension", "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/vendor2/foo/ext.php index ac6098f2f1..15480fe92a 100644 --- a/tests/extension/ext/foo/ext.php +++ b/tests/extension/ext/vendor2/foo/ext.php @@ -1,6 +1,6 @@ <?php -namespace foo; +namespace vendor2\foo; class ext extends \phpbb\extension\base { diff --git a/tests/extension/ext/foo/mcp/a_info.php b/tests/extension/ext/vendor2/foo/mcp/a_info.php index 9a896ce808..b5599fde65 100644 --- a/tests/extension/ext/foo/mcp/a_info.php +++ b/tests/extension/ext/vendor2/foo/mcp/a_info.php @@ -1,13 +1,13 @@ <?php -namespace foo\mcp; +namespace vendor2\foo\mcp; class a_info { public function module() { return array( - 'filename' => 'foo\\mcp\\a_module', + 'filename' => 'vendor2\\foo\\mcp\\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/vendor2/foo/mcp/a_module.php index 7aa2351ab3..fe29783827 100644 --- a/tests/extension/ext/foo/acp/a_module.php +++ b/tests/extension/ext/vendor2/foo/mcp/a_module.php @@ -1,6 +1,6 @@ <?php -namespace foo\acp; +namespace vendor2\foo\mcp; class a_module { diff --git a/tests/extension/ext/foo/sub/type/alternative.php b/tests/extension/ext/vendor2/foo/sub/type/alternative.php index 1eaf794609..1eaf794609 100644 --- a/tests/extension/ext/foo/sub/type/alternative.php +++ b/tests/extension/ext/vendor2/foo/sub/type/alternative.php diff --git a/tests/extension/ext/foo/type/alternative.php b/tests/extension/ext/vendor2/foo/type/alternative.php index 8f753491ef..8f753491ef 100644 --- a/tests/extension/ext/foo/type/alternative.php +++ b/tests/extension/ext/vendor2/foo/type/alternative.php diff --git a/tests/extension/ext/foo/type/dummy/empty.txt b/tests/extension/ext/vendor2/foo/type/dummy/empty.txt index e69de29bb2..e69de29bb2 100644 --- a/tests/extension/ext/foo/type/dummy/empty.txt +++ b/tests/extension/ext/vendor2/foo/type/dummy/empty.txt diff --git a/tests/extension/ext/foo/typewrong/error.php b/tests/extension/ext/vendor2/foo/typewrong/error.php index 5020926043..5020926043 100644 --- a/tests/extension/ext/foo/typewrong/error.php +++ b/tests/extension/ext/vendor2/foo/typewrong/error.php diff --git a/tests/extension/ext/vendor3/bar/ext.php b/tests/extension/ext/vendor3/bar/ext.php new file mode 100644 index 0000000000..37a5e92059 --- /dev/null +++ b/tests/extension/ext/vendor3/bar/ext.php @@ -0,0 +1,26 @@ +<?php + +namespace vendor3\bar; + +class 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/vendor3/bar/my/hidden_class.php index 504c1873dc..38eb59aadf 100644 --- a/tests/extension/ext/bar/my/hidden_class.php +++ b/tests/extension/ext/vendor3/bar/my/hidden_class.php @@ -1,6 +1,6 @@ <?php -namespace bar\my; +namespace vendor3\bar\my; class hidden_class { diff --git a/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html b/tests/extension/ext/vendor3/bar/styles/prosilver/template/foobar_body.html index 00c2a84a18..00c2a84a18 100644 --- a/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html +++ b/tests/extension/ext/vendor3/bar/styles/prosilver/template/foobar_body.html diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 8e6e71aaf8..d0ca5956b4 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -18,15 +18,15 @@ class phpbb_extension_finder_test extends phpbb_test_case $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( - 'foo' => array( - 'ext_name' => 'foo', + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', 'ext_active' => '1', - 'ext_path' => 'ext/foo/', + 'ext_path' => 'ext/vendor2/foo/', ), - 'bar' => array( - 'ext_name' => 'bar', + 'vendor3/bar' => array( + 'ext_name' => 'vendor3/bar', 'ext_active' => '1', - 'ext_path' => 'ext/bar/', + 'ext_path' => 'ext/vendor3/bar/', ), )); @@ -43,10 +43,10 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\bar\my\hidden_class', - '\foo\a_class', - '\foo\b_class', '\phpbb\default\implementation', + '\vendor2\foo\a_class', + '\vendor2\foo\b_class', + '\vendor3\bar\my\hidden_class', ), $classes ); @@ -60,7 +60,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($dirs); $this->assertEquals(array( - dirname(__FILE__) . '/ext/foo/type/', + dirname(__FILE__) . '/ext/vendor2/foo/type/', ), $dirs); } @@ -72,9 +72,9 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($dirs); $this->assertEquals(array( - dirname(__FILE__) . '/ext/foo/sub/type/', - dirname(__FILE__) . '/ext/foo/type/', - dirname(__FILE__) . '/ext/foo/typewrong/', + dirname(__FILE__) . '/ext/vendor2/foo/sub/type/', + dirname(__FILE__) . '/ext/vendor2/foo/type/', + dirname(__FILE__) . '/ext/vendor2/foo/typewrong/', ), $dirs); } @@ -88,8 +88,8 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\bar\my\hidden_class', '\phpbb\default\implementation', + '\vendor3\bar\my\hidden_class', ), $classes ); @@ -105,9 +105,9 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\sub\type\alternative', - '\foo\type\alternative', '\phpbb\default\implementation', + '\vendor2\foo\sub\type\alternative', + '\vendor2\foo\type\alternative', ), $classes ); @@ -122,7 +122,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\type\alternative', + '\vendor2\foo\type\alternative', ), $classes ); @@ -137,7 +137,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\sub\type\alternative', + '\vendor2\foo\sub\type\alternative', ), $classes ); @@ -152,7 +152,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\sub\type\alternative', + '\vendor2\foo\sub\type\alternative', ), $classes ); @@ -162,14 +162,14 @@ class phpbb_extension_finder_test extends phpbb_test_case { $files = $this->finder ->extension_directory('/type') - ->find_from_extension('foo', dirname(__FILE__) . '/ext/foo/'); + ->find_from_extension('vendor2/foo', dirname(__FILE__) . '/ext/vendor2/foo/'); $classes = $this->finder->get_classes_from_files($files); sort($classes); $this->assertEquals( array( - '\foo\type\alternative', - '\foo\type\dummy\empty', + '\vendor2\foo\type\alternative', + '\vendor2\foo\type\dummy\empty', ), $classes ); diff --git a/tests/extension/fixtures/extensions.xml b/tests/extension/fixtures/extensions.xml index 6eb6fd11a5..6846162f0f 100644 --- a/tests/extension/fixtures/extensions.xml +++ b/tests/extension/fixtures/extensions.xml @@ -5,7 +5,7 @@ <column>ext_active</column> <column>ext_state</column> <row> - <value>foo</value> + <value>vendor2/foo</value> <value>1</value> <value></value> </row> diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index b127daf2ed..cc32a6af4e 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -7,8 +7,8 @@ * */ -require_once dirname(__FILE__) . '/ext/bar/ext.php'; -require_once dirname(__FILE__) . '/ext/foo/ext.php'; +require_once dirname(__FILE__) . '/ext/vendor2/bar/ext.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/ext.php'; require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php'; class phpbb_extension_manager_test extends phpbb_database_test_case @@ -30,52 +30,53 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_available() { - $this->assertEquals(array('bar', 'barfoo', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_available())); + // barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure. + $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_available())); } public function test_enabled() { - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor2/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())); + $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); } public function test_enable() { - bar\ext::$state = 0; + vendor2\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(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->enable('vendor2/bar'); + $this->assertEquals(array('vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); - $this->assertEquals(4, bar\ext::$state); + $this->assertEquals(4, vendor2\bar\ext::$state); } public function test_disable() { - foo\ext::$disabled = false; + vendor2\foo\ext::$disabled = false; - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); - $this->extension_manager->disable('foo'); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->disable('vendor2/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->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); - $this->assertTrue(foo\ext::$disabled); + $this->assertTrue(vendor2\foo\ext::$disabled); } public function test_purge() { 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->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor/moo', 'vendor2/foo'), 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->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_configured())); $this->assertTrue(vendor\moo\ext::$purged); } @@ -84,7 +85,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case { $extension_manager = $this->create_extension_manager(false); - $this->assertEquals(array('foo'), array_keys($extension_manager->all_enabled())); + $this->assertEquals(array('vendor2/foo'), array_keys($extension_manager->all_enabled())); } protected function create_extension_manager($with_cache = true) diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 09eb83cd86..592421f9e7 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -82,7 +82,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case // Should fail from missing composer.json public function test_bar() { - $ext_name = 'bar'; + $ext_name = 'vendor3/bar'; $manager = $this->get_metadata_manager($ext_name); @@ -98,7 +98,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case // Should be the same as a direct json_decode of the composer.json file public function test_foo() { - $ext_name = 'foo'; + $ext_name = 'vendor2/foo'; $manager = $this->get_metadata_manager($ext_name); @@ -111,7 +111,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail($e); } - $json = json_decode(file_get_contents($this->phpbb_root_path . 'ext/foo/composer.json'), true); + $json = json_decode(file_get_contents($this->phpbb_root_path . 'ext/vendor2/foo/composer.json'), true); $this->assertEquals($metadata, $json); } diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index ef21c943c2..5dcb24c691 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -7,10 +7,10 @@ * */ -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__) . '/ext/vendor2/foo/acp/a_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/mcp/a_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/acp/fail_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/bar/acp/a_info.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php'; class phpbb_extension_modules_test extends phpbb_test_case @@ -25,15 +25,15 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( - 'foo' => array( - 'ext_name' => 'foo', + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', 'ext_active' => '1', - 'ext_path' => 'ext/foo/', + 'ext_path' => 'ext/vendor2/foo/', ), - 'bar' => array( - 'ext_name' => 'bar', + 'vendor3/bar' => array( + 'ext_name' => 'vendor3/bar', 'ext_active' => '1', - 'ext_path' => 'ext/bar/', + 'ext_path' => 'ext/vendor3/bar/', ), )); $phpbb_extension_manager = $this->extension_manager; @@ -54,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( - 'foo\\acp\\a_module' => array( - 'filename' => 'foo\\acp\\a_module', + 'vendor2\\foo\\acp\\a_module' => array( + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -76,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( - 'foo\\mcp\\a_module' => array( - 'filename' => 'foo\\mcp\\a_module', + 'vendor2\\foo\\mcp\\a_module' => array( + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -90,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( - 'foo\\mcp\\a_module' => array( - 'filename' => 'foo\\mcp\\a_module', + 'vendor2\\foo\\mcp\\a_module' => array( + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -104,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( - 'foo\\mcp\\a_module' => array( - 'filename' => 'foo\\mcp\\a_module', + 'vendor2\\foo\\mcp\\a_module' => array( + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -128,8 +128,8 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->acp_modules->module_class = 'acp'; $acp_modules = $this->acp_modules->get_module_infos('foo_acp_a_module'); $this->assertEquals(array( - 'foo\\acp\\a_module' => array ( - 'filename' => 'foo\\acp\\a_module', + 'vendor2\\foo\\acp\\a_module' => array ( + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array ( @@ -148,12 +148,12 @@ class phpbb_extension_modules_test extends phpbb_test_case $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) + // Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (vendor2/bar) $this->acp_modules->module_class = 'acp'; $acp_modules = $this->acp_modules->get_module_infos('', false, true); $this->assertEquals(array( - 'foo\\acp\\a_module' => array( - 'filename' => 'foo\\acp\\a_module', + 'vendor2\\foo\\acp\\a_module' => array( + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -168,9 +168,9 @@ class phpbb_extension_modules_test extends phpbb_test_case 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')), ), ), - 'barfoo\\acp\\a_module' => array( - 'filename' => 'barfoo\\acp\\a_module', - 'title' => 'Barfoo', + 'vendor2\\bar\\acp\\a_module' => array( + 'filename' => 'vendor2\\bar\\acp\\a_module', + 'title' => 'Bar', 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), @@ -179,11 +179,11 @@ 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('barfoo_acp_a_module', 'acp', true); + $acp_modules = $this->acp_modules->get_module_infos('vendor2_bar_acp_a_module', 'acp', true); $this->assertEquals(array( - 'barfoo\\acp\\a_module' => array( - 'filename' => 'barfoo\\acp\\a_module', - 'title' => 'Barfoo', + 'vendor2\\bar\\acp\\a_module' => array( + 'filename' => 'vendor2\\bar\\acp\\a_module', + 'title' => 'Bar', 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), |