diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..cd097f3 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,2 @@ +fixes: + - "/phpBB3/phpBB/ext/phpbb/pages/::" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2f4b073..1c85357 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -115,6 +115,8 @@ jobs: MYISAM: 1 - php: '8.1' db: "mysql:8.0" + COVERAGE: 1 + db_alias: "mysql:8.0 with Coverage" - php: '8.1' db: "mysql:8.1" - php: '8.2' @@ -173,12 +175,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, intl, gd, exif, iconv, mysqli, pdo, pdo_mysql, 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, intl, gd, exif, iconv, mysqli, pdo, pdo_mysql, ldap + coverage: xdebug + - name: Setup environment for phpBB env: DB: ${{steps.database-type.outputs.db}} @@ -195,14 +206,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\n\t\t\n\t\t\t..\/<\/directory>\n\t\t\t\n\t\t\t\t..\/tests\/<\/directory>\n\t\t\t\t..\/language\/<\/directory>\n\t\t\t\t..\/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 diff --git a/README.md b/README.md index 7723a3d..2471b69 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ This is the repository for the development of the phpBB Pages Extension. [![Build Status](https://github.com/phpbb-extensions/pages/workflows/Tests/badge.svg)](https://github.com/phpbb-extensions/pages/actions) +[![codecov](https://codecov.io/gh/phpbb-extensions/pages/graph/badge.svg?token=rorlx9l6gs)](https://codecov.io/gh/phpbb-extensions/pages) ## Install diff --git a/acp/pages_module.php b/acp/pages_module.php index b071fd7..ebc2e61 100644 --- a/acp/pages_module.php +++ b/acp/pages_module.php @@ -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(); @@ -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); diff --git a/composer.json b/composer.json index 3a28a34..d37eee9 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,8 @@ "version-check": { "host": "www.phpbb.com", "directory": "/customise/db/extension/pages", - "filename": "version_check" + "filename": "version_check", + "ssl": true } } }