Skip to content

Commit f568903

Browse files
authored
Merge branch 'master' into fix/symfony_mailer
2 parents 311be38 + de94714 commit f568903

5 files changed

Lines changed: 108 additions & 103 deletions

File tree

.github/workflows/tests.yml

Lines changed: 74 additions & 74 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: master # The phpBB branch to run tests on
9+
PHPBB_BRANCH: master # The phpBB branch to run tests on
1010

1111
on:
1212
push:
@@ -25,8 +25,8 @@ jobs:
2525
strategy:
2626
matrix:
2727
include:
28-
- php: '8.1'
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
@@ -93,38 +93,38 @@ jobs:
9393
strategy:
9494
matrix:
9595
include:
96-
- php: '8.1'
97-
db: "mariadb:10.2"
98-
- php: '8.1'
99-
db: "mariadb:10.3"
100-
- php: '8.1'
101-
db: "mariadb:10.4"
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"
112-
db_alias: "MyISAM Tests"
113-
MYISAM: 1
114-
- php: '8.1'
115-
db: "mysql:8.1"
116-
- php: '8.2'
117-
db: "mysql:8.0"
118-
- php: '8.2'
119-
db: "mariadb:10.2"
120-
- php: '8.3'
121-
db: "mysql:5.7"
122-
- php: '8.3'
123-
db: "mariadb:10.2"
124-
- php: '8.4'
125-
db: "mysql:8.0"
126-
- php: '8.4'
127-
db: "mariadb:10.3"
96+
- php: '8.1'
97+
db: "mariadb:10.2"
98+
- php: '8.1'
99+
db: "mariadb:10.3"
100+
- php: '8.1'
101+
db: "mariadb:10.4"
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"
112+
db_alias: "MyISAM Tests"
113+
MYISAM: 1
114+
- php: '8.1'
115+
db: "mysql:8.1"
116+
- php: '8.2'
117+
db: "mysql:8.0"
118+
- php: '8.2'
119+
db: "mariadb:10.2"
120+
- php: '8.3'
121+
db: "mysql:5.7"
122+
- php: '8.3'
123+
db: "mariadb:10.2"
124+
- php: '8.4'
125+
db: "mysql:8.0"
126+
- php: '8.4'
127+
db: "mariadb:10.3"
128128

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

@@ -211,28 +211,28 @@ jobs:
211211
strategy:
212212
matrix:
213213
include:
214-
- php: '8.1'
215-
db: "postgres:9.5"
216-
- php: '8.1'
217-
db: "postgres:9.6"
218-
- php: '8.1'
219-
db: "postgres:10"
220-
- php: '8.1'
221-
db: "postgres:11"
222-
- php: '8.1'
223-
db: "postgres:12"
224-
- php: '8.1'
225-
db: "postgres:13"
226-
- php: '8.1'
227-
db: "postgres:14"
228-
- php: '8.1'
229-
db: "postgres:15"
230-
- php: '8.2'
231-
db: "postgres:9.5"
232-
- php: '8.3'
233-
db: "postgres:9.5"
234-
- php: '8.4'
235-
db: "postgres:9.5"
214+
- php: '8.1'
215+
db: "postgres:9.5"
216+
- php: '8.1'
217+
db: "postgres:9.6"
218+
- php: '8.1'
219+
db: "postgres:10"
220+
- php: '8.1'
221+
db: "postgres:11"
222+
- php: '8.1'
223+
db: "postgres:12"
224+
- php: '8.1'
225+
db: "postgres:13"
226+
- php: '8.1'
227+
db: "postgres:14"
228+
- php: '8.1'
229+
db: "postgres:15"
230+
- php: '8.2'
231+
db: "postgres:9.5"
232+
- php: '8.3'
233+
db: "postgres:9.5"
234+
- php: '8.4'
235+
db: "postgres:9.5"
236236

237237
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
238238

@@ -286,7 +286,7 @@ jobs:
286286
uses: shivammathur/setup-php@v2
287287
with:
288288
php-version: ${{ matrix.php }}
289-
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
290290
coverage: none
291291

292292
- name: Setup environment for phpBB
@@ -317,21 +317,21 @@ jobs:
317317

318318
# START Other Tests Job (SQLite 3 and mssql)
319319
other-tests:
320-
runs-on: ubuntu-22.04
320+
runs-on: ubuntu-20.04
321321
strategy:
322322
matrix:
323323
include:
324-
- php: '8.1'
325-
db: "sqlite3"
326-
- php: '8.1'
327-
db: "mcr.microsoft.com/mssql/server:2017-latest"
328-
db_alias: 'MSSQL 2017'
329-
- php: '8.1'
330-
db: "mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04"
331-
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'
324+
- php: '8.1'
325+
db: "sqlite3"
326+
- php: '8.1'
327+
db: "mcr.microsoft.com/mssql/server:2017-latest"
328+
db_alias: 'MSSQL 2017'
329+
- php: '8.1'
330+
db: "mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04"
331+
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'
335335

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

@@ -377,7 +377,7 @@ jobs:
377377
env:
378378
MATRIX_DB: ${{ matrix.db }}
379379
run: |
380-
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' ]
381381
then
382382
db='mssql'
383383
else
@@ -389,7 +389,7 @@ jobs:
389389
uses: shivammathur/setup-php@v2
390390
with:
391391
php-version: ${{ matrix.php }}
392-
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
393393
coverage: none
394394

395395
- 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
@@ -68,7 +68,7 @@ protected function setUp(): void
6868
protected function set_listener()
6969
{
7070
$this->listener = $this->getMockBuilder('\phpbb\teamsecurity\event\listener')
71-
->setMethods(array(
71+
->onlyMethods(array(
7272
'in_watch_group',
7373
'send_message'
7474
))

tests/ext_test.php

Lines changed: 10 additions & 5 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,17 +55,21 @@ 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
$doctrine_db = $this->new_doctrine_dbal();
6266
$factory = new \phpbb\db\tools\factory();
63-
$db_tools = $factory->get($doctrine_db);
67+
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $php_ext);
68+
$db_tools = $factory->get($db_doctrine);
6469
$table_prefix = 'phpbb_';
6570

6671
$container = new \phpbb_mock_container_builder();
72+
$container->set('event_dispatcher', $phpbb_dispatcher);
6773

6874
$migrator = new \phpbb\db\migrator(
6975
$container,
@@ -79,13 +85,12 @@ protected function create_extension_manager()
7985
new \phpbb\db\migration\helper()
8086
);
8187
$container->set('migrator', $migrator);
82-
$container->set('dispatcher', $phpbb_dispatcher);
8388

8489
return new \phpbb\extension\manager(
8590
$container,
8691
$db,
8792
$config,
88-
$this->createMock('\phpbb\finder\factory'),
93+
$finder_factory,
8994
'phpbb_ext',
9095
$phpbb_root_path,
9196
null

0 commit comments

Comments
 (0)