mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/12026] Add functional test for ucp extension module
PHPBB3-12026
This commit is contained in:
parent
a5f1dc67b9
commit
9fbeae3e0c
4 changed files with 91 additions and 5 deletions
|
@ -80,18 +80,53 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
|
|||
);
|
||||
$modules->update_module_data($module_data, true);
|
||||
|
||||
$parent_data = array(
|
||||
'module_basename' => '',
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => 0,
|
||||
'module_class' => 'ucp',
|
||||
'module_langname' => 'UCP_FOOBAR_TITLE',
|
||||
'module_mode' => '',
|
||||
'module_auth' => '',
|
||||
);
|
||||
$modules->update_module_data($parent_data, true);
|
||||
|
||||
$module_data = array(
|
||||
'module_basename' => 'foo\\bar\\ucp\\main_module',
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => $parent_data['module_id'],
|
||||
'module_class' => 'ucp',
|
||||
'module_langname' => 'UCP_FOOBAR_TITLE',
|
||||
'module_mode' => 'mode',
|
||||
'module_auth' => '',
|
||||
);
|
||||
$modules->update_module_data($module_data, true);
|
||||
|
||||
$this->purge_cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a controller for extension foo/bar.
|
||||
*/
|
||||
public function test_foo_bar()
|
||||
public function test_acp()
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=foo%5cbar%5cacp%5cmain_module&mode=mode&sid=' . $this->sid);
|
||||
$this->assertContains("Bertie rulez!", $crawler->filter('#main')->text());
|
||||
$this->assertContains('Bertie rulez!', $crawler->filter('#main')->text());
|
||||
}
|
||||
|
||||
public function test_ucp()
|
||||
{
|
||||
$this->login();
|
||||
|
||||
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid);
|
||||
$this->assertContains('UCP_FOOBAR_TITLE', $crawler->filter('#tabs')->text());
|
||||
|
||||
$link = $crawler->selectLink('UCP_FOOBAR_TITLE')->link()->getUri();
|
||||
$crawler = self::request('GET', substr($link, strpos($link, 'ucp.')));
|
||||
$this->assertContains('UCP Extension Template Test Passed!', $crawler->filter('#content')->text());
|
||||
|
||||
$this->phpbb_extension_manager->purge('foo/bar');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<!-- INCLUDE overall_header.html -->
|
||||
<div id="content">UCP Extension Template Test Passed!</div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
26
tests/functional/fixtures/ext/foo/bar/ucp/main_info.php
Normal file
26
tests/functional/fixtures/ext/foo/bar/ucp/main_info.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace foo\bar\ucp;
|
||||
|
||||
class main_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\foo\bar\ucp\main_module',
|
||||
'title' => 'ACP_FOOBAR_TITLE',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'mode' => array('title' => 'ACP_FOOBAR_MODE', 'auth' => '', 'cat' => array('ACP_FOOBAR_TITLE')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
22
tests/functional/fixtures/ext/foo/bar/ucp/main_module.php
Normal file
22
tests/functional/fixtures/ext/foo/bar/ucp/main_module.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace foo\bar\ucp;
|
||||
|
||||
class main_module
|
||||
{
|
||||
var $u_action;
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
$this->tpl_name = 'foobar';
|
||||
$this->page_title = 'Bertie';
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue