Skip to content

Commit 5c4dd01

Browse files
committed
Add support for phpBB v4
1 parent e1e0b27 commit 5c4dd01

6 files changed

Lines changed: 44 additions & 58 deletions

File tree

.github/setup-extension.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ NOTESTS="${2}"
1010
composer update -n --prefer-dist --no-progress
1111

1212
# Prepare extension structure
13-
mkdir -p ../phpBB3/phpBB/ext/"${EXTNAME}"
13+
mkdir -p ../phpbb/phpBB/ext/"${EXTNAME}"
1414

1515
# Build extension package
1616
vendor/bin/phing
1717

1818
# Copy extension files and directories
19-
cp -a build/package/"${EXTNAME}"/* ../phpBB3/phpBB/ext/"${EXTNAME}"/
19+
cp -a build/package/"${EXTNAME}"/* ../phpbb/phpBB/ext/"${EXTNAME}"/
2020

2121
# Add required files for tests
2222
if [[ "${NOTESTS}" != 1 ]]; then
23-
cp -a {phpunit.xml.dist,tests/} ../phpBB3/phpBB/ext/"${EXTNAME}"/
23+
cp -a {phpunit.xml.dist,tests/} ../phpbb/phpBB/ext/"${EXTNAME}"/
2424
fi

.github/setup-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ if [[ "${NOTESTS}" != 1 ]]; then
1616
)
1717

1818
for image in "${images[@]}"; do
19-
file=../phpBB3/phpBB/images/"${image}"
20-
fixture=../phpBB3/phpBB/ext/"${EXTNAME}"/tests/functional/fixtures/images/"${image}"
19+
file=../phpbb/phpBB/images/"${image}"
20+
fixture=../phpbb/phpBB/ext/"${EXTNAME}"/tests/functional/fixtures/images/"${image}"
2121

2222
if [[ ! -f "${file}" ]]; then
2323
cp "${fixture}" "$(dirname "${file}")"/

.github/workflows/ci.yml

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ env:
1111
IMAGE_ICC: 1
1212
EPV: 1
1313
EXECUTABLE_FILES: 1
14-
PHPBB_BRANCH: 3.3.x
14+
PHPBB_BRANCH: master
1515

1616
jobs:
1717
basic-tests:
1818
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
1919
name: php ${{ matrix.php-version }}, none none
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-latest
2121
env:
2222
PHP_VERSION: ${{ matrix.php-version }}
2323
strategy:
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
repository: phpbb/phpbb
3232
ref: ${{ env.PHPBB_BRANCH }}
33-
path: phpBB3
33+
path: phpbb
3434

3535
- name: Checkout extension
3636
uses: actions/checkout@v6
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: Setup Composer
4949
id: setup-composer
50-
working-directory: phpBB3/phpBB
50+
working-directory: phpbb/phpBB
5151
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5252

5353
- name: Setup cache
@@ -59,7 +59,7 @@ jobs:
5959
${{ runner.os }}-composer-
6060
6161
- name: Setup environment for phpBB
62-
working-directory: phpBB3
62+
working-directory: phpbb
6363
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
6464

6565
- name: Setup extension
@@ -70,33 +70,33 @@ jobs:
7070
7171
- name: Setup EPV
7272
if: ${{ env.EPV == 1 }}
73-
working-directory: phpBB3/phpBB
73+
working-directory: phpbb/phpBB
7474
run: composer require -n --prefer-dist --no-progress phpbb/epv:dev-master
7575

7676
- name: Run code sniffer
7777
if: ${{ env.SNIFF == 1 }}
78-
working-directory: phpBB3
78+
working-directory: phpbb
7979
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
8080

8181
- name: Check image ICC profiles
8282
if: ${{ env.IMAGE_ICC == 1 }}
83-
working-directory: phpBB3
83+
working-directory: phpbb
8484
run: .github/check-image-icc-profiles.sh
8585

8686
- name: Check executable files
8787
if: ${{ env.EXECUTABLE_FILES == 1 }}
88-
working-directory: phpBB3
88+
working-directory: phpbb
8989
run: .github/ext-check-executable-files.sh ./ $EXTNAME
9090

9191
- name: Run EPV
9292
if: ${{ env.EPV == 1 }}
93-
working-directory: phpBB3
93+
working-directory: phpbb
9494
run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME"
9595

9696
mysql-tests:
9797
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
9898
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
99-
runs-on: ubuntu-22.04
99+
runs-on: ubuntu-latest
100100
services:
101101
mysql:
102102
image: ${{ (matrix.db-type == 'mysql' || matrix.db-type == 'mariadb') && matrix.db-type || 'mariadb' }}:${{ (matrix.db-type == 'mysql' || matrix.db-type == 'mariadb' && matrix.db-version != 'none') && matrix.db-version || 'latest' }}
@@ -142,7 +142,7 @@ jobs:
142142
with:
143143
repository: phpbb/phpbb
144144
ref: ${{ env.PHPBB_BRANCH }}
145-
path: phpBB3
145+
path: phpbb
146146

147147
- name: Checkout extension
148148
uses: actions/checkout@v6
@@ -159,7 +159,7 @@ jobs:
159159

160160
- name: Setup Composer
161161
id: setup-composer
162-
working-directory: phpBB3/phpBB
162+
working-directory: phpbb/phpBB
163163
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
164164

165165
- name: Setup cache
@@ -171,7 +171,7 @@ jobs:
171171
${{ runner.os }}-composer-
172172
173173
- name: Setup environment for phpBB
174-
working-directory: phpBB3
174+
working-directory: phpbb
175175
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
176176

177177
- name: Setup extension
@@ -181,29 +181,23 @@ jobs:
181181
.github/setup-extension.sh $EXTNAME $NOTESTS
182182
183183
- name: Setup database
184-
working-directory: phpBB3
184+
working-directory: phpbb
185185
run: .github/setup-database.sh $DB $MYISAM
186186

187187
- name: Setup PHPUnit files
188-
working-directory: phpBB3
188+
working-directory: phpbb
189189
run: |
190190
mkdir -p phpBB/ext/$EXTNAME/ci
191191
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/
192192
193-
- name: Setup tests
194-
working-directory: extension
195-
run: |
196-
chmod +x .github/setup-tests.sh
197-
.github/setup-tests.sh $EXTNAME $NOTESTS
198-
199193
- name: Run unit tests
200-
working-directory: phpBB3
194+
working-directory: phpbb
201195
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php
202196

203197
postgresql-tests:
204198
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
205199
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
206-
runs-on: ubuntu-22.04
200+
runs-on: ubuntu-latest
207201
services:
208202
postgres:
209203
image: ${{ (matrix.db-type == 'postgres') && matrix.db-type || 'postgres' }}:${{ (matrix.db-type == 'postgres' && matrix.db-version != 'none') && matrix.db-version || 'alpine' }}
@@ -241,7 +235,7 @@ jobs:
241235
with:
242236
repository: phpbb/phpbb
243237
ref: ${{ env.PHPBB_BRANCH }}
244-
path: phpBB3
238+
path: phpbb
245239

246240
- name: Checkout extension
247241
uses: actions/checkout@v6
@@ -258,7 +252,7 @@ jobs:
258252

259253
- name: Setup Composer
260254
id: setup-composer
261-
working-directory: phpBB3/phpBB
255+
working-directory: phpbb/phpBB
262256
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
263257

264258
- name: Setup cache
@@ -270,7 +264,7 @@ jobs:
270264
${{ runner.os }}-composer-
271265
272266
- name: Setup environment for phpBB
273-
working-directory: phpBB3
267+
working-directory: phpbb
274268
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
275269

276270
- name: Setup extension
@@ -280,21 +274,15 @@ jobs:
280274
.github/setup-extension.sh $EXTNAME $NOTESTS
281275
282276
- name: Setup database
283-
working-directory: phpBB3
277+
working-directory: phpbb
284278
run: .github/setup-database.sh $DB $MYISAM
285279

286280
- name: Setup PHPUnit files
287-
working-directory: phpBB3
281+
working-directory: phpbb
288282
run: |
289283
mkdir -p phpBB/ext/$EXTNAME/ci
290284
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/
291285
292-
- name: Setup tests
293-
working-directory: extension
294-
run: |
295-
chmod +x .github/setup-tests.sh
296-
.github/setup-tests.sh $EXTNAME $NOTESTS
297-
298286
- name: Run unit tests
299-
working-directory: phpBB3
287+
working-directory: phpbb
300288
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"extra": {
3939
"display-name": "SEO Metadata",
4040
"soft-require": {
41-
"phpbb/phpbb": "~3.3.0"
41+
"phpbb/phpbb": "~4.0.0"
4242
},
4343
"version-check": {
4444
"host": "alfredoramos.mx",

ext.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
class ext extends base
1515
{
1616
/**
17-
* Check whether or not the extension can be enabled.
18-
*
19-
* @return bool
17+
* {@inheritdoc}
2018
*/
2119
public function is_enableable()
2220
{
23-
return phpbb_version_compare(PHPBB_VERSION, '3.3.0', '>=');
21+
return phpbb_version_compare(PHPBB_VERSION, '4.0.0-a1-dev', '>='); // TODO: Use stable version
2422
}
2523
}

tests/functional/seometadata_test.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function test_meta_description()
2626

2727
$this->assertSame(1, $element->count());
2828
$this->assertSame(
29-
'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Dur',
29+
'This is an example post in your phpBB installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Duri',
3030
$element->attr('content')
3131
);
3232
}
@@ -88,11 +88,11 @@ public function test_open_graph()
8888
$elements['type']->attr('content')
8989
);
9090
$this->assertSame(
91-
'Welcome to phpBB3',
91+
'Welcome to phpBB',
9292
$elements['title']->attr('content')
9393
);
9494
$this->assertSame(
95-
'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Dur',
95+
'This is an example post in your phpBB installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Duri',
9696
$elements['description']->attr('content')
9797
);
9898
$this->assertSame(
@@ -154,11 +154,11 @@ public function test_twitter_cards()
154154
$elements['site']->attr('content')
155155
);
156156
$this->assertSame(
157-
'Welcome to phpBB3',
157+
'Welcome to phpBB',
158158
$elements['title']->attr('content')
159159
);
160160
$this->assertSame(
161-
'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Dur',
161+
'This is an example post in your phpBB installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Duri',
162162
$elements['description']->attr('content')
163163
);
164164
$this->assertSame(
@@ -200,15 +200,15 @@ public function test_json_ld()
200200
))
201201
);
202202
$this->assertSame(
203-
'Welcome to phpBB3',
203+
'Welcome to phpBB',
204204
$elements['headline']
205205
);
206206
$this->assertSame(
207-
'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Dur',
207+
'This is an example post in your phpBB installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Duri',
208208
$elements['description']
209209
);
210210
$this->assertSame(
211-
'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Dur',
211+
'This is an example post in your phpBB installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. Duri',
212212
$elements['text']
213213
);
214214
$this->assertSame(
@@ -261,7 +261,7 @@ public function test_json_ld()
261261
$this->assertSame(1, count($elements['comment']));
262262
$this->assertSame('Comment', $elements['comment'][0]['@type']);
263263
$this->assertSame('http://localhost/viewtopic.php?p=1#p1', $elements['comment'][0]['identifier']);
264-
$this->assertSame('This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', $elements['comment'][0]['text']);
264+
$this->assertSame('This is an example post in your phpBB installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', $elements['comment'][0]['text']);
265265
$this->assertSame('Person', $elements['comment'][0]['author']['@type']);
266266
$this->assertSame('admin', $elements['comment'][0]['author']['name']);
267267
$this->assertSame('http://localhost/memberlist.php?mode=viewprofile&u=2', $elements['comment'][0]['author']['url']);
@@ -562,12 +562,12 @@ public function test_post_reply_metadata()
562562
];
563563

564564
$this->assertSame(
565-
'Welcome to phpBB3 Post reply test',
565+
'Welcome to phpBB Post reply test',
566566
$elements['meta_description']->attr('content')
567567
);
568568

569569
$this->assertSame(
570-
'Welcome to phpBB3 Post reply test',
570+
'Welcome to phpBB Post reply test',
571571
$elements['open_graph']['description']->attr('content')
572572
);
573573
$this->assertSame(
@@ -579,7 +579,7 @@ public function test_post_reply_metadata()
579579
$this->assertSame('image/jpeg', $elements['open_graph']['type']->attr('content'));
580580

581581
$this->assertSame(
582-
'Welcome to phpBB3 Post reply test',
582+
'Welcome to phpBB Post reply test',
583583
$elements['twitter_cards']['description']->attr('content')
584584
);
585585
$this->assertSame(

0 commit comments

Comments
 (0)