Merge pull request #204 from marc1706/func_test/registered
[func test/registered] Add functional tests for registered users and fix minor issues
This commit is contained in:
@@ -147,7 +147,7 @@ $lang = array_merge($lang, array(
|
||||
'VERSION_CHECK' => 'MOD Version Check',
|
||||
|
||||
// Adding the permissions
|
||||
'acl_a_manage_portal' => array('lang' => 'Kann Portal-Einstellungen ändern', 'cat' => 'misc'),
|
||||
'acl_u_view_portal' => array('lang' => 'Kann das Portal sehen', 'cat' => 'misc'),
|
||||
'ACL_A_MANAGE_PORTAL' => 'Kann Portal-Einstellungen ändern',
|
||||
'ACL_U_VIEW_PORTAL' => 'Kann das Portal sehen',
|
||||
|
||||
));
|
||||
|
||||
@@ -146,6 +146,6 @@ $lang = array_merge($lang, array(
|
||||
'VERSION_CHECK' => 'MOD Version Check',
|
||||
|
||||
// Adding the permissions
|
||||
'acl_a_manage_portal' => array('lang' => 'Can alter Portal settings', 'cat' => 'misc'),
|
||||
'acl_u_view_portal' => array('lang' => 'Can view the Portal', 'cat' => 'misc'),
|
||||
'ACL_A_MANAGE_PORTAL' => 'Can alter Portal settings',
|
||||
'ACL_U_VIEW_PORTAL' => 'Can view the Portal',
|
||||
));
|
||||
|
||||
@@ -109,12 +109,12 @@ class user_menu extends module_base
|
||||
else if ($this->auth->acl_getf_global('m_approve'))
|
||||
{
|
||||
$m_approve_fid_ary = array_diff(array_keys($this->auth->acl_getf('!m_approve', true)), $ex_fid_ary);
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
|
||||
$m_approve_fid_sql = ' AND (p.post_visibility = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_ary = array();
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
$m_approve_fid_sql = ' AND p.post_visibility = 1';
|
||||
}
|
||||
|
||||
$sql = 'SELECT COUNT(distinct t.topic_id) as total
|
||||
|
||||
100
tests/functional/portal_visit_registered_test.php
Normal file
100
tests/functional/portal_visit_registered_test.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 Board3 Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
*/
|
||||
class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests\testframework\functional_test_case
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
$this->enable_board3_portal_ext();
|
||||
}
|
||||
|
||||
public function test_vanilla_board()
|
||||
{
|
||||
$this->logout();
|
||||
$uid = $this->create_user('portal_user');
|
||||
if (!$uid)
|
||||
{
|
||||
$this->markIncomplete('Unable to create portal_user');
|
||||
}
|
||||
$this->login('portal_user');
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
|
||||
public function test_with_announce()
|
||||
{
|
||||
// Create topic as announcement
|
||||
$data = $this->create_topic(2, 'Portal-announce', 'This is an announcement for the portal', array(
|
||||
'topic_type' => POST_ANNOUNCE,
|
||||
));
|
||||
|
||||
if (isset($data))
|
||||
{
|
||||
// no errors should appear on portal
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_with_global()
|
||||
{
|
||||
// Create topic as announcement
|
||||
$data = $this->create_topic(2, 'Portal-announce-global', 'This is a global announcement for the portal', array(
|
||||
'topic_type' => POST_GLOBAL,
|
||||
));
|
||||
|
||||
if (isset($data))
|
||||
{
|
||||
// no errors should appear on portal
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_with_announce
|
||||
*/
|
||||
public function test_after_announce()
|
||||
{
|
||||
$this->logout();
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
|
||||
public function test_with_poll()
|
||||
{
|
||||
// Create topic with poll
|
||||
$data = $this->create_topic(2, 'Portal-poll', 'This is a poll for the portal', array(
|
||||
'poll_title' => 'Is this a poll?',
|
||||
'poll_option_text' => "Yes\nNo\nMaybe",
|
||||
));
|
||||
|
||||
if (isset($data))
|
||||
{
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
$form = $crawler->selectButton('Submit vote')->form();
|
||||
$form->setValues(array('vote_id' => array(1)));
|
||||
$crawler = self::submit($form);
|
||||
|
||||
// no errors should appear on portal
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_with_poll
|
||||
*/
|
||||
public function test_after_poll()
|
||||
{
|
||||
$this->logout();
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user