diff --git a/.gitattributes b/.gitattributes index afd8788..0b85410 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/README.md b/README.md index 90a773b..315e46b 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/composer.json b/composer.json index e8b3fff..94fdf8c 100644 --- a/composer.json +++ b/composer.json @@ -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 } } } diff --git a/event/listener.php b/event/listener.php index 6a3bbe3..e8142b2 100644 --- a/event/listener.php +++ b/event/listener.php @@ -23,6 +23,7 @@ class listener implements EventSubscriberInterface protected $auth; /** @var \phpbb\user */ + protected $user; public static function getSubscribedEvents() { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 289449d..0454bd3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" verbose="true" bootstrap="../../../../tests/bootstrap.php" > @@ -18,7 +17,7 @@ ./tests/functional - ./tests/functional/ + ./tests/functional/ diff --git a/tests/compat.php b/tests/compat.php new file mode 100644 index 0000000..671eb68 --- /dev/null +++ b/tests/compat.php @@ -0,0 +1,22 @@ +assertThat($haystack, $this->stringContains($needle), $message); + } +} diff --git a/tests/event/listener_base.php b/tests/event/listener_base.php index 510c469..aa2e30f 100644 --- a/tests/event/listener_base.php +++ b/tests/event/listener_base.php @@ -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() diff --git a/tests/functional/install_test.php b/tests/functional/install_test.php index 9078124..c0b9079 100644 --- a/tests/functional/install_test.php +++ b/tests/functional/install_test.php @@ -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'); @@ -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()); } }