Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

tests/ export-ignore
travis/ export-ignore
.github/ export-ignore
.gitattributes export-ignore
.travis.yml export-ignore
build.xml export-ignore
composer.phar export-ignore
phpunit.xml.dist export-ignore
composer.phar binary
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# phpBB 3.1 or later Extension - gn36 - Customize first post edit permissions
# phpBB 3.1, 3.2 and 3.3 Extension - gn36 - Customize first post edit permissions

This Extension allows differenciating editing permissions for the first post. It also allows bypassing the max edit time setting for the first or all posts on a per-forum basis. If you use other extensions that change users edit permissions, please check thoroughly whether they still work correctly in combination with this extension.

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
"phpbb/phpbb" : ">=3.1.3-RC1"
},
"version-check" : {
"host" : "phpbb.gn36.de",
"directory" : "/extensions/vinfo",
"filename" : "phpbb-ext-hookup.json"
"host" : "www.phpbb.com",
"directory" : "/customise/db/extension/gn36_firstpostedit",
"filename" : "version_check",
"ssl" : true
}
}
}
1 change: 1 addition & 0 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class listener implements EventSubscriberInterface
protected $auth;

/** @var \phpbb\user */
protected $user;

public static function getSubscribedEvents()
{
Expand Down
3 changes: 1 addition & 2 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 @@ -18,7 +17,7 @@
<exclude>./tests/functional</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>
</testsuites>

Expand Down
22 changes: 22 additions & 0 deletions tests/compat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
*
* @package firstpostedit
* @copyright (c) 2015 gn#36
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace gn36\firstpostedit\tests;

/**
* Assertions that behave the same on all PHPUnit versions used by phpBB 3.1/3.2 (4.x/5.x) and 3.3 (9.x).
* PHPUnit 9 no longer accepts strings for assertContains(), while assertStringContainsString() does not exist in PHPUnit 4.
*/
trait compat
{
public function assertTextContains($needle, $haystack, $message = '')
{
$this->assertThat($haystack, $this->stringContains($needle), $message);
}
}
8 changes: 6 additions & 2 deletions tests/event/listener_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ class listener_base extends \phpbb_test_case

/**
* Set up test environment
*
* Uses @before instead of overriding setUp(), as setUp(): void is required
* by PHPUnit 8+ (phpBB 3.3) but a return type is a syntax error on PHP < 7.1 (phpBB 3.1/3.2).
*
* @before
*/
public function setUp()
public function set_up_mocks()
{
parent::setUp();
$this->auth = $this->getMockBuilder('\phpbb\auth\auth')->getMock();
$this->user = $this->getMockBuilder('\phpbb\user')
->disableOriginalConstructor()
Expand Down
6 changes: 4 additions & 2 deletions tests/functional/install_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
class install_test extends \phpbb_functional_test_case
{
use \gn36\firstpostedit\tests\compat;

static protected function setup_extensions()
{
return array('gn36/firstpostedit');
Expand All @@ -24,13 +26,13 @@ public function test_validate_posting()
{
// Check whether we can still call posting.php in edit mode (even though login prevents any useful use)
$crawler = self::request('GET', 'posting.php?mode=edit&f=2&p=1');
$this->assertContains('Username', $crawler->filter('dt')->text());
$this->assertTextContains('Username', $crawler->filter('dt')->text());
}

public function test_validate_viewtopic()
{
// Check whether we can still call viewtopic.php without errors
$crawler = self::request('GET', 'viewtopic.php?f=2&p=1');
$this->assertContains('Welcome', $crawler->filter('h2')->text());
$this->assertTextContains('Welcome', $crawler->filter('h2')->text());
}
}
Loading