aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-02-25 13:12:57 -0600
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-02-25 13:12:57 -0600
commite632049e197131df9fbe8c078007cf37cf94c241 (patch)
treef305a7163e264f2ad9eb23c0d224c91b8a848e34 /tests
parent7a8ae493009eac3d4f5c97279f0be6e10c588002 (diff)
parentf6a894f07700627b675c2b16aab4714df5819a23 (diff)
downloadforums-e632049e197131df9fbe8c078007cf37cf94c241.tar
forums-e632049e197131df9fbe8c078007cf37cf94c241.tar.gz
forums-e632049e197131df9fbe8c078007cf37cf94c241.tar.bz2
forums-e632049e197131df9fbe8c078007cf37cf94c241.tar.xz
forums-e632049e197131df9fbe8c078007cf37cf94c241.zip
Merge branch 'feature/migrations-data' of github.com:EXreaction/phpbb3 into feature/migrations-data
# By Dhruv (19) and others # Via Nathaniel Guse (3) and others * 'feature/migrations-data' of github.com:EXreaction/phpbb3: (38 commits) [feature/migrations] Use the user class for language handling [feature/migrations] Fully revert the removal of the user_msnm field [feature/migrations] Revert unrelated change to schema_data.sql [ticket/11179] remove extra & in function call [ticket/11179] correct start parameter in sphinx search [ticket/11179] correct start parameter in native author search [ticket/11179] correct start parameter in native keyword search [ticket/11179] fix success query path for postgres [ticket/11179] fix success query path for mysql [ticket/11179] minor fixes [ticket/11179] pass start param by reference in postgres [ticket/11179] correct start param in author search of postgres [ticket/11179] correct start parameter in psql keyword search [ticket/11179] pass start param by reference in author search [ticket/11179] correct start parameter for author search [ticket/11179] use FOUND_ROWS query to re-search with changed start param [ticket/11179] pass start parameter by reference [ticket/11179] correct the start parameter while retrieving from cache [ticket/11179] add search query in case initial one fails [ticket/11359] html escape sphinx config data ...
Diffstat (limited to 'tests')
-rw-r--r--tests/extension/manager_test.php38
-rw-r--r--tests/extension/metadata_manager_test.php4
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php27
3 files changed, 41 insertions, 28 deletions
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 5cde5bccdb..9032afbd73 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -25,14 +25,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
{
parent::setUp();
- $this->extension_manager = new phpbb_extension_manager(
- $this->new_dbal(),
- new phpbb_config(array()),
- 'phpbb_ext',
- dirname(__FILE__) . '/',
- '.php',
- new phpbb_mock_cache
- );
+ $this->extension_manager = $this->create_extension_manager();
}
public function test_available()
@@ -89,15 +82,30 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_enabled_no_cache()
{
- $extension_manager = new phpbb_extension_manager(
- $this->new_dbal(),
- new phpbb_config(array()),
- 'phpbb_ext',
- dirname(__FILE__) . '/',
- '.php'
- );
+ $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_';
+
+ return new phpbb_extension_manager(
+ new phpbb_mock_container_builder(),
+ $db,
+ $config,
+ new phpbb_db_migrator($config, $db, $db_tools, 'phpbb_migrations', $phpbb_root_path, $php_ext, $table_prefix, array()),
+ '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
index ce7be0dea5..cdea8d5258 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -34,9 +34,11 @@ class metadata_manager_test extends phpbb_database_test_case
'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(
$this->phpbb_root_path,
@@ -48,8 +50,10 @@ class metadata_manager_test extends phpbb_database_test_case
);
$this->extension_manager = new phpbb_extension_manager(
+ new phpbb_mock_container_builder(),
$this->db,
$this->config,
+ new phpbb_db_migrator($this->config, $this->db, $this->db_tools, 'phpbb_migrations', $this->phpbb_root_path, $this->php_ext, $this->table_prefix, array()),
'phpbb_ext',
$this->phpbb_root_path,
$this->phpEx,
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index e346223a4b..b570b464e6 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -134,19 +134,20 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
- if (!$this->extension_manager)
- {
- $this->extension_manager = new phpbb_extension_manager(
- $this->get_db(),
- new phpbb_config(array()),
- self::$config['table_prefix'] . 'ext',
- $phpbb_root_path,
- ".$phpEx",
- $this->get_cache_driver()
- );
- }
-
- return $this->extension_manager;
+ $config = new phpbb_config(array());
+ $db = $this->get_db();
+ $db_tools = new phpbb_db_tools($db);
+
+ return new phpbb_extension_manager(
+ new phpbb_mock_container_builder(),
+ $db,
+ $config,
+ new phpbb_db_migrator($config, $db, $db_tools, self::$config['table_prefix'] . 'migrations', $phpbb_root_path, $php_ext, self::$config['table_prefix'], array()),
+ self::$config['table_prefix'] . 'ext',
+ dirname(__FILE__) . '/',
+ '.' . $php_ext,
+ $this->get_cache_driver()
+ );
}
static protected function install_board()