Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .github/setup-extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ NOTESTS="${2}"
composer update -n --prefer-dist --no-progress

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

# Build extension package
vendor/bin/phing

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

# Add required files for tests
if [[ "${NOTESTS}" != 1 ]]; then
cp -a {phpunit.xml.dist,tests/} ../phpBB3/phpBB/ext/"${EXTNAME}"/
cp -a {phpunit.xml.dist,tests/} ../phpbb/phpBB/ext/"${EXTNAME}"/
fi
59 changes: 28 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ env:
IMAGE_ICC: 1
EPV: 1
EXECUTABLE_FILES: 1
PHPBB_BRANCH: 3.3.x
PHPBB_BRANCH: master # TODO: Use stable branch

jobs:
basic-tests:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
name: php ${{ matrix.php-version }}, none none
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
PHP_VERSION: ${{ matrix.php-version }}
strategy:
fail-fast: false
matrix:
php-version: ['8.1']
php-version: ['8.2']
steps:
- name: Checkout phpBB
uses: actions/checkout@v6
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
path: phpbb

- name: Checkout extension
uses: actions/checkout@v6
Expand All @@ -47,7 +47,7 @@ jobs:

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

- name: Setup cache
Expand All @@ -59,7 +59,7 @@ jobs:
${{ runner.os }}-composer-

- name: Setup environment for phpBB
working-directory: phpBB3
working-directory: phpbb
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS

- name: Setup Node
Expand All @@ -81,33 +81,33 @@ jobs:

- name: Setup EPV
if: ${{ env.EPV == 1 }}
working-directory: phpBB3/phpBB
run: composer require -n --prefer-dist --no-progress phpbb/epv:dev-master
working-directory: phpbb/phpBB
run: composer require -n --prefer-dist --no-progress phpbb/epv:dev-epv-phpbb4 # TODO: Use stable branch

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

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

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

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

mysql-tests:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
services:
mysql:
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' }}
Expand All @@ -129,12 +129,9 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '8.1'
- php-version: '8.2'
db-type: 'mysql'
db-version: '5.7'
- php-version: '8.1'
db-type: 'mariadb'
db-version: '10.6'
- php-version: '8.2'
db-type: 'mariadb'
db-version: '10.6'
Expand All @@ -153,7 +150,7 @@ jobs:
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
path: phpbb

- name: Checkout extension
uses: actions/checkout@v6
Expand All @@ -170,7 +167,7 @@ jobs:

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

- name: Setup cache
Expand All @@ -182,7 +179,7 @@ jobs:
${{ runner.os }}-composer-

- name: Setup environment for phpBB
working-directory: phpBB3
working-directory: phpbb
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS

- name: Setup Node
Expand All @@ -203,23 +200,23 @@ jobs:
.github/setup-extension.sh $EXTNAME $NOTESTS

- name: Setup database
working-directory: phpBB3
working-directory: phpbb
run: .github/setup-database.sh $DB $MYISAM

- name: Setup PHPUnit files
working-directory: phpBB3
working-directory: phpbb
run: |
mkdir -p phpBB/ext/$EXTNAME/ci
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/

- name: Run unit tests
working-directory: phpBB3
working-directory: phpbb
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php

postgresql-tests:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
services:
postgres:
image: ${{ (matrix.db-type == 'postgres') && matrix.db-type || 'postgres' }}:${{ (matrix.db-type == 'postgres' && matrix.db-version != 'none') && matrix.db-version || 'alpine' }}
Expand All @@ -242,7 +239,7 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '8.1'
- php-version: '8.2'
db-type: 'postgres'
db-version: '17-alpine'
- php-version: '8.4'
Expand All @@ -257,7 +254,7 @@ jobs:
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
path: phpbb

- name: Checkout extension
uses: actions/checkout@v6
Expand All @@ -274,7 +271,7 @@ jobs:

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

- name: Setup cache
Expand All @@ -286,7 +283,7 @@ jobs:
${{ runner.os }}-composer-

- name: Setup environment for phpBB
working-directory: phpBB3
working-directory: phpbb
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS

- name: Setup Node
Expand All @@ -307,17 +304,17 @@ jobs:
.github/setup-extension.sh $EXTNAME $NOTESTS

- name: Setup database
working-directory: phpBB3
working-directory: phpbb
run: .github/setup-database.sh $DB $MYISAM

- name: Setup PHPUnit files
working-directory: phpBB3
working-directory: phpbb
run: |
mkdir -p phpBB/ext/$EXTNAME/ci
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/

- name: Run unit tests
working-directory: phpBB3
working-directory: phpbb
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php

lint:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ It uses the plugins [Litedown](https://s9etextformatter.readthedocs.io/Plugins/L

### Requirements

- PHP 8.1 or greater
- phpBB 3.3 or greater
- PHP 8.2 or greater
- phpBB 4.0 or greater

### Support

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"type": "phpbb-extension",
"description": "Markdown extension for phpBB",
"homepage": "https://github.com/AlfredoRamos/phpbb-ext-markdown",
"version": "1.5.0",
"time": "2025-09-12",
"version": "2.0.0-dev",
"time": "2025-09-30",
"keywords": [
"phpbb",
"extension",
Expand All @@ -23,7 +23,7 @@
}
],
"require": {
"php": "^8.1.0",
"php": "^8.2.0",
"composer/installers": "^2.2.0"
},
"require-dev": {
Expand All @@ -36,7 +36,7 @@
"extra": {
"display-name": "Markdown",
"soft-require": {
"phpbb/phpbb": "~3.3.2"
"phpbb/phpbb": "~4.0.0"
},
"version-check": {
"host": "alfredoramos.mx",
Expand Down
8 changes: 3 additions & 5 deletions ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
class ext extends base
{
/**
* Check whether or not the extension can be enabled.
*
* @return bool
*/
* {@inheritdoc}
*/
public function is_enableable()
{
return phpbb_version_compare(PHPBB_VERSION, '3.3.2', '>=');
return phpbb_version_compare(PHPBB_VERSION, '4.0.0-a1-dev', '>='); // TODO: Use stable version
}
}
4 changes: 2 additions & 2 deletions tests/functional/markdown_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ public function test_inline_spoiler()
));

$expected = <<<EOT
<p>This is a Reddit-style <span class="spoiler markdown" onclick="removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.<br>
This is a Discord-style <span class="spoiler markdown" onclick="removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.</p>
<p>This is a Reddit-style <span class="spoiler markdown" onclick="this.removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.<br>
This is a Discord-style <span class="spoiler markdown" onclick="this.removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.</p>
EOT;

$result = $crawler->filter(sprintf(
Expand Down