diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-03-28 21:36:07 +0200 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-28 21:36:07 +0200 |
commit | 7258794be31a374c360f916952fefe6d22c80e87 (patch) | |
tree | b37e27990baee3d63364b922a454de09389088a5 /tests/test_framework/phpbb_functional_test_case.php | |
parent | 4239d8aa4e53cda036f67e39d8eb61ccd317a6c9 (diff) | |
parent | 7c3ebcc3ff16950f76f857381222070c36a76fc3 (diff) | |
download | forums-7258794be31a374c360f916952fefe6d22c80e87.tar forums-7258794be31a374c360f916952fefe6d22c80e87.tar.gz forums-7258794be31a374c360f916952fefe6d22c80e87.tar.bz2 forums-7258794be31a374c360f916952fefe6d22c80e87.tar.xz forums-7258794be31a374c360f916952fefe6d22c80e87.zip |
Merge remote-tracking branch 'imkingdavid/ticket/10586' into develop
* imkingdavid/ticket/10586:
[ticket/10586] Added space in if statement
[ticket/10586] Tidy up comments
[ticket/10586] Tests finally work (thanks naderman)
[ticket/10586] Correctly purge board cache and don't rename install directory
[ticket/10586] trying to get tests to work
[ticket/10586] more work on getting tests to pass
[ticket/10586] Tests are coming along, just a little more to go
[ticket/10586] Rename install directory back to install/ after tests
[ticket/10586] browse tests now work, but mine dont. at least we are making progress
[ticket/10586] initial work on copying fixtures. Note that this depends on 10706
[ticket/10586] Adding the extensions used by the tests
[ticket/10586] Now tests run, but fail. But here is what I have.
[ticket/10586] some bootstrap additions and test changes to try and make it work
[ticket/10586] test stuff. does not work yet, still need to put phpBB objects in bootstrap.php
[ticket/10586] Copy/paste fail fixed
[ticket/10586] Sanitize periods from class names, use manager to get path.
[ticket/10586] Removed file_exists() check because class_exists() covers that.
[ticket/10586] Extension front controller
Diffstat (limited to 'tests/test_framework/phpbb_functional_test_case.php')
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b5e6f7e377..69c62af297 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,10 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $cache = null; + protected $db = null; + protected $extension_manager = null; + static protected $config = array(); static protected $already_installed = false; @@ -66,6 +70,60 @@ class phpbb_functional_test_case extends phpbb_test_case } } + protected function get_db() + { + global $phpbb_root_path, $phpEx; + // so we don't reopen an open connection + if (!($this->db instanceof dbal)) + { + 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']); + } + return $this->db; + } + + protected function get_cache_driver() + { + if (!$this->cache) + { + $this->cache = new phpbb_cache_driver_file; + } + + return $this->cache; + } + + protected function purge_cache() + { + $cache = $this->get_cache_driver(); + + $cache->purge(); + $cache->unload(); + $cache->load(); + } + + protected function get_extension_manager() + { + global $phpbb_root_path, $phpEx; + + if (!$this->extension_manager) + { + $this->extension_manager = new phpbb_extension_manager( + $this->get_db(), + self::$config['table_prefix'] . 'ext', + $phpbb_root_path, + ".$phpEx", + $this->get_cache_driver() + ); + } + + return $this->extension_manager; + } + protected function install_board() { global $phpbb_root_path, $phpEx; |