Skip to content

Commit

Permalink
Add support for TYPO3 v13 and PHP 8.3 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSiepmann authored Feb 5, 2024
1 parent 77a7d13 commit ec7e3a8
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 21 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: '8.3'
coverage: none
tools: composer:v2
env:
Expand All @@ -35,6 +35,7 @@ jobs:
- 8.0
- 8.1
- 8.2
- 8.3
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -58,7 +59,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
php-version: "8.3"
coverage: none
tools: composer:v2
env:
Expand All @@ -81,7 +82,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
php-version: "8.3"
coverage: none
tools: composer:v2
env:
Expand Down Expand Up @@ -121,12 +122,24 @@ jobs:
- db-version: '8'
php-version: '8.2'
typo3-version: '^11.5'
- db-version: '8'
php-version: '8.3'
typo3-version: '^11.5'
- db-version: '8'
php-version: '8.1'
typo3-version: '^12.4'
- db-version: '8'
php-version: '8.2'
typo3-version: '^12.4'
- db-version: '8'
php-version: '8.3'
typo3-version: '^12.4'
- db-version: '8'
php-version: '8.2'
typo3-version: '^13.0'
- db-version: '8'
php-version: '8.3'
typo3-version: '^13.0'
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -183,10 +196,18 @@ jobs:
typo3-version: '^11.5'
- php-version: '8.2'
typo3-version: '^11.5'
- php-version: '8.3'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^12.4'
- php-version: '8.3'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^13.0'
- php-version: '8.3'
typo3-version: '^13.0'
steps:
- uses: actions/checkout@v3

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v1.5.0 - 2024-02-05

### Added

- Support for TYPO3 v13.0.
- Support for PHP 8.3.

## v1.4.1 - 2023-11-09

### Added
Expand Down
7 changes: 7 additions & 0 deletions Classes/Command/ConvertFromCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@

class ConvertFromCsv extends Command
{
/**
* @var string
*/
protected static $defaultName = 'convert-from-csv';

/**
* @var string
*/
protected static $defaultDescription = 'Converts CSV data-sets to PHP data-sets.';

protected function configure(): void
Expand Down
7 changes: 7 additions & 0 deletions Classes/Command/ConvertFromXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@

class ConvertFromXml extends Command
{
/**
* @var string
*/
protected static $defaultName = 'convert-from-xml';

/**
* @var string
*/
protected static $defaultDescription = 'Converts XML data-sets to PHP data-sets.';

protected function configure(): void
Expand Down
12 changes: 11 additions & 1 deletion Classes/PhpDataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace Codappix\Typo3PhpDatasets;

use RuntimeException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand All @@ -32,7 +33,16 @@ public function import(array $dataSet): void
{
foreach ($dataSet as $tableName => $records) {
$connection = $this->getConnectionPool()->getConnectionForTable($tableName);
$tableDetails = $connection->getSchemaManager()->listTableDetails($tableName);

if (method_exists($connection, 'getSchemaManager')) {
// <= 12
$tableDetails = $connection->getSchemaManager()->listTableDetails($tableName);
} elseif (method_exists($connection, 'getSchemaInformation')) {
// >= 13
$tableDetails = $connection->getSchemaInformation()->introspectTable($tableName);
} else {
throw new RuntimeException('Could not check the schema for table: ' . $tableName, 1707144020);
}

foreach ($records as $record) {
$types = [];
Expand Down
2 changes: 1 addition & 1 deletion Classes/TestingFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function assertPHPDataSet(string $filePath): void

if (!empty($records)) {
foreach ($records as $record) {
$recordIdentifier = $tableName . ':' . $record['uid'];
$recordIdentifier = $tableName . ':' . ($record['uid'] ?? '');
$failMessages[] = 'Not asserted record found for "' . $recordIdentifier . '".';
}
}
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
"bin/typo3-php-datasets"
],
"require": {
"php": "^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2",
"php": "^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3",
"composer-runtime-api": "^2.2",
"doctrine/dbal": "^2.13 || ^3.6",
"symfony/console": "^5.4 || ^6.2",
"typo3/cms-core": "^10.4 || ^11.5 || ^12.4"
"doctrine/dbal": "^2.13 || ^3.6 || ^4.0 || 4.0.0-RC2",
"symfony/console": "^5.4 || ^6.2 || ^7.0",
"typo3/cms-core": "^10.4 || ^11.5 || ^12.4 || ^13.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^8.5 || ^9.6",
"typo3/testing-framework": "^6.16 || ^7.0"
"phpunit/phpunit": "^8.5 || ^9.6 || ^10.0",
"typo3/testing-framework": "^6.16 || ^7.0 || ^8.0"
},
"extra": {
"typo3/cms": {
Expand Down
15 changes: 6 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
requireCoverageMetadata="false"
>

<testsuites>
<testsuite name="functional">
<directory>Tests/Functional/</directory>
</testsuite>
</testsuites>

<coverage>
<source>
<include>
<directory suffix=".php">Classes</directory>
</include>
</coverage>
</source>

<php>
<env name="typo3DatabaseDriver" value="pdo_sqlite"/>
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}:

let
php = phps.packages.x86_64-linux.php81;
php = phps.packages.x86_64-linux.php83;
inherit(php.packages) composer;

phpWithXdebug = php.buildEnv {
Expand Down

0 comments on commit ec7e3a8

Please sign in to comment.