Skip to content

Commit

Permalink
Merge pull request #4185 from dokuwiki/auto-2024-02-06
Browse files Browse the repository at this point in the history
Release Preparations for 2024-02-06 "Kaos"
  • Loading branch information
splitbrain committed Feb 6, 2024
2 parents 871aaf6 + 338cec3 commit 9190531
Show file tree
Hide file tree
Showing 1,125 changed files with 72,151 additions and 46,304 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Expand Up @@ -8,12 +8,13 @@
.git export-ignore
.gitattributes export-ignore
.github export-ignore
.github/** export-ignore
.gitignore export-ignore
.editorconfig export-ignore
.travis.yml export-ignore
appveyor.yml export-ignore
composer.json export-ignore
composer.lock export-ignore
_test export-ignore
_cs export-ignore
_test/** export-ignore
lib/plugins/testing export-ignore
51 changes: 51 additions & 0 deletions .github/workflows/autoFix.yml
@@ -0,0 +1,51 @@
name: "Auto-Fix code"
on:
push:
branches:
- master

jobs:
autofix:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Install tools
run: |
cd _test
composer install --no-interaction --no-progress --no-suggest --prefer-dist
- name: Setup Cache
uses: actions/cache@v3
with:
path: _test/.rector-cache
key: ${{ runner.os }}-rector-${{ hashFiles('_test/rector.php') }}

- name: Run Rector
run: ./_test/vendor/bin/rector process --config _test/rector.php --no-diffs

- name: Run PHP CodeSniffer autofixing
continue-on-error: true # even if not all errors are fixed, we want to create a PR
run: ./_test/vendor/bin/phpcbf --standard=_test/phpcs_MigrationAdjustments.xml

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "🤖 Rector and PHPCS fixes"
title: "🤖 Automatic code style fixes"
body: |
These changes were made automatically by running rector and phpcbf.
Please carefully check the changes before merging. Please note that unit tests are not run for automated pull requests - so if in doubt, manually test the branch before merging.
If you disagree with the changes, simply clean the code yourself and create a new pull request. This PR automatically closes when no more changes are suggested by rector and phpcbf.
delete-branch: true
branch: "bot/autofix"
7 changes: 4 additions & 3 deletions .github/workflows/deletedFiles.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Update deleted files
run: |
for F in $(git diff origin/stable..HEAD --summary | awk '/^ delete/ && $4 !~ /^(VERSION)/ {print $4}'); do
if grep -q "^$F export-ignore" .gitattributes; then
if (git check-attr export-ignore "$F" | grep -q "export-ignore: set"); then
continue
fi
if grep -q "^$F" data/deleted.files; then
Expand All @@ -33,7 +33,8 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "Update deleted files"
title: "Update deleted files"
commit-message: "🤖 Update deleted files"
title: "🤖 Update deleted files"
body: "This updates the list of deleted files based on the recent changes."
delete-branch: true
branch: "bot/deletedFiles"
12 changes: 8 additions & 4 deletions .github/workflows/phpCS.yml
Expand Up @@ -16,13 +16,17 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr, phpcs
php-version: '8.2'

- name: run PHP codesniffer
run: phpcs -q --standard=_test/phpcs_MigrationAdjustments.xml --report=checkstyle | cs2pr
run: |
cd _test
composer install --no-interaction --no-progress --no-suggest --prefer-dist
composer run check
4 changes: 2 additions & 2 deletions .github/workflows/release-build.yml
Expand Up @@ -82,7 +82,7 @@ jobs:
outputs:
version: ${{ env.current_version }}
file: ${{ env.current_file }}
url: ${{ steps.release.outputs.url }}
url: ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}

deploy:
name: Deploy Release
Expand All @@ -91,7 +91,7 @@ jobs:
steps:
- name: Download
run: |
wget ${{ needs.build.outputs.url }}/dokuwiki-${{ needs.build.outputs.file }}.tgz
wget ${{ needs.build.outputs.url }} -O dokuwiki-${{ needs.build.outputs.file }}.tgz
- name: Setup SSH Key
uses: shimataro/ssh-key-action@v2
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/testLinux.yml
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
fail-fast: false

services:
Expand All @@ -34,6 +34,10 @@ jobs:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
squid:
image: ubuntu/squid
ports:
- 3128:3128
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -52,12 +56,13 @@ jobs:
- name: Setup PHPUnit
run: |
php _test/fetchphpunit.php
cd _test
composer install --no-interaction --no-progress --no-suggest --prefer-dist
cp mysql.conf.php.dist mysql.conf.php
cp pgsql.conf.php.dist pgsql.conf.php
cp proxy.conf.php.dist proxy.conf.php
- name: Run PHPUnit
run: |
cd _test
php phpunit.phar --verbose --stderr
composer run test
7 changes: 4 additions & 3 deletions .github/workflows/testWindows.yml
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
fail-fast: false

steps:
Expand All @@ -38,9 +38,10 @@ jobs:
- name: Setup PHPUnit
run: |
php _test/fetchphpunit.php
cd _test
composer install --no-interaction --no-progress --no-suggest --prefer-dist
- name: Run PHPUnit
run: |
cd _test
php phpunit.phar --verbose --stderr
composer run test
7 changes: 2 additions & 5 deletions .gitignore
Expand Up @@ -83,18 +83,15 @@ vendor/paragonie/random_compat/build-phar.sh
vendor/paragonie/random_compat/dist/*
vendor/paragonie/random_compat/other/*
vendor/simplepie/simplepie/db.sql
vendor/marcusschwarz/lesserphp/package.sh
vendor/marcusschwarz/lesserphp/lessify*
vendor/marcusschwarz/lesserphp/Makefile
vendor/marcusschwarz/lesserphp/plessc
vendor/splitbrain/php-cli/examples/*
vendor/splitbrain/php-cli/screenshot*
vendor/splitbrain/php-cli/generate-api.sh
vendor/splitbrain/php-cli/apigen.neon

_test/vendor/*/*/tests/*
_test/vendor/

# PHPUnit tests
phpunit.phar
*.phpunit.result.cache
_test/data/
_test/.rector-cache/
2 changes: 1 addition & 1 deletion README
Expand Up @@ -4,7 +4,7 @@ at https://www.dokuwiki.org/
For Installation Instructions see
https://www.dokuwiki.org/install

DokuWiki - 2004-2023 (c) Andreas Gohr <andi@splitbrain.org>
DokuWiki - 2004-2024 (c) Andreas Gohr <andi@splitbrain.org>
and the DokuWiki Community
See COPYING and file headers for license info

2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2023-04-04a "Jack Jackrum"
2024-02-06 "Kaos"
79 changes: 32 additions & 47 deletions _test/README
@@ -1,75 +1,60 @@
====== DokuWiki Test Suite ======
====== DokuWiki Test Suite and Develpoment Tools ======

This is the test suite to automatically test various parts of DokuWiki.
This directory contains the test suite for DokuWiki as well as configuration for various code quality tools.

===== Requirements =====
===== Setup =====

* PHPUnit 3.6.10+ http://www.phpunit.de/
* PHP 5.3+ http://php.net
Before you can use any of the tools you need to install the dependencies. This is done using composer.

===== PHPUnit Installation ======
composer install

You can install phpunit through your distribution's package manager or simply
download the newest phar file into the _test directory:
If you don't have composer installed yet, you can get it from https://getcomposer.org/

cd _test/
wget https://phar.phpunit.de/phpunit.phar
===== Composer Scripts =====

The composer configuration contains a number of scripts to run the various tools on all of DokuWiki.

===== Running all tests =====
Run all the tests:

Just change to the ''_test'' directory and run phpunit (depending on your install
method):
composer run test

cd _test/
phpunit
Check for code style violations:

or
composer run check

cd _test/
php phpunit.phar
Automatically fix code style violations:

===== Troubleshooting =====
composer run autofix

PHPUnit will fail on some systems with a //headers already sent// error.
This is a known problem with PHPUnit, the error can be avoided by passing the
'--stderr' flag to phpunit:
===== Tools =====

phpunit --stderr
All the tools can be called directly from the ''vendor/bin'' directory.

On windows you may have to enable OpenSSL support for https tests.
Some of them point to httpclient_http.tests.php on the failure.
To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll''
to your ''windows\system32'' folder and add the following line to your php.ini
in the extension section:
==== PHPUnit ====

<code ini>
extension=php_openssl.dll
</code>
./vendor/bin/phpunit --verbose --stderr

===== Running selected Tests =====
The --stderr flag is needed to avoid a headers already sent error on some systems.

You can run a single test file by providing it as an argument to phpunit:
To learn more about running tests and writing your own, visit https://www.dokuwiki.org/devel:unittesting

phpunit tests/inc/common_cleanText.test.php
==== PHP CodeSniffer ====

You can also use groups to exclude certain test from running. For example use
the following command to avoid long running test or tests accessing the
Internet.
To check for code violations:

phpunit --exclude-group slow,internet
./vendor/bin/phpcs

===== Create new Tests =====
To automatically fix code violations:

To create a test for DokuWiki, create a *.test.php file within the tests/
folder. Please respect the folder structure and naming convention. Inside the
file, implement a class, extending 'DokuWikiTest'. Every method, starting
with 'test' will be called as a test (e.g. 'testIfThisIsValid');
./vendor/bin/phpcbf

===== TODO for the test framework =====
To learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:phpcodesniffer

* optional: add helper methods to TestRequest for easy form submission
* createForm(), ...
* check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers
==== Rector ====

To automatically fix code smells

./vendor/bin/rector process

To learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:rector

6 changes: 3 additions & 3 deletions _test/bootstrap.php
Expand Up @@ -52,10 +52,10 @@
'DOCUMENT_ROOT' => DOKU_INC,
'SERVER_PROTOCOL' => 'HTTP/1.1',
'SERVER_SOFTWARE' => 'nginx/0.7.67',
'REMOTE_ADDR' => '87.142.120.6',
'REMOTE_ADDR' => '172.17.18.19',
'REMOTE_PORT' => '21418',
'SERVER_ADDR' => '46.38.241.24',
'SERVER_PORT' => '443',
'SERVER_ADDR' => '10.11.12.13',
'SERVER_PORT' => '80',
'SERVER_NAME' => 'wiki.example.com',
'REDIRECT_STATUS' => '200',
'SCRIPT_FILENAME' => DOKU_INC.'doku.php',
Expand Down
23 changes: 20 additions & 3 deletions _test/composer.json
@@ -1,12 +1,29 @@
{
"require": {
"php": ">=7.2",
"php": ">=7.4",
"scotteh/php-dom-wrapper": "^2.0"
},
"config": {
"platform": {
"php": "7.2"
"php": "7.4"
}
},
"prefer-stable": true
"prefer-stable": true,
"require-dev": {
"rector/rector": "^0.19",
"squizlabs/php_codesniffer": "^3.7",
"phpunit/phpunit": "^8.5"
},
"scripts": {
"test": [
"phpunit --verbose --stderr"
],
"autofix": [
"vendor/bin/rector process",
"phpcbf --standard=./phpcs_MigrationAdjustments.xml"
],
"check": [
"phpcs --standard=./phpcs_MigrationAdjustments.xml"
]
}
}

0 comments on commit 9190531

Please sign in to comment.