Skip to content

Commit

Permalink
Merge branch 'release/13.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
astehlik committed Oct 29, 2024
2 parents ecc47c4 + 19f77c7 commit e82c564
Show file tree
Hide file tree
Showing 44 changed files with 320 additions and 438 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/composer/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.json') }}
- uses: php-actions/composer@v6
with:
php_version: ${{ inputs.php_version }}
Expand Down
197 changes: 16 additions & 181 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,194 +1,29 @@
---
name: Testing and linting

on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:
schedule:
- cron: '45 8 * * 6'

env:
TYPO3_EXTENSION_KEY: html5mediakit
MAIN_PHP_VERSION: 8.2
MAIN_PHP_VERSION: 8.3
CI: true

jobs:
"composer-validate":
name: "Composer validate"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash .Build/bin/t3_run_tests.sh -s composerValidate -p ${{ env.MAIN_PHP_VERSION }}
"composer-normalize":
name: "Composer normalize"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash .Build/bin/t3_run_tests.sh -s composerNormalize -n -p ${{ env.MAIN_PHP_VERSION }}
"check-codestyle-codesniffer":
name: "PHP_CodeSniffer check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- uses: shivammathur/setup-php@v2
with:
php-version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash .Build/bin/t3_check_codestyle.sh PerCodeStyleT3Ext
"check-codestyle-php-cs-fixer":
name: "PHP CS Fixer check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash .Build/bin/t3_run_tests.sh -s cgl -n -p ${{ env.MAIN_PHP_VERSION }}
"php-unit-tests":
name: "PHP Unit tests"
strategy:
matrix:
php_version: ["8.1", "8.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: ${{ matrix.php_version }}
- run: |
bash .Build/bin/t3_run_tests.sh -s unit -p ${{ matrix.php_version }}
"php-functional-tests-sqlite-82":
name: "Functional tests on SQLite"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash .Build/bin/t3_run_tests.sh -s functional -d sqlite -p ${{ env.MAIN_PHP_VERSION }}
"php-functional-tests-mariadb-main":
name: "Functional tests on MariaDB"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash .Build/bin/t3_run_tests.sh -s functional -d mariadb -p ${{ env.MAIN_PHP_VERSION }}
extension-test:
name: 'Testing and linting'
uses: astehlik/typo3-extension-buildtools/.github/workflows/extension-test.yml@TYPO3_13

"php-acceptance-tests-mariadb":
name: "Acceptance tests on MariaDB"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash .Build/bin/t3_run_tests.sh -s acceptance -d mariadb -t Backend -p ${{ env.MAIN_PHP_VERSION }}
"php-lint":
name: "PHP linting"
strategy:
matrix:
php_version: ["8.1", "8.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: ${{ matrix.php_version }}
- run: |
bash .Build/bin/t3_run_tests.sh -s lintPhp -p ${{ matrix.php_version }}
"coverage-phpunit":
name: "Test coverage by Unit Tests"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash .Build/bin/t3_run_tests.sh -s unit -p ${{ env.MAIN_PHP_VERSION }} -x -z coverage -e "--coverage-clover Logs/clover-unit.xml --coverage-filter ../Classes"
- uses: actions/upload-artifact@v3
with:
name: coverage-phpunit
path: .Build/Logs/clover-unit.xml
retention-days: 1

"coverage-functional":
name: "Test coverage by Functional Tests"
runs-on: ubuntu-latest
extension-cc-coverage:
name: 'Code Climate coverage'
uses: astehlik/typo3-extension-buildtools/.github/workflows/extension-cc-coverage.yml@TYPO3_13
if: github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash .Build/bin/t3_run_tests.sh -s functional -d mariadb -p ${{ env.MAIN_PHP_VERSION }} -x -z coverage -e "--coverage-clover Logs/clover-functional.xml --coverage-filter ../Classes"
- uses: actions/upload-artifact@v3
with:
name: coverage-functional
path: .Build/Logs/clover-functional.xml
retention-days: 1

"coverage-upload":
name: Upload coverage report to Code Climage
needs:
- coverage-phpunit
- coverage-functional
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
env:
secrets:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: coverage-phpunit
- uses: actions/download-artifact@v3
with:
name: coverage-functional
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: ./cc-test-reporter before-build
- run: |
./cc-test-reporter format-coverage -t clover -o clover-unit.json clover-unit.xml
- run: |
./cc-test-reporter format-coverage -t clover -o clover-functional.json clover-functional.xml
- run: |
./cc-test-reporter sum-coverage --parts=2 --output=clover-sum.json clover-unit.json clover-functional.json
- run: |
./cc-test-reporter upload-coverage --input=clover-sum.json
"typo3-scan":
name: "Scan for deprecated and breaking code using typo3scan"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- uses: shivammathur/setup-php@v2
with:
php-version: "${{ env.MAIN_PHP_VERSION }}"
- run: php .Build/bin/typo3scan scan --target 12 .
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
/.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
/bin
/codesniffer
/var
/composer.lock
1 change: 1 addition & 0 deletions Build/cleanup_for_ter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rm -Rf Build
rm -Rf Tests
rm -Rf typo3temp
rm -f .codeclimate.yml
rm -f .crowdin.yml
rm -f .editorconfig
rm -f .gitignore
rm ready_for_release.txt
5 changes: 3 additions & 2 deletions Build/php-cs-fixer/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

if (PHP_SAPI !== 'cli') {
exit('This script supports command line usage only. Please check your command.');
Expand All @@ -12,11 +13,11 @@

return (new Config())
->setFinder(
(new PhpCsFixer\Finder())
(new Finder())
->ignoreVCSIgnored(true)
->in(realpath(__DIR__ . '/../../'))
->exclude(['.Build'])
->notName(['ext_emconf.php', 'ext_localconf.php', 'ext_tables.php'])
->notName(['ext_emconf.php', 'ext_localconf.php', 'ext_tables.php']),
)
->setRiskyAllowed(true)
->setRules($rules);
12 changes: 12 additions & 0 deletions Build/phpstan/phpstan.ci.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
includes:
- phpstan.neon

parameters:
# CI needs to calculate phpstan a-new each time anyways. No point in caching this.
# We write this to /tmp within container which is not cached by CI.
tmpDir: /tmp

parallel:
# @todo Process timeout raised as a intermediate solution. This should be further investigated if we can mitigate
# the occurring subprocess timeout issue through other configurations and minimize the execution time again.
processTimeout: 900.0
2 changes: 2 additions & 0 deletions Build/phpstan/phpstan.local.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
includes:
- phpstan.neon
17 changes: 17 additions & 0 deletions Build/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
includes:
- ../../.Build/vendor/bnf/phpstan-psr-container/extension.neon
- ../../.Build/vendor/friendsoftypo3/phpstan-typo3/extension.neon
- ../../.Build/vendor/phpstan/phpstan-phpunit/extension.neon

parameters:
# Use local .cache dir instead of /tmp
tmpDir: ../../.cache/phpstan

level: 5

paths:
- ../../Classes
- ../../Tests

excludePaths:
- ../../Tests/Acceptance
9 changes: 4 additions & 5 deletions Classes/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use RuntimeException;

/**
* Controller for rendering media.
Expand Down Expand Up @@ -54,6 +53,7 @@ public function renderMediaAction(): ResponseInterface
$contentObject = $this->getCurrentContentObject();

try {
/** @extensionScannerIgnoreLine */
$uid = $contentObject->data['_LOCALIZED_UID'] ?? $contentObject->data['uid'];
$media = $this->mediaRepository->findOneByContentElementUid($uid);
} catch (MediaException $mediaException) {
Expand All @@ -68,6 +68,7 @@ public function renderMediaForRelatedTableAction(): ResponseInterface
$contentObject = $this->getCurrentContentObject();

try {
/** @extensionScannerIgnoreLine */
$media = $this->mediaRepository->findOneByParentRecord($contentObject->data);
} catch (MediaException $mediaException) {
return $this->htmlResponse($this->translate('exception.' . $mediaException->getCode()));
Expand Down Expand Up @@ -98,15 +99,13 @@ private function renderMedia(Media $media): ResponseInterface
$contentObject = $this->getCurrentContentObject();
$contentObject->lastChanged($media->getTstamp());

if ($mediaType->equals(MediaType::VIDEO)) {
if ($mediaType === MediaType::VIDEO) {
return (new ForwardResponse('video'))->withArguments(['video' => $media->getUid()]);
}

if ($mediaType->equals(MediaType::AUDIO)) {
if ($mediaType === MediaType::AUDIO) {
return (new ForwardResponse('audio'))->withArguments(['audio' => $media->getUid()]);
}

throw new RuntimeException('An invalid media type is used.'); // @codeCoverageIgnore
}

/**
Expand Down
12 changes: 4 additions & 8 deletions Classes/Domain/Model/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ class Audio extends Media
{
/**
* Reference to the MP3 version of the audio.
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
*/
protected $mp3;
protected ?FileReference $mp3 = null;

/**
* Reference to the OGA/OGG Vorbis version of the audio.
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
*/
protected $ogg;
protected ?FileReference $ogg = null;

/**
* Returns true if an audio file of any type is available.
Expand All @@ -59,12 +55,12 @@ public function getHasOgg(): bool
return $this->ogg instanceof FileReference;
}

public function getMp3(): FileReference
public function getMp3(): ?FileReference
{
return $this->mp3;
}

public function getOgg(): FileReference
public function getOgg(): ?FileReference
{
return $this->ogg;
}
Expand Down
Loading

0 comments on commit e82c564

Please sign in to comment.