[ticket/10586] Correctly purge board cache and don't rename install directory

PHPBB3-10586
This commit is contained in:
Nils Adermann 2012-03-18 22:57:37 +01:00 committed by David King
parent 76e6195194
commit 1bbb32a5cf
4 changed files with 40 additions and 20 deletions

View file

@ -12,17 +12,6 @@
*/ */
class phpbb_functional_browse_test extends phpbb_functional_test_case class phpbb_functional_browse_test extends phpbb_functional_test_case
{ {
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$f_path = self::$config['phpbb_functional_path'];
// we cannot run these tests correctly if the install directory is present
if (is_dir($f_path . 'install/'))
{
rename($f_path . 'install/', $f_path . 'install_/');
}
// NOTE: this will need to be renamed back again later if you wish to test again
}
public function test_index() public function test_index()
{ {
$crawler = $this->request('GET', 'index.php'); $crawler = $this->request('GET', 'index.php');

View file

@ -69,8 +69,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
$f_path = self::$config['phpbb_functional_path']; $f_path = self::$config['phpbb_functional_path'];
// first we rename the install_ directory back to install
rename($f_path . 'install_/', $f_path . 'install/');
// @todo delete the fixtures from the $f_path board // @todo delete the fixtures from the $f_path board
// Note that it might be best to find a public domain function // Note that it might be best to find a public domain function
@ -80,8 +78,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->phpbb_extension_manager = !($this->phpbb_extension_manager instanceof phpbb_extension_manager) ? $this->get_ext_manager() : $this->phpbb_extension_manager;
$this->cache->purge('_ext'); $this->phpbb_extension_manager = $this->get_extension_manager();
$this->purge_cache();
} }
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
class phpbb_ext_fooar_ext extends phpbb_extension_base class phpbb_ext_foobar_ext extends phpbb_extension_base
{ {
} }

View file

@ -16,6 +16,7 @@ class phpbb_functional_test_case extends phpbb_test_case
protected $cache = null; protected $cache = null;
protected $db = null; protected $db = null;
protected $extension_manager = null;
static protected $config = array(); static protected $config = array();
static protected $already_installed = false; static protected $already_installed = false;
@ -86,11 +87,41 @@ class phpbb_functional_test_case extends phpbb_test_case
return $this->db; return $this->db;
} }
protected function get_ext_manager() 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; global $phpbb_root_path, $phpEx;
$this->cache = ($this->cache instanceof phpbb_cache_driver_null) ? $this->cache : new phpbb_cache_driver_null;
return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", $this->cache); 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() protected function install_board()