Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ trim_trailing_whitespace = true
trim_trailing_whitespace = false

[*.yml]
indent_size = 4
indent_style = space
33 changes: 17 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
language: php
dist: xenial

matrix:
include:
- php: 5.5
- php: 7.1
env: DB=none;NOTESTS=1
- php: 5.4
env: DB=mysqli #myisam
- php: 5.4
env: DB=mysql
- php: 5.4
- php: 7.1
env: DB=mariadb
- php: 5.4
- php: 7.1
env: DB=postgres
- php: 5.5
env: DB=mysqli
- php: 5.6
env: DB=mysqli
- php: 7.0
env: DB=mysqli
- php: 7.1
env: DB=mysqli
env: DB=mysqli # MyISAM
- php: 7.2
env: DB=mysqli
- php: 7.3
env: DB=mysqli
- php: 7.4snapshot
env: DB=mysqli
- php: nightly
env: DB=mysqli
allow_failures:
Expand All @@ -34,15 +29,21 @@ env:
- SNIFF="1" # Should we run code sniffer on your code?
- IMAGE_ICC="1" # Should we run icc profile sniffer on your images?
- EPV="1" # Should we run EPV (Extension Pre Validator) on your code?
- PHPBB_BRANCH="3.2.x"
- PHPBB_BRANCH="3.3.x"

branches:
only:
- master
- develop
- /^develop-.*$/
- /^\d+(\.\d+)?\.x$/

services:
- postgresql
- mysql

install:
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
- travis/prepare-phpbb.sh $PHPBB_BRANCH
- cd ../../phpBB3
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS
Expand Down
9 changes: 5 additions & 4 deletions acp/ideas_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class ideas_module
public $u_action;

/**
* Main ACP module
*
* @access public
*/
* Main ACP module
*
* @access public
* @throws \Exception
*/
public function main()
{
global $phpbb_container;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"extra": {
"display-name": "phpBB Ideas",
"soft-require": {
"phpbb/phpbb": ">=3.2.0,<3.4"
"phpbb/phpbb": ">=3.2.1,<3.4"
}
}
}
2 changes: 1 addition & 1 deletion controller/idea_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function idea($idea_id)
$mode = $this->request->variable('mode', '');
if (!empty($mode) && $this->request->is_ajax())
{
$result = call_user_func(array($this, $mode));
$result = $this->$mode();

return new \Symfony\Component\HttpFoundation\JsonResponse($result);
}
Expand Down
6 changes: 3 additions & 3 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct(auth $auth, config $config, helper $helper, ideas $i
/**
* @inheritDoc
*/
static public function getSubscribedEvents()
public static function getSubscribedEvents()
{
return array(
'core.viewforum_get_topic_data' => 'ideas_forum_redirect',
Expand Down Expand Up @@ -334,9 +334,9 @@ public function viewonline_ideas($event)
public function edit_idea_title($event)
{
if ($event['mode'] !== 'edit' ||
$event['post_data']['topic_first_post_id'] != $event['post_id'] ||
!$event['update_subject'] ||
!$this->is_ideas_forum($event['forum_id']) ||
$event['post_data']['topic_first_post_id'] != $event['post_id'])
!$this->is_ideas_forum($event['forum_id']))
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class ext extends \phpbb\extension\base
* The current phpBB version should meet or exceed
* the minimum version required by this extension:
*
* Requires phpBB 3.2.0
* Requires phpBB 3.2.1 due to use of $event->update_subarray();
*
* @return bool
* @access public
*/
public function is_enableable()
{
return phpbb_version_compare(PHPBB_VERSION, '3.2.0', '>=');
return phpbb_version_compare(PHPBB_VERSION, '3.2.1', '>=');
}
}
2 changes: 1 addition & 1 deletion factory/ideas.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public function set_title($idea_id, $title)
* @param int $user_id The ID of the user voting.
* @param int $value Up (1) or down (0)?
*
* @return array Array of information.
* @return array|string Array of information or string on error.
*/
public function vote(&$idea, $user_id, $value)
{
Expand Down
8 changes: 2 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
verbose="true"
bootstrap="../../../../tests/bootstrap.php"
>
Expand All @@ -19,17 +18,14 @@
<exclude>./tests/ui</exclude>
</testsuite>
<testsuite name="Extension Functional Tests">
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">./tests/functional/</directory>
<directory suffix="_test.php">./tests/functional/</directory>
</testsuite>
<testsuite name="Extension UI Tests">
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">./tests/ui/</directory>
<directory suffix="_test.php">./tests/ui</directory>
</testsuite>
</testsuites>

<filter>
<blacklist>
<directory>./tests/</directory>
</blacklist>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./</directory>
<exclude>
Expand Down
10 changes: 5 additions & 5 deletions styles/prosilver/template/ideas.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
e.preventDefault();

$obj.rfcEdit.add($obj.rfcLink).hide();
$obj.rfcEditInput.show().focus();
$obj.rfcEditInput.show().trigger('focus');
});

$obj.rfcEditInput.on('keydown', function(e) {
Expand Down Expand Up @@ -190,7 +190,7 @@
e.preventDefault();

$obj.ticketEdit.add($obj.ticketLink).hide();
$obj.ticketEditInput.show().focus();
$obj.ticketEditInput.show().trigger('focus');
});

$obj.ticketEditInput.on('keydown', function(e) {
Expand Down Expand Up @@ -245,7 +245,7 @@
e.preventDefault();

$obj.duplicateEdit.add($obj.duplicateLink).hide();
$obj.duplicateEditInput.show().focus();
$obj.duplicateEditInput.show().trigger('focus');
});

$obj.duplicateEditInput.on('keydown', function(e) {
Expand Down Expand Up @@ -301,7 +301,7 @@
e.preventDefault();

$obj.implementedEdit.add($obj.implementedVersion).hide();
$obj.implementedEditInput.show().focus();
$obj.implementedEditInput.show().trigger('focus');
});

$obj.implementedEditInput.on('keydown', function(e) {
Expand All @@ -310,7 +310,7 @@
e.stopPropagation();

var $this = $(this),
find = /^\d\.\d\.\d+(\-\w+)?$/,
find = /^\d\.\d\.\d+(-\w+)?$/,
url = $obj.implementedEdit.attr('href'),
value = $this.val();

Expand Down
4 changes: 2 additions & 2 deletions styles/prosilver/theme/ideas.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ dd.topics {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
background: url('images/button-sprite.png') no-repeat;
color: #ffffff !important;
background: url("images/button-sprite.png") no-repeat;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 1);
color: #ffffff !important;
display: inline-block;
float: left;
width: 65px;
Expand Down
10 changes: 5 additions & 5 deletions tests/controller/controller_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,25 @@ public function setUp()
$this->controller_helper = $this->getMockBuilder('\phpbb\controller\helper')
->disableOriginalConstructor()
->getMock();
$this->controller_helper->expects($this->any())
$this->controller_helper->expects($this->atMost(1))
->method('render')
->willReturnCallback(function ($template_file, $page_title = '', $status_code = 200, $display_online_list = false) {
return new \Symfony\Component\HttpFoundation\Response($template_file, $status_code);
});
$this->ideas = $this->getMockBuilder('\phpbb\ideas\factory\ideas')
->disableOriginalConstructor()
->getMock();
$this->ideas->expects($this->any())
$this->ideas->expects($this->atMost(3))
->method('get_ideas')
->will($this->returnValue(array(array())));
->willReturn(array(array()));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$this->lang = new \phpbb\language\language($lang_loader);
$this->link_helper = $this->getMockBuilder('\phpbb\ideas\factory\linkhelper')
->disableOriginalConstructor()
->getMock();
$this->link_helper->expects($this->any())
$this->link_helper->expects($this->atMost(3))
->method('get_list_link')
->will($this->returnValue(''));
->willReturn('');
$this->pagination = $this->getMockBuilder('\phpbb\pagination')
->disableOriginalConstructor()
->getMock();
Expand Down
34 changes: 17 additions & 17 deletions tests/controller/idea_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,48 +57,47 @@ public function controller_test_data()
public function test_controller($idea_id, $mode, $callback, $is_ajax, $authorised, $expected, $status_code, $additional_data = [])
{
// mock some basic idea data
$this->ideas->expects($this->any())
$this->ideas->expects($this->once())
->method('get_idea')
->will($this->returnValue(
array_merge(array(
'idea_id' => $idea_id,
'idea_author' => 2,
'idea_status' => \phpbb\ideas\factory\ideas::$statuses['NEW']
), $additional_data))
->willReturn(array_merge(array(
'idea_id' => $idea_id,
'idea_author' => 2,
'idea_status' => \phpbb\ideas\factory\ideas::$statuses['NEW']
), $additional_data)
);

// mock a result from each method called by the idea controller
if ($expected === 'true')
{
$this->ideas->expects($this->once())
->method(($callback))
->will($this->returnValue($authorised));
->willReturn($authorised);
}

// set if using ajax or not
$this->request->expects($this->any())
$this->request->expects($is_ajax ? $this->once() : $this->never())
->method('is_ajax')
->will($this->returnValue($is_ajax));
->willReturn($is_ajax);

// mock some useful variables requested by the idea controller
$this->request->expects($this->any())
$this->request->expects($this->atLeastOnce())
->method('variable')
->with($this->anything())
->will($this->returnValueMap(array(
->willReturnMap(array(
array('mode', '', false, \phpbb\request\request_interface::REQUEST, $mode),
array('hash', '', false, \phpbb\request\request_interface::REQUEST, generate_link_hash("{$mode}_{$idea_id}")),
array('status', 0, false, \phpbb\request\request_interface::REQUEST, 1),
array('v', 1, false, \phpbb\request\request_interface::REQUEST, 1),
)));
));

// mock some user permissions during testing
$this->auth->expects($this->any())
$this->auth
->method('acl_get')
->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap(array(
->willReturnMap(array(
array('m_', 2, $authorised),
array('f_vote', 2, $authorised),
)));
));

// special case, expect trigger_error when a confirm_box return true
if ($expected === 'trigger_error')
Expand All @@ -109,7 +108,8 @@ public function test_controller($idea_id, $mode, $callback, $is_ajax, $authorise

if ($status_code === 403)
{
$this->setExpectedException('\phpbb\exception\http_exception', 'NO_AUTH_OPERATION');
$this->expectException('\phpbb\exception\http_exception');
$this->expectExceptionMessage('NO_AUTH_OPERATION');
}

/** @var \phpbb\ideas\controller\idea_controller $controller */
Expand Down
8 changes: 4 additions & 4 deletions tests/controller/list_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ public function controller_test_data()
*/
public function test_controller($status_code, $page_content, $params, $expected)
{
$this->request->expects($this->any())
$this->request->expects($this->atMost(3))
->method('variable')
->will($this->returnValueMap(array(
->willReturnMap(array(
array('sd', 'd', false, \phpbb\request\request_interface::REQUEST, ''),
array('status', 0, false, \phpbb\request\request_interface::REQUEST, $params['status']),
array('start', 0, false, \phpbb\request\request_interface::REQUEST, 0),
)));
));

$this->ideas->expects($this->any())
$this->ideas->expects($this->once())
->method('get_ideas')
->with('', $expected['sort'], 'ASC', $expected['status'], 0);

Expand Down
Loading