aboutsummaryrefslogtreecommitdiffstats
path: root/tests/extension/metadata_manager_test.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-07-29 20:08:30 -0500
committerUnknown Bliss <m@michaelcullum.com>2012-09-01 15:05:49 +0100
commit36465c9a205c356b0662e45b4fded79c4b476547 (patch)
tree5be0d398e3e29fe2b701fb8c9f79c4a959aa485b /tests/extension/metadata_manager_test.php
parent500879520c40a71f0b83799ab3e59c86c12a801a (diff)
downloadforums-36465c9a205c356b0662e45b4fded79c4b476547.tar
forums-36465c9a205c356b0662e45b4fded79c4b476547.tar.gz
forums-36465c9a205c356b0662e45b4fded79c4b476547.tar.bz2
forums-36465c9a205c356b0662e45b4fded79c4b476547.tar.xz
forums-36465c9a205c356b0662e45b4fded79c4b476547.zip
[ticket/10631] Functional acp_extensions test, cleanup
PHPBB3-10631
Diffstat (limited to 'tests/extension/metadata_manager_test.php')
-rw-r--r--tests/extension/metadata_manager_test.php99
1 files changed, 48 insertions, 51 deletions
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index 67630e9f36..d1e60ad268 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -11,7 +11,14 @@ class 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()
{
@@ -22,15 +29,30 @@ class metadata_manager_test extends phpbb_database_test_case
{
parent::setUp();
+ $this->cache = new phpbb_mock_cache();
+ $this->config = new phpbb_config(array(
+ 'version' => '3.1.0',
+ ));
+ $this->db = $this->new_dbal();
$this->phpbb_root_path = dirname(__FILE__) . '/';
+ $this->phpEx = '.php';
+ $this->user = new phpbb_user();
+
+ $this->template = new phpbb_template(
+ $this->phpbb_root_path,
+ $this->phpEx,
+ $this->config,
+ $this->user,
+ new phpbb_style_resource_locator()
+ );
$this->extension_manager = new phpbb_extension_manager(
- $this->new_dbal(),
- new phpbb_config(array()),
+ $this->db(),
+ $this->config,
'phpbb_ext',
$this->phpbb_root_path,
- '.php',
- new phpbb_mock_cache
+ $this->phpEx,
+ $this->cache
);
}
@@ -39,21 +61,7 @@ class metadata_manager_test extends phpbb_database_test_case
{
$ext_name = 'bar';
- $manager = new phpbb_extension_metadata_manager_test(
- $ext_name,
- $this->new_dbal(),
- $this->extension_manager,
- $this->phpbb_root_path,
- '.php',
- new phpbb_template(
- $this->phpbb_root_path,
- '.php',
- new phpbb_config(array()),
- new phpbb_user(),
- new phpbb_style_resource_locator()
- ),
- new phpbb_config(array())
- );
+ $manager = $this->get_metadata_manager($ext_name);
try
{
@@ -69,21 +77,7 @@ class metadata_manager_test extends phpbb_database_test_case
{
$ext_name = 'foo';
- $manager = new phpbb_extension_metadata_manager_test(
- $ext_name,
- $this->new_dbal(),
- $this->extension_manager,
- $this->phpbb_root_path,
- '.php',
- new phpbb_template(
- $this->phpbb_root_path,
- '.php',
- new phpbb_config(array()),
- new phpbb_user(),
- new phpbb_style_resource_locator()
- ),
- new phpbb_config(array())
- );
+ $manager = $this->get_metadata_manager($ext_name);
try
{
@@ -103,23 +97,7 @@ class metadata_manager_test extends phpbb_database_test_case
{
$ext_name = 'validator';
- $manager = new phpbb_extension_metadata_manager_test(
- $ext_name,
- $this->new_dbal(),
- $this->extension_manager,
- $this->phpbb_root_path,
- '.php',
- new phpbb_template(
- $this->phpbb_root_path,
- '.php',
- new phpbb_config(array()),
- new phpbb_user(),
- new phpbb_style_resource_locator()
- ),
- new phpbb_config(array(
- 'version' => '3.1.0',
- ))
- );
+ $manager = $this->get_metadata_manager($ext_name);
// Non-existant data
try
@@ -358,6 +336,25 @@ class metadata_manager_test extends phpbb_database_test_case
$this->fail($e);
}
}
+
+ /**
+ * Get an instance of the metadata manager
+ *
+ * @param string $ext_name
+ * @return phpbb_extension_metadata_manager_test
+ */
+ private function get_metadata_manager($ext_name)
+ {
+ return new phpbb_extension_metadata_manager_test(
+ $ext_name,
+ $this->new_dbal(),
+ $this->extension_manager,
+ $this->phpbb_root_path,
+ $this->phpEx,
+ $this->template,
+ $this->config
+ );
+ }
}
class phpbb_extension_metadata_manager_test extends phpbb_extension_metadata_manager