Merge pull request #716 from marc1706/ticket/715
[ticket/715] Resolv build issues with GitHub Actions
This commit is contained in:
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -5,7 +5,7 @@ env:
|
||||
SNIFF: 1 # Run code sniffer on your code? 1 or 0
|
||||
IMAGE_ICC: 0 # Run icc profile sniffer on your images? 1 or 0
|
||||
EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0
|
||||
EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0
|
||||
EXECUTABLE_FILES: 0 # Run check for executable files? 1 or 0
|
||||
PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on
|
||||
|
||||
on:
|
||||
|
||||
80
.travis.yml
80
.travis.yml
@@ -1,80 +0,0 @@
|
||||
language: php
|
||||
sudo: required
|
||||
dist: precise
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.4
|
||||
env: DB=none;NOTESTS=1
|
||||
- php: 5.4
|
||||
env: DB=mysqli # MyISAM
|
||||
- php: 5.4
|
||||
env: DB=mysql
|
||||
- php: 5.4
|
||||
env: DB=mariadb
|
||||
- php: 5.4
|
||||
env: DB=postgres
|
||||
- php: 5.4
|
||||
env: DB=sqlite3
|
||||
- php: 5.4
|
||||
env: DB=mysqli;SLOWTESTS=1
|
||||
- php: 5.5
|
||||
env: DB=mysqli
|
||||
- php: 5.6
|
||||
env: DB=mysqli
|
||||
- php: 7.0
|
||||
env: DB=mysqli
|
||||
- php: 7.1
|
||||
env: DB=mysqli
|
||||
- php: nightly
|
||||
env: DB=mysqli
|
||||
- php: hhvm
|
||||
env: DB=mysqli
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
fast_finish: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- EXTNAME="board3/portal"
|
||||
- SNIFF="1" # Should we run code sniffer on your code?
|
||||
- IMAGE_ICC="0" # Should we run icc profile sniffer on your images?
|
||||
- COVERAGE="1" # Should we send coverage?
|
||||
- EPV="1" # Should we run EPV (Extension Pre Validator) on your code?
|
||||
- SPELLCHECK="1" # Should the php files be checked for obvious spelling errors?
|
||||
- PHPBB_BRANCH="3.2.x"
|
||||
|
||||
branches:
|
||||
except:
|
||||
- 2.0.x
|
||||
- develop-1_0_X
|
||||
|
||||
install:
|
||||
- php composer.phar install --dev --no-interaction --prefer-source
|
||||
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
|
||||
- cd ../../phpBB3
|
||||
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
|
||||
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION
|
||||
- sh -c "if [ '$COVERAGE' != '0' ]; then ../board3/Board3-Portal/travis/prepare-coverage.sh $DB $TRAVIS_PHP_VERSION; fi"
|
||||
|
||||
before_script:
|
||||
- travis/setup-database.sh $DB $TRAVIS_PHP_VERSION
|
||||
- mkdir build/logs
|
||||
- chmod +wx build/logs
|
||||
|
||||
script:
|
||||
- sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME $NOTESTS; fi"
|
||||
- sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS; fi"
|
||||
- sh -c "if [ '$NOTESTS' != '1' ]; then ../board3/Board3-Portal/travis/run-testsuite.sh $DB $TRAVIS_PHP_VERSION; fi"
|
||||
- sh -c "if [ '$EPV' != '0' ]; then ../board3/Board3-Portal/travis/run-epv.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi"
|
||||
|
||||
after_script:
|
||||
- sh -c "if [ '$COVERAGE' != '0' ]; then ../board3/Board3-Portal/travis/send-coverage.sh $DB $TRAVIS_PHP_VERSION; fi"
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- admin@m-a-styles.de
|
||||
on_success: change
|
||||
on_failure: change
|
||||
@@ -12,7 +12,7 @@ namespace board3\portal\acp;
|
||||
class portal_module
|
||||
{
|
||||
public $u_action;
|
||||
public $new_config = array();
|
||||
public $new_config = [];
|
||||
|
||||
/** @var \board3\portal\modules\module_interface */
|
||||
protected $c_class;
|
||||
@@ -148,7 +148,7 @@ class portal_module
|
||||
$groups_ary = explode(',', $module_data['module_group_ids']);
|
||||
|
||||
// get group info from database and assign the block vars
|
||||
$sql = 'SELECT group_id, group_name
|
||||
$sql = 'SELECT group_id, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
ORDER BY group_id ASC';
|
||||
$result = $this->db->sql_query($sql);
|
||||
@@ -318,7 +318,7 @@ class portal_module
|
||||
$this->page_title = $display_vars['title'];
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'L_TITLE' => $this->user->lang[$display_vars['title']],
|
||||
'L_TITLE' => $this->user->lang($display_vars['title']),
|
||||
'L_TITLE_EXPLAIN' => (isset($this->user->lang[$display_vars['title'] . '_EXP'])) ? $this->user->lang[$display_vars['title'] . '_EXP'] : '',
|
||||
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"marc1706/phpbb-text-shortener": "^0.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbb/epv": "dev-master"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "Board3 Portal",
|
||||
|
||||
1729
composer.lock
generated
1729
composer.lock
generated
File diff suppressed because it is too large
Load Diff
BIN
composer.phar
BIN
composer.phar
Binary file not shown.
@@ -266,7 +266,7 @@ class helper
|
||||
$this->check_permission();
|
||||
|
||||
// Load language file
|
||||
$this->user->add_lang_ext('board3/portal', 'portal');
|
||||
$this->language->add_lang('portal', 'board3/portal');
|
||||
|
||||
// Obtain portal config
|
||||
obtain_portal_config();
|
||||
|
||||
@@ -117,8 +117,11 @@ class main
|
||||
$this->includes_path = $phpbb_root_path . 'ext/board3/portal/includes/';
|
||||
$this->root_path = $phpbb_root_path . 'ext/board3/portal/';
|
||||
$portal_root_path = $this->root_path;
|
||||
define('PORTAL_MODULES_TABLE', $modules_table);
|
||||
define('PORTAL_CONFIG_TABLE', $config_table);
|
||||
if (!defined('PORTAL_MODULES_TABLE'))
|
||||
{
|
||||
define('PORTAL_MODULES_TABLE', $modules_table);
|
||||
define('PORTAL_CONFIG_TABLE', $config_table);
|
||||
}
|
||||
|
||||
if (!function_exists('obtain_portal_config'))
|
||||
{
|
||||
|
||||
@@ -93,21 +93,6 @@ function obtain_portal_modules()
|
||||
return $portal_modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch post for news & announce
|
||||
*
|
||||
* @deprecated 2.1.0-b1 (To be removed: 2.2.0)
|
||||
*/
|
||||
function phpbb_fetch_posts($module_id, $forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start = 0, $invert = false)
|
||||
{
|
||||
global $phpbb_container;
|
||||
|
||||
$fetch_posts = $phpbb_container->get('board3.portal.fetch_posts');
|
||||
$fetch_posts->set_module_id($module_id);
|
||||
|
||||
return $fetch_posts->get_posts($forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start, $invert);
|
||||
}
|
||||
|
||||
/**
|
||||
* Censor title, return short title
|
||||
*
|
||||
@@ -390,7 +375,7 @@ function check_file_src($value, $key, $module_id, $force_error = true)
|
||||
// We check if the chosen file is present in the styles/all/ folder
|
||||
if (!file_exists($portal_root_path . 'styles/all/theme/images/portal/' . $value))
|
||||
{
|
||||
$error .= $user->lang['B3P_FILE_NOT_FOUND'] . ': styles/all/theme/images/portal/' . $value . '<br />';
|
||||
$error .= $user->lang('B3P_FILE_NOT_FOUND') . ': styles/all/theme/images/portal/' . $value . '<br />';
|
||||
}
|
||||
|
||||
if (!empty($error))
|
||||
|
||||
@@ -131,7 +131,7 @@ class announcements extends module_base
|
||||
$this->config['board3_announcements_permissions_' . $module_id],
|
||||
$this->config['board3_number_of_announcements_' . $module_id],
|
||||
$portal_announcement_length,
|
||||
$this->config['board3_announcements_day_' . $module_id],
|
||||
(int) $this->config['board3_announcements_day_' . $module_id],
|
||||
'announcements',
|
||||
$start,
|
||||
(bool) $this->config['board3_announcements_forum_exclude_' . $module_id]
|
||||
@@ -174,7 +174,7 @@ class announcements extends module_base
|
||||
$forum_from = $this->config['board3_global_announcements_forum_' . $module_id];
|
||||
$forum_from = (strpos($forum_from, ',') !== false) ? explode(',', $forum_from) : (($forum_from != '') ? array($forum_from) : array());
|
||||
|
||||
$time = ($this->config['board3_announcements_day_' . $module_id] == 0) ? 0 : $this->config['board3_announcements_day_' . $module_id];
|
||||
$time = ($this->config['board3_announcements_day_' . $module_id] == 0) ? 0 : (int) $this->config['board3_announcements_day_' . $module_id];
|
||||
$post_time = ($time == 0) ? '' : 'AND topic_time > ' . (time() - $time * 86400);
|
||||
|
||||
$str_where = '';
|
||||
|
||||
@@ -188,19 +188,19 @@ class calendar extends module_base
|
||||
// output our general calendar bits
|
||||
$down = $this->mini_cal_month - 1;
|
||||
$up = $this->mini_cal_month + 1;
|
||||
$prev_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$down#minical$module_id" . '" rel="nofollow"><i class="fa fa-backward" aria-hidden="true" title="' . $this->user->lang['VIEW_PREVIOUS_MONTH'] . '"></i></a>';
|
||||
$next_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$up#minical$module_id" . '" rel="nofollow"><i class="fa fa-forward" aria-hidden="true" title="' . $this->user->lang['VIEW_NEXT_MONTH'] . '"></i></a>';
|
||||
$prev_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$down#minical$module_id" . '" rel="nofollow"><i class="fa fa-backward" aria-hidden="true" title="' . $this->user->lang('VIEW_PREVIOUS_MONTH') . '"></i></a>';
|
||||
$next_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$up#minical$module_id" . '" rel="nofollow"><i class="fa fa-forward" aria-hidden="true" title="' . $this->user->lang('VIEW_NEXT_MONTH') . '"></i></a>';
|
||||
|
||||
$this->template->assign_block_vars('minical', array(
|
||||
'S_SUNDAY_FIRST' => ($this->config['board3_sunday_first_' . $module_id]) ? true : false,
|
||||
'L_MINI_CAL_MONTH' => (($this->config['board3_long_month_' . $module_id]) ? $this->user->lang['mini_cal']['long_month'][$this->day[0][1]] : $this->user->lang['mini_cal']['month'][$this->day[0][1]]) . " " . $this->day[0][2],
|
||||
'L_MINI_CAL_SUN' => '<span style="color: ' . $this->config['board3_calendar_sunday_color_' . $module_id] . ';">' . $this->user->lang['mini_cal']['day'][1] . '</span>',
|
||||
'L_MINI_CAL_MON' => $this->user->lang['mini_cal']['day'][2],
|
||||
'L_MINI_CAL_TUE' => $this->user->lang['mini_cal']['day'][3],
|
||||
'L_MINI_CAL_WED' => $this->user->lang['mini_cal']['day'][4],
|
||||
'L_MINI_CAL_THU' => $this->user->lang['mini_cal']['day'][5],
|
||||
'L_MINI_CAL_FRI' => $this->user->lang['mini_cal']['day'][6],
|
||||
'L_MINI_CAL_SAT' => $this->user->lang['mini_cal']['day'][7],
|
||||
'L_MINI_CAL_MONTH' => (($this->config['board3_long_month_' . $module_id]) ? $this->user->lang(['mini_cal', 'long_month'], $this->day[0][1]) : $this->user->lang(['mini_cal', 'month'], $this->day[0][1])) . " " . $this->day[0][2],
|
||||
'L_MINI_CAL_SUN' => '<span style="color: ' . $this->config['board3_calendar_sunday_color_' . $module_id] . ';">' . $this->user->lang(['mini_cal', 'day'], 1) . '</span>',
|
||||
'L_MINI_CAL_MON' => $this->user->lang(['mini_cal', 'day'], 2),
|
||||
'L_MINI_CAL_TUE' => $this->user->lang(['mini_cal', 'day'], 3),
|
||||
'L_MINI_CAL_WED' => $this->user->lang(['mini_cal', 'day'], 4),
|
||||
'L_MINI_CAL_THU' => $this->user->lang(['mini_cal', 'day'], 5),
|
||||
'L_MINI_CAL_FRI' => $this->user->lang(['mini_cal', 'day'], 6),
|
||||
'L_MINI_CAL_SAT' => $this->user->lang(['mini_cal', 'day'], 7),
|
||||
'U_PREV_MONTH' => $prev_month,
|
||||
'U_NEXT_MONTH' => $next_month,
|
||||
'S_DISPLAY_EVENTS' => ($this->config['board3_display_events_' . $module_id]) ? true : false,
|
||||
@@ -488,13 +488,13 @@ class calendar extends module_base
|
||||
// Check for errors
|
||||
if (!$event_title)
|
||||
{
|
||||
trigger_error($this->user->lang['NO_EVENT_TITLE'] . adm_back_link($u_action), E_USER_WARNING);
|
||||
trigger_error($this->user->lang('NO_EVENT_TITLE') . adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// overwrite already existing events and make sure we don't try to save an event outside of the normal array size of $events
|
||||
if (isset($link_id) && $link_id < sizeof($events))
|
||||
{
|
||||
$message = $this->user->lang['EVENT_UPDATED'];
|
||||
$message = $this->user->lang('EVENT_UPDATED');
|
||||
|
||||
$events[$link_id] = array(
|
||||
'title' => $event_title,
|
||||
@@ -510,7 +510,7 @@ class calendar extends module_base
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $this->user->lang['EVENT_ADDED'];
|
||||
$message = $this->user->lang('EVENT_ADDED');
|
||||
|
||||
$events[] = array(
|
||||
'title' => $event_title,
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
use board3\portal\portal\columns;
|
||||
use phpbb\user;
|
||||
|
||||
class constraints_handler
|
||||
{
|
||||
/** @var \board3\portal\portal\columns */
|
||||
/** @var columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
/** @var user */
|
||||
protected $user;
|
||||
|
||||
/** @var string Form action (link) */
|
||||
@@ -29,7 +30,7 @@ class constraints_handler
|
||||
* Constructor for constraints handler
|
||||
*
|
||||
* @param columns $portal_columns Portal columns
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param user $user phpBB user object
|
||||
*/
|
||||
public function __construct(columns $portal_columns, $user)
|
||||
{
|
||||
|
||||
@@ -28,13 +28,13 @@ class database_handler
|
||||
/** @var int Board3 module enabled */
|
||||
const B3_MODULE_ENABLED = 1;
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
/** @var driver_interface */
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Constructor for modules manager
|
||||
*
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
* @param driver_interface $db Database driver
|
||||
*/
|
||||
public function __construct(driver_interface $db)
|
||||
{
|
||||
|
||||
@@ -9,42 +9,45 @@
|
||||
|
||||
namespace board3\portal\portal\modules;
|
||||
|
||||
use board3\portal\controller\helper as b3p_controller_helper;
|
||||
use board3\portal\includes\helper;
|
||||
use board3\portal\modules\module_interface;
|
||||
use board3\portal\portal\columns;
|
||||
use phpbb\cache\service;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\request\request_interface;
|
||||
use phpbb\user;
|
||||
|
||||
class manager
|
||||
{
|
||||
/** @var \phpbb\cache\service */
|
||||
/** @var service */
|
||||
protected $cache;
|
||||
|
||||
/** @var \board3\portal\controller\helper */
|
||||
/** @var b3p_controller_helper */
|
||||
protected $controller_helper;
|
||||
|
||||
/** @var \board3\portal\portal\columns */
|
||||
/** @var columns */
|
||||
protected $portal_columns;
|
||||
|
||||
/** @var \board3\portal\includes\helper */
|
||||
/** @var helper */
|
||||
protected $portal_helper;
|
||||
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
/** @var constraints_handler */
|
||||
protected $constraints_handler;
|
||||
|
||||
/** @var \board3\portal\portal\modules\database_handler */
|
||||
/** @var database_handler */
|
||||
protected $database_handler;
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
/** @var driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request_interface */
|
||||
/** @var request_interface */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
/** @var user */
|
||||
protected $user;
|
||||
|
||||
/** @var \board3\portal\modules\module_interface */
|
||||
/** @var module_interface */
|
||||
protected $module;
|
||||
|
||||
/** @var string u_action of acp module */
|
||||
@@ -56,17 +59,26 @@ class manager
|
||||
/**
|
||||
* Constructor for modules manager
|
||||
*
|
||||
* @param \phpbb\cache\service $cache phpBB cache
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
* @param \board3\portal\controller\helper $controller_helper Board3 Portal controller helper
|
||||
* @param \board3\portal\portal\columns $portal_columns Portal columns helper
|
||||
* @param \board3\portal\includes\helper $portal_helper Portal helper
|
||||
* @param \board3\portal\portal\modules\constraints_handler $constraints_handler Modules constraints handler
|
||||
* @param \board3\portal\portal\modules\database_handler $database_handler Modules database handler
|
||||
* @param \phpbb\request\request_interface $request phpBB request
|
||||
* @param \phpbb\user $user phpBB user
|
||||
* @param service $cache phpBB cache
|
||||
* @param driver_interface $db Database driver
|
||||
* @param b3p_controller_helper $controller_helper Board3 Portal controller helper
|
||||
* @param columns $portal_columns Portal columns helper
|
||||
* @param helper $portal_helper Portal helper
|
||||
* @param constraints_handler $constraints_handler Modules constraints handler
|
||||
* @param database_handler $database_handler Modules database handler
|
||||
* @param request_interface $request phpBB request
|
||||
* @param user $user phpBB user
|
||||
*/
|
||||
public function __construct($cache, driver_interface $db, \board3\portal\controller\helper $controller_helper, columns $portal_columns, helper $portal_helper, constraints_handler $constraints_handler, database_handler $database_handler, request_interface $request, $user)
|
||||
public function __construct(
|
||||
service $cache,
|
||||
driver_interface $db,
|
||||
b3p_controller_helper $controller_helper,
|
||||
columns $portal_columns,
|
||||
helper $portal_helper,
|
||||
constraints_handler $constraints_handler,
|
||||
database_handler $database_handler,
|
||||
request_interface $request,
|
||||
user $user)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->db = $db;
|
||||
@@ -84,7 +96,7 @@ class manager
|
||||
*
|
||||
* @param string $u_action u_action for module
|
||||
*
|
||||
* @return \board3\portal\portal\modules\manager This class
|
||||
* @return manager This class
|
||||
*/
|
||||
public function set_u_action($u_action)
|
||||
{
|
||||
@@ -99,7 +111,7 @@ class manager
|
||||
*
|
||||
* @param string $acp_class ACP module class
|
||||
*
|
||||
* @return \board3\portal\portal\modules\manager This class
|
||||
* @return manager This class
|
||||
*/
|
||||
public function set_acp_class($acp_class)
|
||||
{
|
||||
|
||||
@@ -63,10 +63,10 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
||||
$crawler = self::request('GET', $module_link);
|
||||
preg_match('/module_classname=(?:([a-z0-9\\\_]+))/', $module_link, $module_name);
|
||||
$module_name = $module_name[1];
|
||||
$this->assertContains('Are you sure you wish to delete the module', $crawler->text());
|
||||
$this->assertStringContainsString('Are you sure you wish to delete the module', $crawler->text());
|
||||
$form = $crawler->selectButton('confirm')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains('The module was removed successfully.', $crawler->text());
|
||||
$this->assertStringContainsString('The module was removed successfully.', $crawler->text());
|
||||
|
||||
// Add it back
|
||||
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&module_column=2&sid=' . $this->sid);
|
||||
@@ -85,7 +85,7 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
||||
|
||||
// Take a look at the logs
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_logs&mode=admin&sid=' . $this->sid);
|
||||
$this->assertContains(strip_tags(html_entity_decode($this->lang('LOG_PORTAL_CONFIG', $this->lang('ACP_PORTAL_GENERAL_INFO')), ENT_COMPAT, 'UTF-8')), $crawler->text());
|
||||
$this->assertStringContainsString(strip_tags(html_entity_decode($this->lang('LOG_PORTAL_CONFIG', $this->lang('ACP_PORTAL_GENERAL_INFO')), ENT_COMPAT, 'UTF-8')), $crawler->text());
|
||||
}
|
||||
|
||||
public function test_portal_permissions()
|
||||
@@ -105,9 +105,9 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
||||
$form->setValues(array('link_title' => 'foobar'));
|
||||
$crawler = self::submit($form);
|
||||
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=config&module_id=1&sid=' . $this->sid);
|
||||
$this->assertContains('foobar', $crawler->text());
|
||||
$this->assertStringContainsString('foobar', $crawler->text());
|
||||
$crawler = self::request('GET', 'app.php/portal?sid=' . $this->sid);
|
||||
$this->assertContains('foobar', $crawler->text());
|
||||
$this->assertStringContainsString('foobar', $crawler->text());
|
||||
}
|
||||
|
||||
public function data_add_second_module()
|
||||
@@ -131,6 +131,6 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
||||
$form = $crawler->selectButton('submit')->form();
|
||||
$form['module_classname']->disableValidation()->select($module_class);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($expected_message, $crawler->text());
|
||||
$this->assertStringContainsString($expected_message, $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ class phpbb_functional_portal_announcement_test extends \board3\portal\tests\tes
|
||||
|
||||
public function test_shortened_message()
|
||||
{
|
||||
$this->purge_cache();
|
||||
|
||||
// Create topic as announcement
|
||||
$data = $this->create_topic(2, 'Portal-announce-global', str_repeat('This is a global announcement for the portal', 6), array(
|
||||
'topic_type' => POST_GLOBAL,
|
||||
@@ -69,7 +71,7 @@ class phpbb_functional_portal_announcement_test extends \board3\portal\tests\tes
|
||||
{
|
||||
// no errors should appear on portal
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
$this->assertContains('This is a global announc ...', $crawler->text());
|
||||
$this->assertStringContainsString('This is a global announc ...', $crawler->text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,6 @@ class phpbb_functional_portal_birthday_list_test extends \board3\portal\tests\te
|
||||
public function test_after_announce()
|
||||
{
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
$this->assertContains(date('d M', time() + 86400*2), $crawler->html());
|
||||
$this->assertStringContainsString(date('d M', time() + 86400*2), $crawler->html());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class phpbb_functional_portal_link_test extends \board3\portal\tests\testframewo
|
||||
public function test_portal_link()
|
||||
{
|
||||
$crawler = self::request('GET', 'index.php?sid=' . $this->sid);
|
||||
$this->assertContains('Portal', $crawler->text());
|
||||
$this->assertStringContainsString('Portal', $crawler->text());
|
||||
}
|
||||
|
||||
public function test_disabled_portal_link()
|
||||
@@ -46,7 +46,7 @@ class phpbb_functional_portal_link_test extends \board3\portal\tests\testframewo
|
||||
});
|
||||
foreach ($vals as $val)
|
||||
{
|
||||
$this->assertNotContains('Portal', $val);
|
||||
$this->assertStringNotContainsString('Portal', $val);
|
||||
}
|
||||
|
||||
// Try to access portal directly
|
||||
@@ -56,7 +56,7 @@ class phpbb_functional_portal_link_test extends \board3\portal\tests\testframewo
|
||||
});
|
||||
foreach ($vals as $val)
|
||||
{
|
||||
$this->assertNotContains('Portal', $val);
|
||||
$this->assertStringNotContainsString('Portal', $val);
|
||||
}
|
||||
|
||||
// Enable portal again
|
||||
|
||||
@@ -42,7 +42,7 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
|
||||
public function test_portal_all_pages($style_id)
|
||||
{
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertNotContains('Menu', $crawler->text());
|
||||
$this->assertStringNotContainsString('Menu', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
|
||||
|
||||
@@ -54,7 +54,7 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertContains('Menu', $crawler->text());
|
||||
$this->assertStringContainsString('Menu', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
|
||||
|
||||
@@ -66,8 +66,8 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
|
||||
$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());
|
||||
$this->assertStringNotContainsString('Board Style', $crawler->text());
|
||||
$this->assertStringContainsString('User menu', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
|
||||
|
||||
@@ -79,6 +79,6 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', 'index.php?style=' . $style_id);
|
||||
$this->assertNotContains('Menu', $crawler->text());
|
||||
$this->assertStringNotContainsString('Menu', $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra
|
||||
}
|
||||
else
|
||||
{
|
||||
$mod_rewrite = (getenv('HTTP_MOD_REWRITE')=='On') ? true : false;
|
||||
$mod_rewrite = getenv('HTTP_MOD_REWRITE') == 'On';
|
||||
}
|
||||
|
||||
if ($mod_rewrite)
|
||||
{
|
||||
$crawler = self::request('GET', '');
|
||||
$this->assertContains('Board3 Portal', $crawler->text());
|
||||
$this->assertStringContainsString('Board3 Portal', $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra
|
||||
// Make sure we are logged out
|
||||
$this->logout();
|
||||
|
||||
$crawler = self::request('GET', 'app.php/portal?sid=' . $this->sid);
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
$form = $crawler->selectButton('Login')->form();
|
||||
$form->setValues(array(
|
||||
'username' => 'admin',
|
||||
@@ -54,6 +54,6 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra
|
||||
$crawler = self::submit($form);
|
||||
|
||||
// Should be redirected to portal and logged in
|
||||
$this->assertContains('Site Admin', $crawler->text());
|
||||
$this->assertStringContainsString('Site Admin', $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
|
||||
$legend = $crawler->filter('dd.portal-responsive-show p em')->text();
|
||||
$this->assertContains('Administrators', $legend);
|
||||
$this->assertContains('Global moderators', $legend);
|
||||
$this->assertStringContainsString('Administrators', $legend);
|
||||
$this->assertStringContainsString('Global moderators', $legend);
|
||||
}
|
||||
|
||||
public function test_setup_hidden_forum()
|
||||
@@ -121,7 +121,7 @@ class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$form['forum_perm_from']->select(2);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains('Forum created successfully', $crawler->text());
|
||||
$this->assertStringContainsString('Forum created successfully', $crawler->text());
|
||||
|
||||
// Hide forum using permissions from registered users
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_permissions&mode=setting_group_local&sid=' . $this->sid);
|
||||
@@ -180,8 +180,8 @@ class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests
|
||||
$this->logout();
|
||||
$this->login('standard-user');
|
||||
$crawler = self::request('GET', 'index.php');
|
||||
$this->assertNotContains('Hidden forum', $crawler->text());
|
||||
$this->assertStringNotContainsString('Hidden forum', $crawler->text());
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
$this->assertNotContains('Hidden topic', $crawler->text());
|
||||
$this->assertStringNotContainsString('Hidden topic', $crawler->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ class phpbb_functional_portal_vote_poll_test extends \board3\portal\tests\testfr
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
$form = $crawler->selectButton('Submit vote')->form();
|
||||
$form->setValues(array('vote_id' => array(1)));
|
||||
$crawler = self::submit($form);
|
||||
self::submit($form);
|
||||
|
||||
// no errors should appear on portal
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ class phpbb_functional_portal_vote_poll_test extends \board3\portal\tests\testfr
|
||||
public function test_after_poll()
|
||||
{
|
||||
$this->logout();
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
61
tests/mock/language.php
Normal file
61
tests/mock/language.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\tests\mock;
|
||||
|
||||
class language extends \phpbb\language\language
|
||||
{
|
||||
public function set($data)
|
||||
{
|
||||
foreach ($data as $key => $column)
|
||||
{
|
||||
$this->lang[$key] = $column;
|
||||
}
|
||||
}
|
||||
|
||||
public function add_lang($component, $extension_name = null)
|
||||
{
|
||||
if (!$extension_name !== null)
|
||||
{
|
||||
$this->add_lang_ext($extension_name, $component);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent::add_lang($component, $extension_name);
|
||||
}
|
||||
}
|
||||
|
||||
public function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false)
|
||||
{
|
||||
if ($ext_name != 'board3/portal')
|
||||
{
|
||||
return; // can't support other extensions
|
||||
}
|
||||
|
||||
if (is_array($lang_set))
|
||||
{
|
||||
foreach ($lang_set as $cur_file)
|
||||
{
|
||||
$this->add_lang_ext($ext_name, $cur_file);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists(dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php'))
|
||||
{
|
||||
$foo = dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php';
|
||||
include(dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php');
|
||||
|
||||
if (isset($lang))
|
||||
{
|
||||
$this->set($lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,11 @@ class template
|
||||
$this->test_case->assertSame($expected, $this->data[$row]);
|
||||
}
|
||||
|
||||
public function assert_not_exist($row)
|
||||
{
|
||||
$this->test_case->assertArrayNotHasKey($row, $this->data);
|
||||
}
|
||||
|
||||
public function delete_var($key)
|
||||
{
|
||||
unset($this->data[$key]);
|
||||
@@ -71,6 +76,6 @@ class template
|
||||
|
||||
public function get_row($row)
|
||||
{
|
||||
return $this->data[$row];
|
||||
return $this->data[$row] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\tests\mock;
|
||||
|
||||
class user extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public $lang = array();
|
||||
|
||||
public function set($data)
|
||||
{
|
||||
$this->assertTrue(is_array($data));
|
||||
|
||||
foreach ($data as $key => $column)
|
||||
{
|
||||
$this->lang[$key] = $column;
|
||||
}
|
||||
}
|
||||
|
||||
public function add_lang_ext($ext, $file)
|
||||
{
|
||||
if ($ext != 'board3/portal')
|
||||
{
|
||||
return; // can't support other extensions
|
||||
}
|
||||
|
||||
if (is_array($file))
|
||||
{
|
||||
foreach ($file as $cur_file)
|
||||
{
|
||||
$this->add_lang_ext($ext, $cur_file);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists(dirname(__FILE__) . '/../../language/en/' . $file . '.php'))
|
||||
{
|
||||
include_once(dirname(__FILE__) . '/../../language/en/' . $file . '.php');
|
||||
|
||||
if (isset($lang))
|
||||
{
|
||||
$this->set($lang);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->markTestIncomplete('Unable to include language file ' . $file);
|
||||
}
|
||||
}
|
||||
|
||||
public function lang($var)
|
||||
{
|
||||
return $this->lang[$var];
|
||||
}
|
||||
}
|
||||
@@ -40,17 +40,31 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template, $table_prefix;
|
||||
global $config, $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template, $table_prefix;
|
||||
global $phpbb_dispatcher;
|
||||
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$user->data['user_id'] = 2;
|
||||
$user->data['user_form_salt'] = 'foobar';
|
||||
$user->lang['ACP_PORTAL_GENERAL_TITLE'] = 'ACP_PORTAL_GENERAL_TITLE';
|
||||
$user->lang['YES'] = 'YES';
|
||||
$user->lang['NO'] = 'NO';
|
||||
$this->language->add_lang_ext('board3/portal', 'portal_acp');
|
||||
$this->language->set([
|
||||
'ACP_PORTAL_GENERAL_TITLE' => 'ACP_PORTAL_GENERAL_TITLE',
|
||||
'PORTAL_SHOW_ALL_LEFT' => 'PORTAL_SHOW_ALL_LEFT',
|
||||
'PORTAL_SHOW_ALL_RIGHT' => 'PORTAL_SHOW_ALL_RIGHT',
|
||||
]);
|
||||
|
||||
$template = new \board3\portal\tests\mock\template($this);
|
||||
$this->template = $template;
|
||||
$request = new \phpbb_mock_request;
|
||||
$this->request = $request;
|
||||
$phpbb_container = new \phpbb_mock_container_builder();
|
||||
// Mock module service collection
|
||||
$config = new \phpbb\config\config(array());
|
||||
$config = new \phpbb\config\config([]);
|
||||
$auth = $this->getMockBuilder('\phpbb\auth\auth')
|
||||
->setMethods(['acl_get'])
|
||||
->getMock();
|
||||
@@ -75,7 +89,8 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$phpbb_container->setParameter('board3.portal.config.table', $table_prefix . 'portal_config');
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$phpbb_container->set('board3.portal.columns', $this->portal_columns);
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\cache')
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['destroy', 'sql_exists', 'get', 'put', 'sql_load', 'sql_save'])
|
||||
->getMock();
|
||||
$cache->expects($this->any())
|
||||
@@ -100,7 +115,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
->with($this->anything())
|
||||
->will($this->returnArgument(2));
|
||||
$db = $this->db;
|
||||
$user->set(array(
|
||||
$this->language->set(array(
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
));
|
||||
@@ -124,9 +139,6 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$phpEx
|
||||
);
|
||||
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
|
||||
$b3p_controller_helper = new \board3\portal\controller\helper(
|
||||
new \phpbb\auth\auth(),
|
||||
$this->portal_columns,
|
||||
@@ -223,7 +235,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$this->modules_manager->move_module_vertical(2, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_UP);
|
||||
$this->assertTrue(self::$redirected);
|
||||
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE_ROW');
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, $this->language->lang('UNABLE_TO_MOVE_ROW'));
|
||||
self::$redirected = false;
|
||||
$this->modules_manager->move_module_vertical(2, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_UP);
|
||||
$this->assertFalse(self::$redirected);
|
||||
@@ -235,7 +247,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$this->modules_manager->move_module_vertical(3, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_DOWN);
|
||||
$this->assertTrue(self::$redirected);
|
||||
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE_ROW');
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, $this->language->lang('UNABLE_TO_MOVE_ROW'));
|
||||
self::$redirected = false;
|
||||
$this->modules_manager->move_module_vertical(3, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_DOWN);
|
||||
$this->assertFalse(self::$redirected);
|
||||
@@ -257,7 +269,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
{
|
||||
if ($error)
|
||||
{
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, $error);
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, $this->language->lang($error));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -310,7 +322,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$column_start++;
|
||||
$this->update_portal_modules();
|
||||
}
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE');
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, $this->language->lang('UNABLE_TO_MOVE'));
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_RIGHT);
|
||||
}
|
||||
|
||||
@@ -363,7 +375,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$this->update_portal_modules();
|
||||
$column_start--;
|
||||
}
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, 'UNABLE_TO_MOVE');
|
||||
$this->setExpectedTriggerError(E_USER_NOTICE, $this->language->lang('UNABLE_TO_MOVE'));
|
||||
$this->modules_manager->move_module_horizontal($module_id, \board3\portal\portal\modules\database_handler::MOVE_DIRECTION_LEFT);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
));
|
||||
$this->template = new \board3\portal\tests\mock\template($this);
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$this->user->data['group_id'] = 2;
|
||||
$this->phpbb_root_path = dirname(__FILE__) . '/../../../../../../';
|
||||
@@ -48,8 +48,9 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
$this->language_file_loader->set_extension_manager($phpbb_extension_manager);
|
||||
$this->php_ext = 'php';
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$user = $this->user;
|
||||
$this->modules = array(
|
||||
'\board3\portal\modules\link_us' => new \board3\portal\modules\link_us($this->config, new \board3\portal\tests\mock\template($this), new \board3\portal\tests\mock\user),
|
||||
'\board3\portal\modules\link_us' => new \board3\portal\modules\link_us($this->config, new \board3\portal\tests\mock\template($this), $user),
|
||||
);
|
||||
$this->portal_helper = new \board3\portal\includes\helper($this->modules);
|
||||
$this->path_helper = new \phpbb\path_helper(
|
||||
@@ -144,12 +145,14 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
|
||||
public function test_load_module_language()
|
||||
{
|
||||
$this->assertNull($this->controller_helper->load_module_language($this->modules['\board3\portal\modules\link_us']));
|
||||
$this->assertEquals('Link to us', $this->user->lang('LINK_US'));
|
||||
global $phpbb_root_path;
|
||||
|
||||
$this->controller_helper->load_module_language($this->modules['\board3\portal\modules\link_us']);
|
||||
$this->assertFalse(isset($this->user->lang['PORTAL_LEADERS_EXT']));
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$module = $this->getMockBuilder('\board3\portal\modules\link_us')
|
||||
->setMethods(['get_language'])
|
||||
->setConstructorArgs([$this->config, new \board3\portal\tests\mock\template($this), new \board3\portal\tests\mock\user])
|
||||
->setConstructorArgs([$this->config, new \board3\portal\tests\mock\template($this), $user])
|
||||
->getMock();
|
||||
$module->expects($this->any())
|
||||
->method('get_language')
|
||||
@@ -157,8 +160,8 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
'vendor' => 'board3/portal',
|
||||
'file' => 'modules/portal_leaders_module',
|
||||
));
|
||||
$this->assertNull($this->controller_helper->load_module_language($module));
|
||||
$this->assertEquals('Team Settings', $this->user->lang('ACP_PORTAL_LEADERS'));
|
||||
$this->controller_helper->load_module_language($module);
|
||||
$this->assertNotEmpty($this->language->lang('ACP_PORTAL_LEADERS'));
|
||||
}
|
||||
|
||||
public function data_assign_module_vars()
|
||||
@@ -169,16 +172,21 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
'module_id' => 1,
|
||||
'module_image_width' => 16,
|
||||
'module_image_height' => 16,
|
||||
'module_image_src' => '',
|
||||
'module_name' => 'foo',
|
||||
), array(
|
||||
'template' => 'foobar.html',
|
||||
'title' => 'foo',
|
||||
'code' => 'bar',
|
||||
'image_src' => '',
|
||||
)),
|
||||
array(array(
|
||||
'module_column' => 1,
|
||||
'module_id' => 1,
|
||||
'module_image_width' => 16,
|
||||
'module_image_height' => 16,
|
||||
'module_image_src' => '',
|
||||
'module_name' => 'foo',
|
||||
), 'foobar.html'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,13 @@ class main_test extends \board3\portal\tests\testframework\database_test_case
|
||||
|
||||
$cache = new \phpbb\cache\driver\dummy();
|
||||
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->language->set([
|
||||
'S_PORTAL_ALL' => 'S_PORTAL_ALL',
|
||||
]);
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$user->style['style_path'] = 'prosilver';
|
||||
|
||||
$config_table = $table_prefix . 'portal_config';
|
||||
$modules_table = $table_prefix . 'portal_modules';
|
||||
@@ -61,8 +67,6 @@ class main_test extends \board3\portal\tests\testframework\database_test_case
|
||||
->method('acl_get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(true));
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
|
||||
$controller_helper = new \board3\portal\controller\helper(
|
||||
$auth,
|
||||
@@ -103,15 +107,35 @@ class main_test extends \board3\portal\tests\testframework\database_test_case
|
||||
$this->template->assert_same(true, 'S_PORTAL_ALL');
|
||||
$this->template->delete_var('S_PORTAL_ALL');
|
||||
$this->assertNull($this->controller_main->handle(array('left' => 1)));
|
||||
$this->template->assert_same(null, 'S_PORTAL_ALL');
|
||||
$this->template->assert_not_exist('S_PORTAL_ALL');
|
||||
}
|
||||
|
||||
public function test_is_enabled_side_column()
|
||||
{
|
||||
$this->assertFalse($this->controller_main->get_module_template(array(), new \board3\portal\modules\clock($this->config, $this->template)));
|
||||
$this->assertFalse($this->controller_main->get_module_template(
|
||||
[
|
||||
'module_column' => 1,
|
||||
'module_id' => 1,
|
||||
'module_image_width' => 16,
|
||||
'module_image_height' => 16,
|
||||
'module_image_src' => '',
|
||||
'module_name' => 'foo',
|
||||
],
|
||||
new \board3\portal\modules\clock($this->config, $this->template)
|
||||
));
|
||||
$this->assertNull($this->controller_main->handle(array('left' => 1)));
|
||||
$this->template->assert_same(true, 'S_PORTAL_ALL');
|
||||
$this->config['board3_left_column'] = false;
|
||||
$this->assertSame('clock_side.html', $this->controller_main->get_module_template(array('module_column' => 1), new \board3\portal\modules\clock($this->config, $this->template)));
|
||||
$this->assertSame('clock_side.html', $this->controller_main->get_module_template(
|
||||
[
|
||||
'module_column' => 1,
|
||||
'module_id' => 1,
|
||||
'module_image_width' => 16,
|
||||
'module_image_height' => 16,
|
||||
'module_image_src' => '',
|
||||
'module_name' => 'foo',
|
||||
],
|
||||
new \board3\portal\modules\clock($this->config, $this->template)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ class listener_test extends \phpbb_template_template_test_case
|
||||
),
|
||||
new \phpbb\filesystem\filesystem(),
|
||||
new \phpbb_mock_request(),
|
||||
$this->phpbb_root_path,
|
||||
$this->php_ext
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
||||
$this->controller = $this->getMockBuilder('\board3\portal\controller\main')
|
||||
@@ -212,6 +212,7 @@ class listener_test extends \phpbb_template_template_test_case
|
||||
$this->phpbb_dispatcher->addListener('core.page_header', array($this->listener, 'add_portal_link'));
|
||||
|
||||
$this->controller_helper->set_current_url('');
|
||||
$vars = [];
|
||||
$result = $this->phpbb_dispatcher->trigger_event('core.page_header', compact($vars));
|
||||
|
||||
$this->assertEmpty($result);
|
||||
|
||||
@@ -19,7 +19,12 @@ class phpbb_functions_check_file_src_test extends \board3\portal\tests\testframe
|
||||
parent::setUp();
|
||||
|
||||
global $user;
|
||||
$user = new phpbb_mock_user();
|
||||
$language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$language = new \board3\portal\tests\mock\language($language_file_loader);
|
||||
$language->set([
|
||||
'B3P_FILE_NOT_FOUND' => 'B3P_FILE_NOT_FOUND',
|
||||
]);
|
||||
$user = new \phpbb\user($language, '\phpbb\datetime');
|
||||
|
||||
$portal_root_path = $phpbb_root_path . 'ext/board3/portal/';
|
||||
}
|
||||
@@ -32,7 +37,7 @@ class phpbb_functions_check_file_src_test extends \board3\portal\tests\testframe
|
||||
public function test_check_file_src()
|
||||
{
|
||||
$this->assertFalse(check_file_src('portal_attach.png', '', 15, false));
|
||||
$this->assertEquals(': styles/all/theme/images/portal/portal_foobar.png<br />', check_file_src('portal_foobar.png', '', 15, false));
|
||||
$this->assertEquals('B3P_FILE_NOT_FOUND: styles/all/theme/images/portal/portal_foobar.png<br />', check_file_src('portal_foobar.png', '', 15, false));
|
||||
}
|
||||
|
||||
public function test_check_file_src_error()
|
||||
|
||||
@@ -19,8 +19,11 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
global $auth, $cache, $phpbb_container, $phpbb_dispatcher, $template, $user, $phpbb_root_path, $phpEx;
|
||||
global $auth, $cache, $config, $phpbb_container, $phpbb_dispatcher, $template, $user, $phpbb_root_path, $phpEx;
|
||||
|
||||
$config = new \phpbb\config\config([
|
||||
'allow_nocensors' => false,
|
||||
]);
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
@@ -54,7 +57,10 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
$auth = new \phpbb\auth\auth();
|
||||
$userdata = array(
|
||||
'user_id' => 2,
|
||||
'user_permissions' => '',
|
||||
'user_type' => USER_NORMAL,
|
||||
);
|
||||
$user->data['user_options'] = 0;
|
||||
$auth->acl($userdata);
|
||||
// Pretend to allow downloads
|
||||
$auth->acl[0][0] = true;
|
||||
@@ -198,6 +204,8 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
public function test_phpbb_fetch_news($type, $expected_columns, $expected_main_columns = array(), $number_of_posts = 5, $forum_from = '', $empty = false, $permissions = false,
|
||||
$invert = false, $text_length = 150, $expected_exception = false)
|
||||
{
|
||||
global $phpbb_container;
|
||||
|
||||
$module_id = 5;
|
||||
$time = time();
|
||||
$start = 0;
|
||||
@@ -207,7 +215,10 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
$this->expectException($expected_exception);
|
||||
}
|
||||
|
||||
$fetch_posts = phpbb_fetch_posts($module_id, $forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start, $invert);
|
||||
$b3p_fetch_posts = $phpbb_container->get('board3.portal.fetch_posts');
|
||||
$b3p_fetch_posts->set_module_id($module_id);
|
||||
|
||||
$fetch_posts = $b3p_fetch_posts->get_posts($forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start, $invert);
|
||||
|
||||
if (!$empty)
|
||||
{
|
||||
@@ -257,24 +268,31 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$phpbb_container->set('board3.portal.fetch_posts', new \board3\portal\portal\fetch_posts($this->auth, $cache, $this->config, $this->db, $this->modules_helper, $this->user));
|
||||
$fetch_posts = phpbb_fetch_posts(5, '', false, 5, 150, time(), 'announcements');
|
||||
$b3p_fetch_posts = new \board3\portal\portal\fetch_posts($this->auth, $cache, $this->config, $this->db, $this->modules_helper, $this->user);
|
||||
$b3p_fetch_posts->set_module_id(5);
|
||||
$fetch_posts = $b3p_fetch_posts->get_posts('', false, 5, 150, time(), 'announcements');
|
||||
$this->assertEmpty($fetch_posts);
|
||||
}
|
||||
|
||||
public function test_no_allowed_forums()
|
||||
{
|
||||
global $auth;
|
||||
global $auth, $phpbb_container;
|
||||
|
||||
$auth = new \phpbb\auth\auth();
|
||||
|
||||
$fetch_posts = phpbb_fetch_posts(5, '2', true, 5, 150, time(), 'announcements');
|
||||
$b3p_fetch_posts = $phpbb_container->get('board3.portal.fetch_posts');
|
||||
$b3p_fetch_posts->set_module_id(5);
|
||||
$fetch_posts = $b3p_fetch_posts->get_posts('2', true, 5, 150, time(), 'announcements');
|
||||
$this->assertSame(array(), $fetch_posts);
|
||||
}
|
||||
|
||||
public function test_number_replies()
|
||||
{
|
||||
$fetch_posts = phpbb_fetch_posts(5, '', false, 5, 150, time(), 'news');
|
||||
global $phpbb_container;
|
||||
|
||||
$b3p_fetch_posts = $phpbb_container->get('board3.portal.fetch_posts');
|
||||
$b3p_fetch_posts->set_module_id(5);
|
||||
$fetch_posts = $b3p_fetch_posts->get_posts('', false, 5, 150, time(), 'news');
|
||||
// Topic has 2 posts which means there is only one reply
|
||||
$this->assertEquals(1, $fetch_posts[0]['topic_replies']);
|
||||
$this->assertEquals(1, $fetch_posts[0]['topic_replies_real']);
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_styles">
|
||||
<column>style_id</column>
|
||||
<column>style_path</column>
|
||||
<column>style_name</column>
|
||||
<column>style_active</column>
|
||||
<column>style_parent_tree</column>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>subsilver2</value>
|
||||
<value>subsilver2</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>prosilver</value>
|
||||
<value>prosilver</value>
|
||||
<value>1</value>
|
||||
|
||||
@@ -15,9 +15,14 @@ class board3_includes_helper_test extends \board3\portal\tests\testframework\tes
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
|
||||
$config = new \phpbb\config\config(array());
|
||||
$this->modules = array(
|
||||
'\board3\portal\modules\link_us' => new \board3\portal\modules\link_us($config, new \board3\portal\tests\mock\template($this), new \board3\portal\tests\mock\user),
|
||||
'\board3\portal\modules\link_us' => new \board3\portal\modules\link_us($config, new \board3\portal\tests\mock\template($this), $user),
|
||||
);
|
||||
|
||||
$this->portal_helper = $this->get_portal_helper($this->modules);
|
||||
|
||||
@@ -40,7 +40,10 @@ class phpbb_unit_modules_birthday_list_test extends \board3\portal\tests\testfra
|
||||
$this->template = new \board3\portal\tests\mock\template($this);
|
||||
$this->config = new \phpbb\config\config(array());
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->language->set([
|
||||
'BIRTHDAYS_AHEAD' => 'BIRTHDAYS_AHEAD',
|
||||
]);
|
||||
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$this->user->timezone = new \DateTimeZone('UTC');
|
||||
$this->user->add_lang('common');
|
||||
@@ -73,7 +76,6 @@ class phpbb_unit_modules_birthday_list_test extends \board3\portal\tests\testfra
|
||||
'username' => 'foobar',
|
||||
'username_clean' => 'foobar',
|
||||
'user_birthday' => preg_replace('/([0-9]+)-([0-9])-([0-9]+)/', '$1- $2-$3', date('d-n-Y', time())),
|
||||
'user_id' => 2,
|
||||
'user_permissions' => '',
|
||||
'user_sig' => '',
|
||||
'user_type' => USER_NORMAL,
|
||||
@@ -82,7 +84,6 @@ class phpbb_unit_modules_birthday_list_test extends \board3\portal\tests\testfra
|
||||
'username' => 'foobar2',
|
||||
'username_clean' => 'foobar2',
|
||||
'user_birthday' => preg_replace('/([0-9]+)-([0-9])-([0-9]+)/', '$1- $2-$3', date('d-n-Y', time() + 86400 * 3)),
|
||||
'user_id' => 3,
|
||||
'user_permissions' => '',
|
||||
'user_sig' => '',
|
||||
'user_type' => USER_NORMAL,
|
||||
|
||||
@@ -38,7 +38,7 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
global $cache, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $request, $user;
|
||||
global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $request, $user;
|
||||
|
||||
$this->path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
@@ -57,7 +57,10 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
->method('trigger_event')
|
||||
->with($this->anything())
|
||||
->will($this->returnArgument(1));
|
||||
self::$config = new \phpbb\config\config(array());
|
||||
self::$config = new \phpbb\config\config([
|
||||
'force_server_vars' => false,
|
||||
]);
|
||||
$config = self::$config;
|
||||
\set_config('foobar', false, false, self::$config);
|
||||
$this->template = new \board3\portal\tests\mock\template($this);
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
@@ -65,10 +68,16 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
$modules_helper = new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), new \phpbb\config\config(array()), $controller_helper, new \phpbb_mock_request());
|
||||
$request = $this->request = new \phpbb_mock_request();
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->language->add_lang('common');
|
||||
$this->language->add_lang_ext('board3/portal', 'modules/portal_calendar_module');
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$user->data = [
|
||||
'user_id' => 2,
|
||||
'user_ip' => '127.0.0.1',
|
||||
'user_dateformat' => 'dmY',
|
||||
];
|
||||
$user->timezone = new \DateTimeZone('UTC');
|
||||
$user->add_lang('common');
|
||||
$log = $this->getMockBuilder('\phpbb\log')
|
||||
->setMethods(array('add'))
|
||||
->disableOriginalConstructor()
|
||||
@@ -78,8 +87,6 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(true));
|
||||
$this->calendar = new \board3\portal\modules\calendar(self::$config, $modules_helper, $this->template, $db, $this->request, dirname(__FILE__) . '/../../../', 'php', $user, $this->path_helper, $log);
|
||||
define('PORTAL_MODULES_TABLE', 'phpbb_portal_modules');
|
||||
define('PORTAL_CONFIG_TABLE', 'phpbb_portal_config');
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\driver\dummy')
|
||||
->setMethods(['destroy', 'sql_exists', 'get', 'put'])
|
||||
->getMock();
|
||||
@@ -188,6 +195,7 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
|
||||
public function test_update_events_no_error()
|
||||
{
|
||||
set_portal_config('board3_calendar_events_5', '[]');
|
||||
$this->calendar->update_events('foobar', 5);
|
||||
$this->assertNull($this->template->get_row('events'));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class phpbb_unit_modules_clock_test extends \board3\portal\tests\testframework\t
|
||||
public function test_get_template_side()
|
||||
{
|
||||
$this->assertSame('clock_side.html', $this->clock->get_template_side(5));
|
||||
$this->template->assert_same(null, 'B3P_CLOCK_SRC');
|
||||
$this->template->assert_not_exist( 'B3P_CLOCK_SRC');
|
||||
$this->config->set('board3_clock_src_5', 'foobar');
|
||||
$this->assertSame('clock_side.html', $this->clock->get_template_side(5));
|
||||
$this->template->assert_same('foobar', 'B3P_CLOCK_SRC');
|
||||
|
||||
@@ -45,9 +45,10 @@ class phpbb_unit_modules_welcome_test extends \board3\portal\tests\testframework
|
||||
$request = $this->request;
|
||||
$this->template = new \board3\portal\tests\mock\template($this);
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$user = $this->user;
|
||||
$user->data['user_options'] = 0;
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\driver\dummy')
|
||||
->setMethods(['destroy', 'sql_exists', 'get', 'put', 'sql_load'])
|
||||
->getMock();
|
||||
@@ -172,6 +173,7 @@ class phpbb_unit_modules_welcome_test extends \board3\portal\tests\testframework
|
||||
|
||||
public function test_update_welcome()
|
||||
{
|
||||
\set_portal_config('board3_welcome_message_' . 5, 'Welcome to my Community!');
|
||||
$this->welcome->update_welcome('foobar', 5);
|
||||
$this->template->assert_same(true, 'S_EDIT');
|
||||
$this->request->overwrite('preview', true, \phpbb\request\request_interface::POST);
|
||||
@@ -205,7 +207,7 @@ class phpbb_unit_modules_welcome_test extends \board3\portal\tests\testframework
|
||||
$this->welcome = new \board3\portal\modules\welcome($this->config, $this->request, $this->template, $this->user, '', '');
|
||||
$this->request->overwrite('submit', true, \phpbb\request\request_interface::POST);
|
||||
$this->request->overwrite('welcome_message', '');
|
||||
$this->setExpectedTriggerError(E_USER_WARNING);
|
||||
$this->setExpectedTriggerError(version_compare(PHP_VERSION, '8', '>=') ? E_WARNING : E_USER_WARNING);
|
||||
check_form_key::$form_key_valid = true;
|
||||
$this->welcome->update_welcome('foobar', 5);
|
||||
}
|
||||
|
||||
@@ -22,14 +22,17 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $auth, $cache, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $template, $user;
|
||||
global $auth, $cache, $config, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $template, $user;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$user->data['user_id'] = 2;
|
||||
$user->data = [
|
||||
'user_id' => 2,
|
||||
'user_options' => 0,
|
||||
];
|
||||
$user->timezone = new \DateTimeZone('UTC');
|
||||
$user->add_lang('common');
|
||||
$user->add_lang('../../ext/board3/portal/language/en/portal');
|
||||
@@ -54,10 +57,16 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
||||
->with($this->anything())
|
||||
->will($this->returnArgument(2));
|
||||
require_once(dirname(__FILE__) . '/../../../../../../includes/functions_content.php');
|
||||
$this->config = new \phpbb\config\config(array('allow_attachments' => 1));
|
||||
$this->config = new \phpbb\config\config([
|
||||
'allow_attachments' => 1,
|
||||
'allow_smilies' => 1,
|
||||
]);
|
||||
$config = $this->config;
|
||||
$auth = new \phpbb\auth\auth();
|
||||
$userdata = array(
|
||||
'user_id' => 2,
|
||||
'user_permissions' => '',
|
||||
'user_type' => USER_NORMAL,
|
||||
);
|
||||
$auth->acl($userdata);
|
||||
// Pretend to allow downloads
|
||||
|
||||
@@ -43,7 +43,10 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->language->add_lang_ext('board3/portal', 'portal_acp');
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$request =new \phpbb_mock_request();
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
@@ -58,12 +61,13 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
$this->portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
new \board3\portal\modules\birthday_list($config, null, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $this->phpbb_root_path, $this->phpEx),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx),
|
||||
new \board3\portal\modules\donation($config, $this->request, null, $user, $modules_helper),
|
||||
));
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$this->cache = $this->getMockBuilder('\phpbb\cache\driver\dummy')
|
||||
$this->cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['destroy', 'sql_exists', 'get', 'put', 'purge'])
|
||||
->getMock();
|
||||
$this->cache->expects($this->any())
|
||||
@@ -83,11 +87,6 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
->method('purge');
|
||||
$cache = $this->cache;
|
||||
$db = $this->db;
|
||||
$user->set(array(
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
'SUCCESS_DELETE' => 'SUCCESS_DELETE',
|
||||
));
|
||||
|
||||
$this->database_handler = new \board3\portal\portal\modules\database_handler($db);
|
||||
$this->constraints_handler = new \board3\portal\portal\modules\constraints_handler($this->portal_columns, $user);
|
||||
@@ -102,9 +101,6 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
$phpEx
|
||||
);
|
||||
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \phpbb\language\language($this->language_file_loader);
|
||||
|
||||
$this->b3p_controller_helper = new \board3\portal\controller\helper(
|
||||
new \phpbb\auth\auth(),
|
||||
$this->portal_columns,
|
||||
@@ -127,7 +123,15 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
// Build confirm box first
|
||||
$this->modules_manager->set_u_action('adm/index.php?i=15&mode=foobar')->set_acp_class('foo\bar');
|
||||
self::$confirm = false;
|
||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, array()));
|
||||
$module_data = [
|
||||
'module_column' => 1,
|
||||
'module_id' => 6,
|
||||
'module_image_width' => 16,
|
||||
'module_image_height' => 16,
|
||||
'module_image_src' => '',
|
||||
'module_name' => 'foo',
|
||||
];
|
||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, $module_data));
|
||||
$this->assertEquals('<input type="hidden" name="i" value="15" />
|
||||
<input type="hidden" name="mode" value="barfoo" />
|
||||
<input type="hidden" name="module_reset" value="1" />
|
||||
@@ -137,19 +141,20 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
// Actually reset module
|
||||
phpbb_acp_move_module_test::$override_trigger_error = true;
|
||||
self::$confirm = true;
|
||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, array()));
|
||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, $module_data));
|
||||
$this->assertEquals(array(
|
||||
'seconds' => 3,
|
||||
'link' => 'adm/index.php?i=-foo-bar&mode=config&module_id=6',
|
||||
), self::$meta_refresh);
|
||||
$this->assertEquals(phpbb_acp_move_module_test::$error_type, E_USER_NOTICE);
|
||||
$this->assertEquals(phpbb_acp_move_module_test::$error, 'adm/index.php?i=15&mode=foobar&module_id=6');
|
||||
$this->assertEquals(E_USER_NOTICE, phpbb_acp_move_module_test::$error_type);
|
||||
$this->assertEquals($this->language->lang('MODULE_RESET_SUCCESS') . 'adm/index.php?i=15&mode=foobar&module_id=6', phpbb_acp_move_module_test::$error);
|
||||
phpbb_acp_move_module_test::$override_trigger_error = false;
|
||||
}
|
||||
|
||||
public function test_module_delete()
|
||||
{
|
||||
$this->cache = $this->getMockBuilder('\phpbb\cache\driver\dummy')
|
||||
$this->cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['destroy', 'sql_exists', 'get', 'put', 'purge'])
|
||||
->getMock();
|
||||
$this->cache->expects($this->any())
|
||||
@@ -186,7 +191,7 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
modules_manager_confirm_box_test::$confirm = true;
|
||||
$this->assertNull($this->modules_manager->module_delete(6, 'foobar', 'module_delete', 6));
|
||||
$this->assertEquals(E_USER_NOTICE, phpbb_acp_move_module_test::$error_type);
|
||||
$this->assertEquals('SUCCESS_DELETEadm/index.php?i=15&mode=foobar', phpbb_acp_move_module_test::$error);
|
||||
$this->assertEquals($this->language->lang('SUCCESS_DELETE'). 'adm/index.php?i=15&mode=foobar', phpbb_acp_move_module_test::$error);
|
||||
phpbb_acp_move_module_test::$override_trigger_error = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$request =new \phpbb_mock_request();
|
||||
|
||||
$config = new \phpbb\config\config(array());
|
||||
@@ -45,17 +47,18 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $this->request);
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $request);
|
||||
|
||||
$portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
new \board3\portal\modules\birthday_list($config, null, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $this->phpbb_root_path, $this->phpEx),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx),
|
||||
new \board3\portal\modules\donation($config, $request, null, $user, $modules_helper),
|
||||
));
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\driver\dummy')
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['destroy', 'sql_exists', 'get', 'put', 'sql_load', 'sql_save'])
|
||||
->getMock();
|
||||
$cache->expects($this->any())
|
||||
@@ -80,7 +83,7 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
->with($this->anything())
|
||||
->will($this->returnArgument(2));
|
||||
$db = $this->db;
|
||||
$user->set(array(
|
||||
$this->language->set(array(
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
));
|
||||
@@ -108,7 +111,7 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
new \board3\portal\tests\mock\template($this),
|
||||
$user,
|
||||
$this->path_helper,
|
||||
$this->portal_helper,
|
||||
$portal_helper,
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the Board3 Portal package.
|
||||
#
|
||||
# @copyright (c) Board3 Group <http://www.board3.de>
|
||||
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
#
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DB=$1
|
||||
TRAVIS_PHP_VERSION=$2
|
||||
|
||||
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
|
||||
then
|
||||
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/develop\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/vendor\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml &> phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak
|
||||
cp phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml
|
||||
fi
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the phpBB Forum Software package.
|
||||
#
|
||||
# @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
# @license GNU General Public License, version 2 (GPL-2.0)
|
||||
#
|
||||
# For full copyright and license information, please see
|
||||
# the docs/CREDITS.txt file.
|
||||
#
|
||||
set -e
|
||||
set -x
|
||||
|
||||
EXTNAME=$1
|
||||
BRANCH=$2
|
||||
EXTPATH_TEMP=$3
|
||||
|
||||
# Copy extension to a temp folder
|
||||
mkdir ../../tmp
|
||||
cp -R . ../../tmp
|
||||
cd ../../
|
||||
|
||||
# Clone phpBB
|
||||
git clone --depth=1 "git://github.com/phpbb/phpbb.git" "phpBB3" --branch=$BRANCH
|
||||
|
||||
# Clone trimmessage tool
|
||||
git clone --depth=1 "git://github.com/nickvergessen/phpbb-tool-trimmessage.git" "phpBB3/phpBB/ext/nickvergessen/trimmessage"
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the Board3 Portal package.
|
||||
#
|
||||
# @copyright (c) Board3 Group <http://www.board3.de>
|
||||
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
#
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DB=$1
|
||||
TRAVIS_PHP_VERSION=$2
|
||||
EXTNAME=$3
|
||||
|
||||
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
|
||||
then
|
||||
phpBB/ext/$EXTNAME/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME/"
|
||||
fi
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the Board3 Portal package.
|
||||
#
|
||||
# @copyright (c) Board3 Group <http://www.board3.de>
|
||||
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
#
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DB=$1
|
||||
TRAVIS_PHP_VERSION=$2
|
||||
|
||||
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
|
||||
then
|
||||
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
|
||||
else
|
||||
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php
|
||||
fi
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the Board3 Portal package.
|
||||
#
|
||||
# @copyright (c) Board3 Group <http://www.board3.de>
|
||||
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
#
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DB=$1
|
||||
TRAVIS_PHP_VERSION=$2
|
||||
|
||||
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
|
||||
then
|
||||
cd ../board3/Board3-Portal
|
||||
wget https://scrutinizer-ci.com/ocular.phar
|
||||
php ocular.phar code-coverage:upload --access-token="681b2ead2ea75fe4ce287bae485a916f47034c76f39209a9397545058e7c045e" --format=php-clover ../../phpBB3/build/logs/clover.xml
|
||||
fi
|
||||
Reference in New Issue
Block a user