Skip to content

Commit de94714

Browse files
authored
Merge pull request #64 from iMattPro/update-to-4
Update master for phpbb4
2 parents dee419a + 68f5aea commit de94714

File tree

5 files changed

+88
-88
lines changed

5 files changed

+88
-88
lines changed

.github/workflows/tests.yml

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ env:
44
EXTNAME: phpbb/teamsecurity # Your extension vendor/package name
55
SNIFF: 1 # Run code sniffer on your code? 1 or 0
66
IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0
7-
EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0
7+
EPV: 0 # Run EPV (Extension Pre Validator) on your code? 1 or 0
88
EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0
9-
PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on
9+
PHPBB_BRANCH: master # The phpBB branch to run tests on
1010

1111
on:
1212
push:
@@ -21,12 +21,12 @@ on:
2121
jobs:
2222
# START Basic Checks Job (EPV, code sniffer, images check, etc.)
2323
basic-checks:
24-
runs-on: ubuntu-22.04
24+
runs-on: ubuntu-latest
2525
strategy:
2626
matrix:
2727
include:
28-
- php: '7.2'
29-
db: "none"
28+
- db: 'none'
29+
php: '8.1'
3030
NOTESTS: 1
3131

3232
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
@@ -48,7 +48,7 @@ jobs:
4848
uses: shivammathur/setup-php@v2
4949
with:
5050
php-version: ${{ matrix.php }}
51-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
51+
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv
5252
coverage: none
5353

5454
- name: Setup environment for phpBB
@@ -89,44 +89,42 @@ jobs:
8989

9090
# START MySQL and MariaDB Job
9191
mysql-tests:
92-
runs-on: ubuntu-22.04
92+
runs-on: ubuntu-latest
9393
strategy:
9494
matrix:
9595
include:
96-
- php: '7.2'
97-
db: "mariadb:10.1"
98-
- php: '7.2'
96+
- php: '8.1'
9997
db: "mariadb:10.2"
100-
- php: '7.2'
98+
- php: '8.1'
10199
db: "mariadb:10.3"
102-
- php: '7.2'
100+
- php: '8.1'
103101
db: "mariadb:10.4"
104-
- php: '7.2'
105-
db: "mariadb:10.5"
106-
- php: '7.2'
107-
db: "mysql:5.6"
102+
- php: '8.1'
103+
db: "mariadb:10.6"
104+
- php: '8.1'
105+
db: "mariadb:10.9"
106+
- php: '8.1'
107+
db: "mariadb:10.10"
108+
- php: '8.1'
109+
db: "mariadb:10.11"
110+
- php: '8.1'
111+
db: "mysql:5.7"
108112
db_alias: "MyISAM Tests"
109113
MYISAM: 1
110-
- php: '7.2'
111-
db: "mysql:5.6"
112-
- php: '7.2'
113-
db: "mysql:5.7"
114-
- php: '7.3'
115-
db: "mysql:5.7"
116-
- php: '7.4'
117-
db: "mysql:5.7"
118-
- php: '7.4'
119-
db: "mysql:8.0"
120-
- php: '8.0'
121-
db: "mysql:5.7"
122114
- php: '8.1'
123-
db: "mysql:5.7"
115+
db: "mysql:8.1"
124116
- php: '8.2'
125-
db: "mysql:5.7"
117+
db: "mysql:8.0"
118+
- php: '8.2'
119+
db: "mariadb:10.2"
126120
- php: '8.3'
127121
db: "mysql:5.7"
122+
- php: '8.3'
123+
db: "mariadb:10.2"
128124
- php: '8.4'
129-
db: "mysql:5.7"
125+
db: "mysql:8.0"
126+
- php: '8.4'
127+
db: "mariadb:10.3"
130128

131129
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
132130

@@ -209,38 +207,32 @@ jobs:
209207

210208
# START PostgreSQL Job
211209
postgres-tests:
212-
runs-on: ubuntu-22.04
210+
runs-on: ubuntu-latest
213211
strategy:
214212
matrix:
215213
include:
216-
- php: '7.2'
214+
- php: '8.1'
217215
db: "postgres:9.5"
218-
- php: '7.2'
216+
- php: '8.1'
219217
db: "postgres:9.6"
220-
- php: '7.2'
218+
- php: '8.1'
221219
db: "postgres:10"
222-
- php: '7.2'
220+
- php: '8.1'
223221
db: "postgres:11"
224-
- php: '7.2'
225-
db: "postgres:12"
226-
- php: '7.2'
227-
db: "postgres:13"
228-
- php: '7.3'
229-
db: "postgres:13"
230-
- php: '7.4'
231-
db: "postgres:13"
232-
- php: '8.0'
222+
- php: '8.1'
233223
db: "postgres:12"
234-
- php: '8.0'
224+
- php: '8.1'
235225
db: "postgres:13"
236226
- php: '8.1'
237227
db: "postgres:14"
228+
- php: '8.1'
229+
db: "postgres:15"
238230
- php: '8.2'
239-
db: "postgres:14"
231+
db: "postgres:9.5"
240232
- php: '8.3'
241-
db: "postgres:14"
233+
db: "postgres:9.5"
242234
- php: '8.4'
243-
db: "postgres:14"
235+
db: "postgres:9.5"
244236

245237
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
246238

@@ -294,7 +286,7 @@ jobs:
294286
uses: shivammathur/setup-php@v2
295287
with:
296288
php-version: ${{ matrix.php }}
297-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
289+
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv, pgsql, pdo, pdo_pgsql
298290
coverage: none
299291

300292
- name: Setup environment for phpBB
@@ -325,24 +317,27 @@ jobs:
325317

326318
# START Other Tests Job (SQLite 3 and mssql)
327319
other-tests:
328-
runs-on: ubuntu-22.04
320+
runs-on: ubuntu-20.04
329321
strategy:
330322
matrix:
331323
include:
332-
- php: '7.2'
324+
- php: '8.1'
333325
db: "sqlite3"
334-
- php: '7.2'
326+
- php: '8.1'
335327
db: "mcr.microsoft.com/mssql/server:2017-latest"
336328
db_alias: 'MSSQL 2017'
337-
- php: '7.2'
338-
db: "mcr.microsoft.com/mssql/server:2019-latest"
329+
- php: '8.1'
330+
db: "mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04"
339331
db_alias: 'MSSQL 2019'
332+
- php: '8.1'
333+
db: "mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04"
334+
db_alias: 'MSSQL 2022'
340335

341336
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
342337

343338
services:
344339
mssql:
345-
image: ${{ matrix.db != 'mcr.microsoft.com/mssql/server:2017-latest' && matrix.db != 'mcr.microsoft.com/mssql/server:2019-latest' && 'mcr.microsoft.com/mssql/server:2017-latest' || matrix.db }}
340+
image: ${{ matrix.db != 'mcr.microsoft.com/mssql/server:2017-latest' && matrix.db != 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' && matrix.db != 'mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04' && 'mcr.microsoft.com/mssql/server:2017-latest' || matrix.db }}
346341
env:
347342
SA_PASSWORD: "Pssw0rd_12"
348343
ACCEPT_EULA: "y"
@@ -382,7 +377,7 @@ jobs:
382377
env:
383378
MATRIX_DB: ${{ matrix.db }}
384379
run: |
385-
if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2017-latest' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-latest' ]
380+
if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2017-latest' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04' ]
386381
then
387382
db='mssql'
388383
else
@@ -394,7 +389,7 @@ jobs:
394389
uses: shivammathur/setup-php@v2
395390
with:
396391
php-version: ${{ matrix.php }}
397-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
392+
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd, exif, iconv, sqlsrv, pdo, pdo_sqlsrv
398393
coverage: none
399394

400395
- name: Setup environment for phpBB

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is the repository for the development of the Team Security extension for phpBB.
44

5-
[![Build Status](https://github.com/phpbb-extensions/teamsecurity/workflows/Tests/badge.svg)](https://github.com/phpbb-extensions/teamsecurity/actions)
5+
[![Build Status](https://github.com/phpbb-extensions/teamsecurity/actions/workflows/tests.yml/badge.svg)](https://github.com/phpbb-extensions/teamsecurity/actions)
66

77
This extension adds passive security features to phpBB that allow the board's founder to watch for potential attacks against members of privileged groups, such as Administrators and Moderators.
88

phpunit.xml.dist

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit backupGlobals="true"
4-
backupStaticAttributes="true"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
verbose="true"
12-
bootstrap="../../../../tests/bootstrap.php"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
backupGlobals="true"
5+
backupStaticAttributes="false"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false"
12+
cacheResult="false"
13+
bootstrap="../../../../tests/bootstrap.php"
1314
>
15+
<coverage>
16+
<include>
17+
<directory suffix=".php">./</directory>
18+
</include>
19+
<exclude>
20+
<directory suffix=".php">./language/</directory>
21+
<directory suffix=".php">./migrations/</directory>
22+
<directory suffix=".php">./tests/</directory>
23+
</exclude>
24+
</coverage>
1425
<testsuites>
1526
<testsuite name="Extension Test Suite">
1627
<directory suffix="_test.php">./tests</directory>
@@ -20,15 +31,4 @@
2031
<directory suffix="_test.php">./tests/functional/</directory>
2132
</testsuite>
2233
</testsuites>
23-
24-
<filter>
25-
<whitelist processUncoveredFilesFromWhitelist="true">
26-
<directory suffix=".php">./</directory>
27-
<exclude>
28-
<directory suffix=".php">./language/</directory>
29-
<directory suffix=".php">./migrations/</directory>
30-
<directory suffix=".php">./tests/</directory>
31-
</exclude>
32-
</whitelist>
33-
</filter>
3434
</phpunit>

tests/event/listener_base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function setUp(): void
6464
protected function set_listener()
6565
{
6666
$this->listener = $this->getMockBuilder('\phpbb\teamsecurity\event\listener')
67-
->setMethods(array(
67+
->onlyMethods(array(
6868
'in_watch_group',
6969
'send_message'
7070
))

tests/ext_test.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010

1111
namespace phpbb\teamsecurity\tests;
1212

13+
require_once __DIR__ . '/../ext.php';
14+
1315
class ext_test extends \phpbb_database_test_case
1416
{
1517
protected const TEAM_SECURITY = 'phpbb/teamsecurity';
1618
protected $extension_manager;
19+
protected $class_loader;
1720

1821
public function getDataSet()
1922
{
@@ -24,7 +27,6 @@ protected function setUp(): void
2427
{
2528
parent::setUp();
2629

27-
$this->db = null;
2830
$this->extension_manager = $this->create_extension_manager();
2931
}
3032

@@ -53,16 +55,20 @@ public function test_disable()
5355

5456
protected function create_extension_manager()
5557
{
56-
global $phpbb_root_path, $php_ext;
58+
$phpbb_root_path = __DIR__ . './../../../../';
59+
$php_ext = 'php';
5760

5861
$config = new \phpbb\config\config(['version' => PHPBB_VERSION]);
5962
$db = $this->new_dbal();
63+
$db_doctrine = $this->new_doctrine_dbal();
6064
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
6165
$factory = new \phpbb\db\tools\factory();
62-
$db_tools = $factory->get($db);
66+
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $php_ext);
67+
$db_tools = $factory->get($db_doctrine);
6368
$table_prefix = 'phpbb_';
6469

6570
$container = new \phpbb_mock_container_builder();
71+
$container->set('event_dispatcher', $phpbb_dispatcher);
6672

6773
$migrator = new \phpbb\db\migrator(
6874
$container,
@@ -73,20 +79,19 @@ protected function create_extension_manager()
7379
$phpbb_root_path,
7480
$php_ext,
7581
$table_prefix,
82+
self::get_core_tables(),
7683
[],
7784
new \phpbb\db\migration\helper()
7885
);
7986
$container->set('migrator', $migrator);
80-
$container->set('dispatcher', $phpbb_dispatcher);
8187

8288
return new \phpbb\extension\manager(
8389
$container,
8490
$db,
8591
$config,
86-
new \phpbb\filesystem\filesystem(),
92+
$finder_factory,
8793
'phpbb_ext',
8894
$phpbb_root_path,
89-
$php_ext,
9095
null
9196
);
9297
}

0 commit comments

Comments
 (0)