[ticket/469] Enable portal on all pages in subsilver2 & add tests
B3P-469
This commit is contained in:
@@ -149,7 +149,7 @@ class listener implements EventSubscriberInterface
|
||||
protected function display_portal()
|
||||
{
|
||||
// Check if we should show the portal
|
||||
if (isset($this->config['board3_show_all_pages']))
|
||||
if (isset($this->config['board3_show_all_pages']) && $this->config['board3_show_all_pages'])
|
||||
{
|
||||
$this->board3_controller->handle(array(
|
||||
'left' => $this->config['board3_show_all_side'] == false,
|
||||
|
||||
@@ -182,7 +182,7 @@ class modules_helper
|
||||
public function store_left_right($key)
|
||||
{
|
||||
// Get selected side
|
||||
$value = $this->request->variable($key, false);
|
||||
$value = $this->request->variable($key, 0);
|
||||
|
||||
$this->config->set($key, $value);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ class v210_rc3 extends \phpbb\db\migration\migration
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('board3_portal_version', '2.1.0-rc3')),
|
||||
array('config.add', array('board3_show_all_pages', false)),
|
||||
array('config.add', array('board3_show_all_side', false)),
|
||||
array('config.add', array('board3_show_all_pages', 0)),
|
||||
array('config.add', array('board3_show_all_side', 0)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<!-- IF S_PORTAL_ALL === true -->
|
||||
</td>
|
||||
<!-- [+] right module area -->
|
||||
<!-- IF S_RIGHT_COLUMN -->
|
||||
<td width="{S_PORTAL_RIGHT_COLUMN}px" valign="top" style="padding-<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->right<!-- ELSE -->left<!-- ENDIF -->:{$BLOCK_DISTANCE};">
|
||||
<!-- BEGIN modules_right -->
|
||||
<!-- DEFINE $TEMPLATE_FILE = '{modules_right.TEMPLATE_FILE}' -->
|
||||
<!-- DEFINE $IMAGE_SRC = '{modules_right.IMAGE_SRC}' -->
|
||||
<!-- DEFINE $IMAGE_WIDTH = '{modules_right.IMAGE_WIDTH}' -->
|
||||
<!-- DEFINE $IMAGE_HEIGHT = '{modules_right.IMAGE_HEIGHT}' -->
|
||||
<!-- DEFINE $CUSTOM_CODE = '{modules_right.CODE}' -->
|
||||
<!-- DEFINE $TITLE = '{modules_right.TITLE}' -->
|
||||
<!-- DEFINE $MODULE_ID = '{modules_right.MODULE_ID}' -->
|
||||
<!-- INCLUDE {$TEMPLATE_FILE} -->
|
||||
<!-- END modules_right -->
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
<!-- [-] right module area -->
|
||||
</tr>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- IF S_PORTAL_ALL === true -->
|
||||
<!-- INCLUDE portal/_block_config.html -->
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
|
||||
<tr>
|
||||
<!-- [+] left module area -->
|
||||
<!-- IF S_LEFT_COLUMN -->
|
||||
<td width="{S_PORTAL_LEFT_COLUMN}px" valign="top" style="padding-<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->left<!-- ELSE -->right<!-- ENDIF -->:{$BLOCK_DISTANCE};">
|
||||
<!-- BEGIN modules_left -->
|
||||
<!-- DEFINE $TEMPLATE_FILE = '{modules_left.TEMPLATE_FILE}' -->
|
||||
<!-- DEFINE $IMAGE_SRC = '{modules_left.IMAGE_SRC}' -->
|
||||
<!-- DEFINE $IMAGE_WIDTH = '{modules_left.IMAGE_WIDTH}' -->
|
||||
<!-- DEFINE $IMAGE_HEIGHT = '{modules_left.IMAGE_HEIGHT}' -->
|
||||
<!-- DEFINE $CUSTOM_CODE = '{modules_left.CODE}' -->
|
||||
<!-- DEFINE $TITLE = '{modules_left.TITLE}' -->
|
||||
<!-- DEFINE $MODULE_ID = '{modules_left.MODULE_ID}' -->
|
||||
<!-- INCLUDE {$TEMPLATE_FILE} -->
|
||||
<!-- END modules_left -->
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
<!-- [-] left module area -->
|
||||
<td valign="top">
|
||||
<!-- ENDIF -->
|
||||
@@ -53,4 +53,59 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
|
||||
$this->assertContains('subsilver', $crawler->text());
|
||||
self::request('GET', 'app.php/portal?style=2');
|
||||
}
|
||||
|
||||
public function data_portal_all_pages()
|
||||
{
|
||||
return array(
|
||||
array(1),
|
||||
array(2),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_portal_all_pages
|
||||
* @dependsOn test_enable_subsilver
|
||||
*/
|
||||
public function test_portal_all_pages($style_id)
|
||||
{
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertNotContains('Menu', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
|
||||
|
||||
$form = $crawler->selectButton('submit')->form(array(
|
||||
'config[board3_show_all_pages]' => 1,
|
||||
'board3_show_all_side' => 0,
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertContains('Menu', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
|
||||
|
||||
$form = $crawler->selectButton('submit')->form(array(
|
||||
'config[board3_show_all_pages]' => 1,
|
||||
'board3_show_all_side' => 1,
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertNotContains('Board Style', $crawler->text());
|
||||
$this->assertContains('User menu', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
|
||||
|
||||
$form = $crawler->selectButton('submit')->form(array(
|
||||
'config[board3_show_all_pages]' => 0,
|
||||
'board3_show_all_side' => 0,
|
||||
));
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertNotContains('Menu', $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user