Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test suite and add code coverage #178

Merged
merged 1 commit into from
Oct 15, 2023
Merged
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
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixes:
- "/phpBB3/phpBB/ext/phpbb/pages/::"
67 changes: 48 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,26 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
- php: '7.2'
db: "mariadb:10.1"
- php: '7.1'
- php: '7.2'
db: "mariadb:10.2"
- php: '7.1'
- php: '7.2'
db: "mariadb:10.3"
- php: '7.1'
- php: '7.2'
db: "mariadb:10.4"
- php: '7.1'
- php: '7.2'
db: "mariadb:10.5"
- php: '7.1'
- php: '7.2'
db: "mysql:5.6"
db_alias: "MyISAM Tests"
MYISAM: 1
- php: '7.1'
- php: '7.2'
db: "mysql:5.6"
- php: '7.1'
db: "mysql:5.7"
- php: '7.2'
db: "mysql:5.7"
COVERAGE: 1
db_alias: "mysql:5.7 with Coverage"
- php: '7.3'
db: "mysql:5.7"
- php: '7.4'
Expand Down Expand Up @@ -173,12 +173,21 @@ jobs:
echo "db=$db" >> $GITHUB_OUTPUT
- name: Setup PHP
if: ${{ matrix.COVERAGE != 1 }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none

- name: Setup PHP with Coverage
if: ${{ matrix.COVERAGE == 1 }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: xdebug

- name: Setup environment for phpBB
env:
DB: ${{steps.database-type.outputs.db}}
Expand All @@ -195,14 +204,36 @@ jobs:
working-directory: ./phpBB3

- name: Setup PHPUnit files
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
env:
DB: ${{steps.database-type.outputs.db}}
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
run: |
if [ $COVERAGE == '1' ]
then
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' .github/phpunit-$DB-github.xml &> phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml
else
mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
fi
working-directory: ./phpBB3

- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
run: |
if [ $COVERAGE == '1' ]
then
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
else
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
fi
working-directory: ./phpBB3

- name: Send code coverage
if: ${{ matrix.COVERAGE == 1 }}
uses: codecov/codecov-action@v3
with:
files: ./phpBB3/build/logs/clover.xml
# END MySQL and MariaDB Job

# START PostgreSQL Job
Expand All @@ -211,18 +242,16 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
- php: '7.2'
db: "postgres:9.5"
- php: '7.1'
- php: '7.2'
db: "postgres:9.6"
- php: '7.1'
- php: '7.2'
db: "postgres:10"
- php: '7.1'
- php: '7.2'
db: "postgres:11"
- php: '7.1'
- php: '7.2'
db: "postgres:12"
- php: '7.1'
db: "postgres:13"
- php: '7.2'
db: "postgres:13"
- php: '7.3'
Expand Down Expand Up @@ -325,7 +354,7 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
- php: '7.2'
db: "sqlite3"
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2017-latest"
Expand Down
6 changes: 3 additions & 3 deletions acp/pages_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public function main($id, $mode)
$this->tpl_name = 'manage_pages';

// Set the page title for our ACP page
$this->page_title = $lang->lang('ACP_PAGES_MANAGE');
$this->page_title = 'ACP_PAGES_MANAGE';

// Perform any actions submitted by the user
switch ($action)
{
case 'add':
// Set the page title for our ACP page
$this->page_title = $lang->lang('ACP_PAGES_CREATE_PAGE');
$this->page_title = 'ACP_PAGES_CREATE_PAGE';

// Load the add page handle in the admin controller
$admin_controller->add_page();
Expand All @@ -71,7 +71,7 @@ public function main($id, $mode)

case 'edit':
// Set the page title for our ACP page
$this->page_title = $lang->lang('ACP_PAGES_EDIT_PAGE');
$this->page_title = 'ACP_PAGES_EDIT_PAGE';

// Load the edit page handle in the admin controller
$admin_controller->edit_page($page_id);
Expand Down