Support TYPO3 v11.2 and PHP 8.0 beside current v10.4 and 7.4.

This commit is contained in:
Daniel Siepmann 2021-05-18 21:18:06 +02:00
parent a6a170b61e
commit 3c10aa6d10
4 changed files with 232 additions and 63 deletions

View file

@ -14,8 +14,8 @@ jobs:
strategy:
matrix:
php-version:
- 7.3
- 7.4
- 8.0
steps:
- name: Checkout
uses: actions/checkout@v2
@ -28,16 +28,23 @@ jobs:
- name: PHP lint
run: "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l"
check-dependencies:
check-dependencies-TYPO3-v10:
runs-on: ubuntu-latest
needs: [check-composer]
needs:
- check-composer
strategy:
matrix:
php-version:
- '7.4'
typo3-version:
- '^10.4'
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.3"
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
@ -51,25 +58,66 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer V1 until all dev dependencies are ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-plugins
run: composer install --prefer-dist --no-progress --no-plugins
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --no-plugins --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: Missing composer requirements
run: ./vendor/bin/composer-require-checker check --config-file dependency-checker.json
xml-linting:
check-dependencies-TYPO3-v11:
runs-on: ubuntu-latest
needs: [check-composer]
needs:
- check-composer
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
typo3-version:
- '11.2.*'
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.3"
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-plugins
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --no-plugins --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: Missing composer requirements
run: ./vendor/bin/composer-require-checker check --config-file dependency-checker.json
xml-linting:
runs-on: ubuntu-latest
needs:
- check-composer
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
- name: Install xmllint
run: sudo apt-get install libxml2-utils
@ -86,9 +134,6 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer V1 until all dev dependencies are ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
@ -106,8 +151,7 @@ jobs:
coding-guideline:
runs-on: ubuntu-latest
needs:
- check-dependencies
needs:
- xml-linting
steps:
- uses: actions/checkout@v2
@ -115,7 +159,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.3"
php-version: "7.4"
- name: Get Composer Cache Directory
id: composer-cache
@ -129,25 +173,23 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer V1 until all dev dependencies are ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Coding Guideline
run: ./vendor/bin/phpcs
tests-sqlite:
tests-sqlite-TYPO3-v10:
runs-on: ubuntu-latest
needs:
- check-dependencies
- check-dependencies-TYPO3-v10
- xml-linting
strategy:
matrix:
php-version:
- 7.3
- 7.4
- '7.4'
typo3-version:
- '^10.4'
steps:
- uses: actions/checkout@v2
@ -168,25 +210,67 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer V1 until all dev dependencies are ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: PHPUnit Tests
run: ./vendor/bin/phpunit --testdox
tests-mysql:
tests-sqlite-TYPO3-v11:
runs-on: ubuntu-latest
needs:
- check-dependencies
- check-dependencies-TYPO3-v11
- xml-linting
strategy:
matrix:
php-version:
- 7.3
- 7.4
- '7.4'
- '8.0'
typo3-version:
- '11.2.*'
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: PHPUnit Tests
run: ./vendor/bin/phpunit --testdox
tests-mysql-TYPO3-v10:
runs-on: ubuntu-latest
needs:
- check-dependencies-TYPO3-v10
- xml-linting
strategy:
matrix:
php-version:
- '7.4'
typo3-version:
- '^10.4'
steps:
- uses: actions/checkout@v2
@ -210,12 +294,12 @@ jobs:
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Keep composer V1 until all dev dependencies are ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: PHPUnit Tests
run: |-
export typo3DatabaseDriver="mysqli"
@ -225,16 +309,25 @@ jobs:
export typo3DatabasePassword="root"
./vendor/bin/phpunit --testdox
code-quality:
tests-mysql-TYPO3-v11:
runs-on: ubuntu-latest
needs: [check-dependencies]
needs:
- check-dependencies-TYPO3-V11
- xml-linting
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
typo3-version:
- '11.2.*'
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.3"
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
@ -248,11 +341,99 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer V1 until all dev dependencies are ready
run: sudo composer selfupdate --1
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: PHPUnit Tests
run: |-
export typo3DatabaseDriver="mysqli"
export typo3DatabaseName="typo3"
export typo3DatabaseHost="127.0.0.1"
export typo3DatabaseUsername="root"
export typo3DatabasePassword="root"
./vendor/bin/phpunit --testdox
code-quality-TYPO3-v10:
runs-on: ubuntu-latest
needs:
- check-dependencies-TYPO3-v10
strategy:
matrix:
php-version:
- '7.4'
typo3-version:
- '^10.4'
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse
code-quality-TYPO3-v11:
runs-on: ubuntu-latest
needs:
- check-dependencies-TYPO3-v11
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
typo3-version:
- '11.2.*'
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Switch to expected TYPO3 Version
run: composer require --prefer-dist --no-progress --update-with-all-dependencies "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-dashboard:${{ matrix.typo3-version }}"
- name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse

View file

@ -101,9 +101,9 @@ class PageviewsPerDay implements ChartDataProviderInterface
$data = [];
for ($daysBefore = $this->days; $daysBefore >= 0; $daysBefore--) {
$timeForLabel = strtotime('-' . $daysBefore . ' day');
$startPeriod = strtotime('-' . $daysBefore . ' day 0:00:00');
$endPeriod = strtotime('-' . $daysBefore . ' day 23:59:59');
$timeForLabel = (int) strtotime('-' . $daysBefore . ' day');
$startPeriod = (int) strtotime('-' . $daysBefore . ' day 0:00:00');
$endPeriod = (int) strtotime('-' . $daysBefore . ' day 23:59:59');
$labels[] = date($this->dateFormat, $timeForLabel);
$data[] = $this->getPageviewsInPeriod($startPeriod, $endPeriod);

View file

@ -26,25 +26,25 @@
}
},
"require": {
"doctrine/dbal": "^2.10",
"doctrine/dbal": "^2.12",
"ext-mbstring": "*",
"php": "^7.3.0",
"php": "~7.4.0 || ~8.0.0",
"psr/http-message": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"symfony/console": "^4.0 || ^5.0",
"symfony/expression-language": "^4.0 || ^5.0",
"typo3/cms-backend": "^10.4",
"typo3/cms-core": "^10.4",
"typo3/cms-dashboard": "^10.4"
"symfony/console": "^5.2",
"symfony/expression-language": "^5.2",
"typo3/cms-backend": "^10.4 || ~11.2",
"typo3/cms-core": "^10.4 || ~11.2",
"typo3/cms-dashboard": "^10.4 || ~11.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.0",
"phpstan/phpstan": "^0.12.18",
"phpstan/extension-installer": "^1.0",
"jangregor/phpstan-prophecy": "^0.6.2",
"maglnet/composer-require-checker": "^2.1",
"jangregor/phpstan-prophecy": "^0.8.1",
"maglnet/composer-require-checker": "^3.2",
"phpspec/prophecy-phpunit": "^2.0",
"typo3/testing-framework": "^6.3",
"saschaegerer/phpstan-typo3": "^0.13.1"

View file

@ -9,15 +9,3 @@ parameters:
- '#Cannot call method fetch\(\) on Doctrine\\DBAL\\Driver\\Statement\|int\.#'
- '#Cannot call method fetchAll\(\) on Doctrine\\DBAL\\Driver\\Statement\|int\.#'
- '#Cannot call method fetchColumn\(\) on Doctrine\\DBAL\\Driver\\Statement\|int\.#'
-
message: '#\$timestamp of function date expects int, int\|false given\.#'
path: Classes/Dashboard/Provider/PageviewsPerDay.php
count: 1
-
message: '#Parameter \#1 \$start of method DanielSiepmann\\Tracking\\Dashboard\\Provider\\PageviewsPerDay::getPageviewsInPeriod\(\) expects int, int\|false given\.#'
path: Classes/Dashboard/Provider/PageviewsPerDay.php
count: 1
-
message: '#Parameter \#2 \$end of method DanielSiepmann\\Tracking\\Dashboard\\Provider\\PageviewsPerDay::getPageviewsInPeriod\(\) expects int, int\|false given\.#'
path: Classes/Dashboard/Provider/PageviewsPerDay.php
count: 1