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

[TASK] Update for TYPO3 13.4 LTS #21

Merged
merged 1 commit into from
Oct 28, 2024
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
207 changes: 7 additions & 200 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,206 +17,13 @@ env:
CI: true

jobs:
"composer-validate":
name: "Composer validate"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: composer validate
extension-test:
name: 'Testing and linting'
uses: astehlik/typo3-extension-buildtools/.github/workflows/extension-test.yml@TYPO3_13

"composer-normalize":
name: "Composer normalize"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: composer normalize --dry-run --diff

"check-codestyle-codesniffer":
name: "PHP_CodeSniffer check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 bin/t3_check_codestyle.sh PerCodeStyleT3Ext

"check-codestyle-php-cs-fixer":
name: "PHP CS Fixer check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash 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.2", "8.3"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: ${{ matrix.php_version }}
- run: |
bash bin/t3_run_tests.sh -s unit -p ${{ matrix.php_version }}

"php-functional-tests-sqlite":
name: "Functional tests on SQLite"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- run: |
bash bin/t3_run_tests.sh -s functional -d sqlite -p ${{ env.MAIN_PHP_VERSION }}

"php-functional-tests-mariadb":
name: "Functional tests on MariaDB"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash bin/t3_run_tests.sh -s functional -d mariadb -p ${{ env.MAIN_PHP_VERSION }}

"php-acceptance-tests-mariadb":
name: "Acceptance tests on MariaDB"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- uses: shivammathur/setup-php@v2
with:
php-version: "${{ env.MAIN_PHP_VERSION }}"
extensions: intl zip
- run: |
rm -f .Build/Web/typo3/sysext/* .Build/Web/typo3conf/ext/*
composer run post-autoload-dump
bash bin/t3_run_tests.sh -s acceptance -d mariadb -p ${{ env.MAIN_PHP_VERSION }} -b docker

"php-lint":
name: "PHP linting"
strategy:
matrix:
php_version: ["8.2", "8.3"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: ${{ matrix.php_version }}
- run: |
bash bin/t3_run_tests.sh -s lintPhp -p ${{ matrix.php_version }}

"phpstan":
name: "PHPStan"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: "${{ env.MAIN_PHP_VERSION }}"
- uses: shivammathur/setup-php@v2
with:
php-version: "${{ env.MAIN_PHP_VERSION }}"
extensions: intl zip
- run: |
php -dxdebug.mode=off bin/codecept build -c Tests/codeception.yml
php -dxdebug.mode=off bin/phpstan analyse -c Build/phpstan/phpstan.ci.neon --no-progress --no-interaction --memory-limit 4G --debug

"coverage-phpunit":
name: "Test coverage by Unit Tests"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash bin/t3_run_tests.sh -s unit -p ${{ env.MAIN_PHP_VERSION }} -X coverage -- --coverage-clover Logs/clover-unit.xml --coverage-filter ../Classes
- uses: actions/upload-artifact@v4
with:
name: coverage-phpunit
path: 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@v4
- uses: ./.github/workflows/composer
with:
php_version: ${{ env.MAIN_PHP_VERSION }}
- run: |
bash bin/t3_run_tests.sh -s functional -d mariadb -p ${{ env.MAIN_PHP_VERSION }} -X coverage -- --coverage-clover Logs/clover-functional.xml --coverage-filter ../Classes
- uses: actions/upload-artifact@v4
with:
name: coverage-functional
path: 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@v4
- uses: actions/download-artifact@v4
with:
name: coverage-phpunit
- uses: actions/download-artifact@v4
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@v4
- 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 bin/typo3scan scan .
2 changes: 1 addition & 1 deletion Build/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ parameters:
- ../../Tests

excludePaths:
- ../../Tests/Acceptance/Support
- ../../Tests/Acceptance
2 changes: 1 addition & 1 deletion Classes/Controller/OembedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private function getNextMatchingProvider(ProviderResolver $providerResolver, str
{
try {
return $providerResolver->getNextMatchingProvider($url);
} catch (NoMatchingProviderException $e) {
} catch (NoMatchingProviderException) {
return null;
}
}
Expand Down
19 changes: 9 additions & 10 deletions Classes/Request/RequestHandler/Panopto/PanoptoRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@
use Sto\Mediaoembed\Domain\Model\Provider;
use Sto\Mediaoembed\Request\RequestHandler\RequestHandlerInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;

final class PanoptoRequestHandler implements RequestHandlerInterface
final readonly class PanoptoRequestHandler implements RequestHandlerInterface
{
private PanoptoUrlProcessor $urlProcessor;

public function __construct(PanoptoUrlProcessor $urlProcessor)
{
$this->urlProcessor = $urlProcessor;
}
public function __construct(
private PanoptoUrlProcessor $urlProcessor,
private ViewFactoryInterface $viewFactory,
) {}

public function handle(Provider $provider, Configuration $configuration): array
{
$view = new StandaloneView();
$view->setTemplatePathAndFilename($this->getTemplatePath());
$viewFactoryData = new ViewFactoryData(templatePathAndFilename: $this->getTemplatePath());
$view = $this->viewFactory->create($viewFactoryData);

$settings = $provider->getRequestHandlerSettings();

Expand Down
8 changes: 0 additions & 8 deletions Classes/ViewHelpers/EmbedResponsivePaddingViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ public function initializeArguments(): void
$this->registerArgument('configuration', Configuration::class, '', true);
$this->registerArgument('response', AspectRatioAwareResponseInterface::class, '', true);
$this->registerArgument('style-property', 'string', '', false, 'padding-top');

$this->registerTagAttribute(
'class',
'string',
'CSS class(es) for this element',
false,
'tx-mediaoembed-embed-responsive-padding',
);
}

public function render(): string
Expand Down
37 changes: 23 additions & 14 deletions Tests/Acceptance/Application.suite.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
actor: BackendTester
modules:
enabled:
- WebDriver:
url: '%typo3TestingAcceptanceBaseUrl%'
browser: chrome
wait: 1
host: chrome
- \TYPO3\TestingFramework\Core\Acceptance\Helper\Acceptance
- \TYPO3\TestingFramework\Core\Acceptance\Helper\Login:
sessions:
# This sessions must exist in the database fixture to get a logged in state.
editor: ff83dfd81e20b34c27d3e97771a4525a
admin: 886526ce72b86870739cc41991144ec1
- Asserts

extensions:
enabled:
- Sto\Mediaoembed\Tests\Acceptance\Support\Extension\BackendMediaoembedEnvironment


step_decorators:
- \Codeception\Step\ConditionalAssertion
- \Codeception\Step\TryTo

modules:
enabled:
- \TYPO3\TestingFramework\Core\Acceptance\Helper\Acceptance
- \De\SWebhosting\Buildtools\Tests\Acceptance\Helper\PasswordLogin
config:
\De\SWebhosting\Buildtools\Tests\Acceptance\Helper\PasswordLogin:
passwords:
admin: '%typo3TestingAcceptanceAdminPassword%'
editor: '%typo3TestingAcceptanceEditorPassword%'

env:
classic:
extensions:
enabled:
- Sto\Mediaoembed\Tests\Acceptance\Support\Extension\BackendMediaoembedEnvironment
systemplate:
sets:

groups:
AcceptanceTests-Job-*: AcceptanceTests-Job-*
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,25 @@
namespace Sto\Mediaoembed\Tests\Acceptance\Support\Extension;

use Codeception\Event\SuiteEvent;
use De\SWebhosting\Buildtools\Tests\Acceptance\Helper\AcceptanceHelper;
use RuntimeException;
use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment;

class BackendMediaoembedEnvironment extends BackendEnvironment
{
/**
* Load a list of core extensions and styleguide.
*
* @var array
*/
protected $localConfig = [
'coreExtensionsToLoad' => [
'core',
'extbase',
'fluid',
'backend',
'filelist',
'install',
'frontend',
'fluid_styled_content',
],
'testExtensionsToLoad' => ['typo3conf/ext/mediaoembed'],
'csvDatabaseFixtures' => [__DIR__ . '/../../Fixtures/BackendEnvironment.csv'],
];
public function __construct(array $config, array $options)
{
$this->localConfig = [
'coreExtensionsToLoad' => [
...AcceptanceHelper::getExtensionsForMinimalUsableSystem(),
'fluid_styled_content',
],
'testExtensionsToLoad' => ['typo3conf/ext/mediaoembed'],
'csvDatabaseFixtures' => [__DIR__ . '/../../Fixtures/BackendEnvironment.csv'],
];

parent::__construct($config, $options);
}

public function bootstrapTypo3Environment(SuiteEvent $suiteEvent): void
{
Expand Down Expand Up @@ -60,6 +55,11 @@ public function bootstrapTypo3Environment(SuiteEvent $suiteEvent): void
$indexPath = $typo3RootPath . '/' . $indexFile;
$indexContexts = file_get_contents($indexPath);
$indexContexts = str_replace('<?php', '<?php ' . $putenvCode, $indexContexts);
$indexContexts = str_replace(
'SystemEnvironmentBuilder::run()',
'SystemEnvironmentBuilder::run(composerMode: false)',
$indexContexts,
);
file_put_contents($indexPath, $indexContexts);
}
}
Expand Down
Loading