aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2012-02-21 11:17:21 -0500
committerDavid King <imkingdavid@gmail.com>2012-03-19 09:12:33 -0400
commitd235262bc21657f0693501ac1154e1443578d507 (patch)
treeb2ec9edc55b93f236fb62f5560b99d0a62cd3b0d
parenta37a28b48546afc880446db7e4b2fd87c70a6cda (diff)
downloadforums-d235262bc21657f0693501ac1154e1443578d507.tar
forums-d235262bc21657f0693501ac1154e1443578d507.tar.gz
forums-d235262bc21657f0693501ac1154e1443578d507.tar.bz2
forums-d235262bc21657f0693501ac1154e1443578d507.tar.xz
forums-d235262bc21657f0693501ac1154e1443578d507.zip
[ticket/10586] Adding the extensions used by the tests
PHPBB3-10586
-rw-r--r--tests/functional/fixtures/ext/error/class/controller.php17
-rw-r--r--tests/functional/fixtures/ext/error/class/ext.php6
-rw-r--r--tests/functional/fixtures/ext/error/classtype/controller.php17
-rw-r--r--tests/functional/fixtures/ext/error/classtype/ext.php6
-rw-r--r--tests/functional/fixtures/ext/error/disabled/controller.php17
-rw-r--r--tests/functional/fixtures/ext/error/disabled/ext.php6
-rw-r--r--tests/functional/fixtures/ext/foo/bar/controller.php17
-rw-r--r--tests/functional/fixtures/ext/foo/bar/ext.php6
-rw-r--r--tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html5
-rw-r--r--tests/functional/fixtures/ext/foobar/controller.php17
-rw-r--r--tests/functional/fixtures/ext/foobar/ext.php6
-rw-r--r--tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html5
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php18
13 files changed, 137 insertions, 6 deletions
diff --git a/tests/functional/fixtures/ext/error/class/controller.php b/tests/functional/fixtures/ext/error/class/controller.php
new file mode 100644
index 0000000000..eb2ae362a6
--- /dev/null
+++ b/tests/functional/fixtures/ext/error/class/controller.php
@@ -0,0 +1,17 @@
+<?php
+
+class phpbb_ext_foobar_controller implements phpbb_extension_controller_interface
+{
+ public function handle()
+ {
+ global $template;
+ $template->set_ext_dir_prefix($phpbb_root_path . 'ext/error/class/');
+
+ $template->set_filenames(array(
+ 'body' => 'index_body.html'
+ ));
+
+ page_header('Test extension');
+ page_footer();
+ }
+}
diff --git a/tests/functional/fixtures/ext/error/class/ext.php b/tests/functional/fixtures/ext/error/class/ext.php
new file mode 100644
index 0000000000..f97ad2b838
--- /dev/null
+++ b/tests/functional/fixtures/ext/error/class/ext.php
@@ -0,0 +1,6 @@
+<?php
+
+class phpbb_ext_error_class_ext extends phpbb_extension_base
+{
+
+}
diff --git a/tests/functional/fixtures/ext/error/classtype/controller.php b/tests/functional/fixtures/ext/error/classtype/controller.php
new file mode 100644
index 0000000000..2276548b55
--- /dev/null
+++ b/tests/functional/fixtures/ext/error/classtype/controller.php
@@ -0,0 +1,17 @@
+<?php
+
+class phpbb_ext_error_classtype_controller
+{
+ public function handle()
+ {
+ global $template;
+ $template->set_ext_dir_prefix($phpbb_root_path . 'ext/error/classtype/');
+
+ $template->set_filenames(array(
+ 'body' => 'index_body.html'
+ ));
+
+ page_header('Test extension');
+ page_footer();
+ }
+}
diff --git a/tests/functional/fixtures/ext/error/classtype/ext.php b/tests/functional/fixtures/ext/error/classtype/ext.php
new file mode 100644
index 0000000000..35b1cd15a2
--- /dev/null
+++ b/tests/functional/fixtures/ext/error/classtype/ext.php
@@ -0,0 +1,6 @@
+<?php
+
+class phpbb_ext_error_classtype_ext extends phpbb_extension_base
+{
+
+}
diff --git a/tests/functional/fixtures/ext/error/disabled/controller.php b/tests/functional/fixtures/ext/error/disabled/controller.php
new file mode 100644
index 0000000000..b83a949020
--- /dev/null
+++ b/tests/functional/fixtures/ext/error/disabled/controller.php
@@ -0,0 +1,17 @@
+<?php
+
+class phpbb_ext_error_disabled_controller implements phpbb_extension_controller_interface
+{
+ public function handle()
+ {
+ global $template;
+ $template->set_ext_dir_prefix($phpbb_root_path . 'ext/error/disabled/');
+
+ $template->set_filenames(array(
+ 'body' => 'index_body.html'
+ ));
+
+ page_header('Test extension');
+ page_footer();
+ }
+}
diff --git a/tests/functional/fixtures/ext/error/disabled/ext.php b/tests/functional/fixtures/ext/error/disabled/ext.php
new file mode 100644
index 0000000000..aec8051848
--- /dev/null
+++ b/tests/functional/fixtures/ext/error/disabled/ext.php
@@ -0,0 +1,6 @@
+<?php
+
+class phpbb_ext_error_disabled_ext extends phpbb_extension_base
+{
+
+}
diff --git a/tests/functional/fixtures/ext/foo/bar/controller.php b/tests/functional/fixtures/ext/foo/bar/controller.php
new file mode 100644
index 0000000000..93d1f099c9
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/controller.php
@@ -0,0 +1,17 @@
+<?php
+
+class phpbb_ext_foo_bar_controller implements phpbb_extension_controller_interface
+{
+ public function handle()
+ {
+ global $template;
+ $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/');
+
+ $template->set_filenames(array(
+ 'body' => 'index_body.html'
+ ));
+
+ page_header('Test extension');
+ page_footer();
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php
new file mode 100644
index 0000000000..3a2068631e
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/ext.php
@@ -0,0 +1,6 @@
+<?php
+
+class phpbb_ext_foo_bar_ext extends phpbb_extension_base
+{
+
+}
diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html
new file mode 100644
index 0000000000..4addf2666f
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html
@@ -0,0 +1,5 @@
+<!-- INCLUDE overall_header.html -->
+
+<div id="welcome">This is for testing purposes.</div>
+
+<!-- INCLUDE overall_footer.html -->
diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php
new file mode 100644
index 0000000000..c3ef29ffef
--- /dev/null
+++ b/tests/functional/fixtures/ext/foobar/controller.php
@@ -0,0 +1,17 @@
+<?php
+
+class phpbb_ext_foobar_controller implements phpbb_extension_controller_interface
+{
+ public function handle()
+ {
+ global $template;
+ $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/');
+
+ $template->set_filenames(array(
+ 'body' => 'index_body.html'
+ ));
+
+ page_header('Test extension');
+ page_footer();
+ }
+}
diff --git a/tests/functional/fixtures/ext/foobar/ext.php b/tests/functional/fixtures/ext/foobar/ext.php
new file mode 100644
index 0000000000..7b3f37cbfb
--- /dev/null
+++ b/tests/functional/fixtures/ext/foobar/ext.php
@@ -0,0 +1,6 @@
+<?php
+
+class phpbb_ext_fooar_ext extends phpbb_extension_base
+{
+
+}
diff --git a/tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html b/tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html
new file mode 100644
index 0000000000..4addf2666f
--- /dev/null
+++ b/tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html
@@ -0,0 +1,5 @@
+<!-- INCLUDE overall_header.html -->
+
+<div id="welcome">This is for testing purposes.</div>
+
+<!-- INCLUDE overall_footer.html -->
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index b2ae215d91..9797ecfef8 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -14,6 +14,8 @@ class phpbb_functional_test_case extends phpbb_test_case
protected $client;
protected $root_url;
+ protected $db = null;
+
static protected $config = array();
static protected $already_installed = false;
@@ -69,14 +71,18 @@ class phpbb_functional_test_case extends phpbb_test_case
protected function get_db()
{
global $phpbb_root_path, $phpEx;
- if (!class_exists('dbal_' . self::$config['dbms']))
+ // so we don't reopen an open connection
+ if (!($this->db instanceof dbal))
{
- include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx");
+ if (!class_exists('dbal_' . self::$config['dbms']))
+ {
+ include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx");
+ }
+ $sql_db = 'dbal_' . self::$config['dbms'];
+ $this->db = new $sql_db();
+ $this->db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']);
}
- $sql_db = 'dbal_' . self::$config['dbms'];
- $db = new $sql_db();
- $db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']);
- return $db;
+ return $this->db;
}
protected function get_ext_manager()