aboutsummaryrefslogtreecommitdiffstats
path: root/tests/extension
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extension')
-rw-r--r--tests/extension/ext/vendor3/foo/composer.json23
-rw-r--r--tests/extension/ext/vendor3/foo/ext.php20
-rw-r--r--tests/extension/manager_test.php15
3 files changed, 57 insertions, 1 deletions
diff --git a/tests/extension/ext/vendor3/foo/composer.json b/tests/extension/ext/vendor3/foo/composer.json
new file mode 100644
index 0000000000..b4b3e6f32f
--- /dev/null
+++ b/tests/extension/ext/vendor3/foo/composer.json
@@ -0,0 +1,23 @@
+{
+ "name": "vendor3/foo",
+ "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",
+ "license": "GPL-2.0",
+ "authors": [{
+ "name": "John Smith",
+ "email": "email@phpbb.com",
+ "homepage": "http://phpbb.com",
+ "role": "N/A"
+ }],
+ "require": {
+ "php": ">=5.3"
+ },
+ "extra": {
+ "display-name": "phpBB Bar Extension",
+ "soft-require": {
+ "phpbb/phpbb": "3.1.*@dev"
+ }
+ }
+}
diff --git a/tests/extension/ext/vendor3/foo/ext.php b/tests/extension/ext/vendor3/foo/ext.php
new file mode 100644
index 0000000000..b52649d921
--- /dev/null
+++ b/tests/extension/ext/vendor3/foo/ext.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace vendor3\foo;
+
+class ext extends \phpbb\extension\base
+{
+ static public $enabled;
+
+ public function enable_step($old_state)
+ {
+ self::$enabled = true;
+
+ return self::$enabled;
+ }
+
+ public function is_enableable()
+ {
+ return false;
+ }
+}
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 067fd62581..1e43c2a0a3 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -13,6 +13,7 @@
require_once dirname(__FILE__) . '/ext/vendor2/bar/ext.php';
require_once dirname(__FILE__) . '/ext/vendor2/foo/ext.php';
+require_once dirname(__FILE__) . '/ext/vendor3/foo/ext.php';
require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php';
class phpbb_extension_manager_test extends phpbb_database_test_case
@@ -35,7 +36,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_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()));
+ $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo'), array_keys($this->extension_manager->all_available()));
}
public function test_all_enabled()
@@ -100,6 +101,18 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$this->assertEquals(4, vendor2\bar\ext::$state);
}
+ public function test_enable_not_enableable()
+ {
+ vendor3\foo\ext::$enabled = false;
+
+ $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled()));
+ $this->extension_manager->enable('vendor3/foo');
+ $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->assertSame(false, vendor3\foo\ext::$enabled);
+ }
+
public function test_disable()
{
vendor2\foo\ext::$disabled = false;