mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10586] trying to get tests to work
PHPBB3-10586
This commit is contained in:
parent
7d1e4bca33
commit
76e6195194
2 changed files with 19 additions and 14 deletions
|
@ -12,6 +12,7 @@
|
||||||
*/
|
*/
|
||||||
class phpbb_functional_extension_controller_test extends phpbb_functional_test_case
|
class phpbb_functional_extension_controller_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
|
protected $phpbb_extension_manager;
|
||||||
/**
|
/**
|
||||||
* This should only be called once before the tests are run.
|
* This should only be called once before the tests are run.
|
||||||
* This is used to copy the fixtures to the phpBB install
|
* This is used to copy the fixtures to the phpBB install
|
||||||
|
@ -76,17 +77,23 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
// and port it into here instead of writing it from scratch
|
// and port it into here instead of writing it from scratch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function 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');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check an extension at ./ext/foobar/ which should have the class
|
* Check an extension at ./ext/foobar/ which should have the class
|
||||||
* phpbb_ext_foobar_controller
|
* phpbb_ext_foobar_controller
|
||||||
*/
|
*/
|
||||||
public function test_foobar()
|
public function test_foobar()
|
||||||
{
|
{
|
||||||
$phpbb_extension_manager = $this->get_ext_manager();
|
$this->phpbb_extension_manager->enable('foobar');
|
||||||
$phpbb_extension_manager->enable('foobar');
|
|
||||||
$crawler = $this->request('GET', 'index.php?ext=foobar');
|
$crawler = $this->request('GET', 'index.php?ext=foobar');
|
||||||
$this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text());
|
$this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text());
|
||||||
$phpbb_extension_manager->purge('foobar');
|
$this->phpbb_extension_manager->purge('foobar');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,11 +102,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
*/
|
*/
|
||||||
public function test_foo_bar()
|
public function test_foo_bar()
|
||||||
{
|
{
|
||||||
$phpbb_extension_manager = $this->get_ext_manager();
|
$this->phpbb_extension_manager->enable('foo/bar');
|
||||||
$phpbb_extension_manager->enable('foo/bar');
|
|
||||||
$crawler = $this->request('GET', 'index.php?ext=foo/bar');
|
$crawler = $this->request('GET', 'index.php?ext=foo/bar');
|
||||||
$this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text());
|
$this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text());
|
||||||
$phpbb_extension_manager->purge('foo/bar');
|
$this->phpbb_extension_manager->purge('foo/bar');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,11 +114,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
*/
|
*/
|
||||||
public function test_error_class_name()
|
public function test_error_class_name()
|
||||||
{
|
{
|
||||||
$phpbb_extension_manager = $this->get_ext_manager();
|
$this->phpbb_extension_manager->enable('error/class');
|
||||||
$phpbb_extension_manager->enable('error/class');
|
|
||||||
$crawler = $this->request('GET', 'index.php?ext=error/class');
|
$crawler = $this->request('GET', 'index.php?ext=error/class');
|
||||||
$this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text());
|
$this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text());
|
||||||
$phpbb_extension_manager->purge('error/class');
|
$this->phpbb_extension_manager->purge('error/class');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,11 +126,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
*/
|
*/
|
||||||
public function test_error_class_type()
|
public function test_error_class_type()
|
||||||
{
|
{
|
||||||
$phpbb_extension_manager = $this->get_ext_manager();
|
$this->phpbb_extension_manager->enable('error/classtype');
|
||||||
$phpbb_extension_manager->enable('error/classtype');
|
|
||||||
$crawler = $this->request('GET', 'index.php?ext=error/classtype');
|
$crawler = $this->request('GET', 'index.php?ext=error/classtype');
|
||||||
$this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text());
|
$this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text());
|
||||||
$phpbb_extension_manager->purge('error/classtype');
|
$this->phpbb_extension_manager->purge('error/classtype');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
protected $client;
|
protected $client;
|
||||||
protected $root_url;
|
protected $root_url;
|
||||||
|
|
||||||
|
protected $cache = null;
|
||||||
protected $db = null;
|
protected $db = null;
|
||||||
|
|
||||||
static protected $config = array();
|
static protected $config = array();
|
||||||
|
@ -88,8 +89,8 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
protected function get_ext_manager()
|
protected function get_ext_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", new phpbb_cache_driver_file);
|
return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", $this->cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function install_board()
|
protected function install_board()
|
||||||
|
|
Loading…
Add table
Reference in a new issue