Skip to content

Commit 15c6225

Browse files
Make compatible with TYPO3 v14.0 and PHP 8.5
1 parent 384b219 commit 15c6225

File tree

11 files changed

+160
-132
lines changed

11 files changed

+160
-132
lines changed

.github/workflows/ci.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
strategy:
3030
matrix:
3131
php-version:
32-
- 8.1
3332
- 8.2
3433
- 8.3
3534
- 8.4
35+
- 8.5
3636
steps:
3737
- name: Checkout
3838
uses: actions/checkout@v4
@@ -104,27 +104,22 @@ jobs:
104104
strategy:
105105
matrix:
106106
include:
107-
- db-version: '8'
108-
php-version: '8.1'
109-
typo3-version: '^12.4'
110-
- db-version: '8'
111-
php-version: '8.2'
112-
typo3-version: '^12.4'
113-
- db-version: '8'
114-
php-version: '8.3'
115-
typo3-version: '^12.4'
116-
- db-version: '8'
117-
php-version: '8.4'
118-
typo3-version: '^12.4'
119-
- db-version: '8'
120-
php-version: '8.2'
107+
- php-version: '8.2'
108+
typo3-version: '^13.4'
109+
- php-version: '8.3'
121110
typo3-version: '^13.4'
122-
- db-version: '8'
123-
php-version: '8.3'
111+
- php-version: '8.4'
124112
typo3-version: '^13.4'
125-
- db-version: '8'
126-
php-version: '8.4'
113+
- php-version: '8.5'
127114
typo3-version: '^13.4'
115+
- php-version: '8.2'
116+
typo3-version: '^14.0'
117+
- php-version: '8.3'
118+
typo3-version: '^14.0'
119+
- php-version: '8.4'
120+
typo3-version: '^14.0'
121+
- php-version: '8.5'
122+
typo3-version: '^14.0'
128123
steps:
129124
- uses: actions/checkout@v4
130125

@@ -140,7 +135,7 @@ jobs:
140135
- name: Setup MySQL
141136
uses: mirromutth/mysql-action@v1.1
142137
with:
143-
mysql version: '${{ matrix.db-version }}'
138+
mysql version: '8'
144139
mysql database: 'typo3'
145140
mysql root password: 'root'
146141

@@ -167,20 +162,22 @@ jobs:
167162
strategy:
168163
matrix:
169164
include:
170-
- php-version: '8.1'
171-
typo3-version: '^12.4'
172-
- php-version: '8.2'
173-
typo3-version: '^12.4'
174-
- php-version: '8.3'
175-
typo3-version: '^12.4'
176-
- php-version: '8.4'
177-
typo3-version: '^12.4'
178165
- php-version: '8.2'
179166
typo3-version: '^13.4'
180167
- php-version: '8.3'
181168
typo3-version: '^13.4'
182169
- php-version: '8.4'
183170
typo3-version: '^13.4'
171+
- php-version: '8.5'
172+
typo3-version: '^13.4'
173+
- php-version: '8.2'
174+
typo3-version: '^14.0'
175+
- php-version: '8.3'
176+
typo3-version: '^14.0'
177+
- php-version: '8.4'
178+
typo3-version: '^14.0'
179+
- php-version: '8.5'
180+
typo3-version: '^14.0'
184181
steps:
185182
- uses: actions/checkout@v4
186183

Classes/Hooks/DataHandler.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ class DataHandler
3131
{
3232
public function processCmdmap_beforeStart(Typo3DataHandler $dataHandler): void
3333
{
34+
if (property_exists($dataHandler, 'copyWhichTables')) {
35+
$this->preventCopyOfTrackingTablesV13($dataHandler);
36+
return;
37+
}
38+
3439
$this->preventCopyOfTrackingTables($dataHandler);
3540
}
3641

@@ -47,7 +52,7 @@ public static function register(): void
4752
]);
4853
}
4954

50-
private function preventCopyOfTrackingTables(Typo3DataHandler $dataHandler): void
55+
private function preventCopyOfTrackingTablesV13(Typo3DataHandler $dataHandler): void
5156
{
5257
$copyWhichTables = array_keys($GLOBALS['TCA']);
5358

@@ -62,4 +67,9 @@ private function preventCopyOfTrackingTables(Typo3DataHandler $dataHandler): voi
6267

6368
$dataHandler->copyWhichTables = implode(',', $copyWhichTables);
6469
}
70+
71+
private function preventCopyOfTrackingTables(Typo3DataHandler $dataHandler): void
72+
{
73+
// TODO: Find a way to prevent copy of tracking tables on page copy.
74+
}
6575
}

Documentation/Changelog/4.0.0.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
3.0.0
2+
=====
3+
4+
Breaking
5+
--------
6+
7+
* Drop support for TYPO3 v12.
8+
I only support last two TYPO3 versions.
9+
10+
Features
11+
--------
12+
13+
* Add Support for TYPO3 v14.
14+
15+
* Add Support for PHP 8.5.
16+
17+
Fixes
18+
-----
19+
20+
Nothing
21+
22+
Tasks
23+
-----
24+
25+
Nothing
26+
27+
Deprecation
28+
-----------
29+
30+
Nothing

Tests/Functional/Domain/Recordview/FactoryTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Recordview;
5+
namespace DanielSiepmann\Tracking\Tests\Functional\Domain\Recordview;
66

77
/*
88
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@@ -31,6 +31,8 @@
3131
use PHPUnit\Framework\Attributes\CoversClass;
3232
use PHPUnit\Framework\Attributes\Test;
3333
use Psr\Http\Message\ServerRequestInterface;
34+
use Psr\Http\Message\UriInterface;
35+
use TYPO3\CMS\Core\Http\Uri;
3436
use TYPO3\CMS\Core\Routing\PageArguments;
3537
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
3638

@@ -54,7 +56,7 @@ public function returnsRecordviewFromRequest(): void
5456
['routing', null, $routing],
5557
['language', null, $language],
5658
]);
57-
$request->method('getUri')->willReturn('');
59+
$request->method('getUri')->willReturn(self::createStub(UriInterface::class));
5860
$request->method('getHeader')->willReturn([]);
5961
$request->method('getQueryParams')->willReturn([
6062
'category' => 10,
@@ -83,7 +85,7 @@ public function returnedRecordviewContainsUserAgent(): void
8385
['routing', null, $routing],
8486
['language', null, $language],
8587
]);
86-
$request->method('getUri')->willReturn('');
88+
$request->method('getUri')->willReturn(self::createStub(UriInterface::class));
8789
$request->method('getHeader')->willReturn(['Some User Agent']);
8890
$request->method('getQueryParams')->willReturn([
8991
'category' => 10,
@@ -112,7 +114,7 @@ public function returnedRecordviewContainsUri(): void
112114
['routing', null, $routing],
113115
['language', null, $language],
114116
]);
115-
$request->method('getUri')->willReturn('https://example.com');
117+
$request->method('getUri')->willReturn(new Uri('https://example.com'));
116118
$request->method('getHeader')->willReturn(['']);
117119
$request->method('getQueryParams')->willReturn([
118120
'category' => 10,
@@ -141,7 +143,7 @@ public function returnedRecordviewContainsDateTime(): void
141143
['routing', null, $routing],
142144
['language', null, $language],
143145
]);
144-
$request->method('getUri')->willReturn('https://example.com');
146+
$request->method('getUri')->willReturn(new Uri('https://example.com'));
145147
$request->method('getHeader')->willReturn(['']);
146148
$request->method('getQueryParams')->willReturn([
147149
'category' => 10,
@@ -170,7 +172,7 @@ public function returnedRecordviewContainsLanguage(): void
170172
['routing', null, $routing],
171173
['language', null, $language],
172174
]);
173-
$request->method('getUri')->willReturn('https://example.com');
175+
$request->method('getUri')->willReturn(new Uri('https://example.com'));
174176
$request->method('getHeader')->willReturn(['']);
175177
$request->method('getQueryParams')->willReturn([
176178
'category' => 10,
@@ -199,7 +201,7 @@ public function returnedRecordviewContainsPageId(): void
199201
['routing', null, $routing],
200202
['language', null, $language],
201203
]);
202-
$request->method('getUri')->willReturn('https://example.com');
204+
$request->method('getUri')->willReturn(new Uri('https://example.com'));
203205
$request->method('getHeader')->willReturn(['']);
204206
$request->method('getQueryParams')->willReturn([
205207
'category' => 10,
@@ -228,7 +230,7 @@ public function returnedRecordviewContainsRecordUid(): void
228230
['routing', null, $routing],
229231
['language', null, $language],
230232
]);
231-
$request->method('getUri')->willReturn('https://example.com');
233+
$request->method('getUri')->willReturn(new Uri('https://example.com'));
232234
$request->method('getHeader')->willReturn(['']);
233235
$request->method('getQueryParams')->willReturn([
234236
'category' => 20,
@@ -257,7 +259,7 @@ public function returnedRecordviewContainsTableName(): void
257259
['routing', null, $routing],
258260
['language', null, $language],
259261
]);
260-
$request->method('getUri')->willReturn('https://example.com');
262+
$request->method('getUri')->willReturn(new Uri('https://example.com'));
261263
$request->method('getHeader')->willReturn(['']);
262264
$request->method('getQueryParams')->willReturn([
263265
'category' => 20,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "danielsiepmann/tracking-recordview",
3+
"description": "Fixture extension for EXT:tracking",
4+
"type": "typo3-cms-extension",
5+
"require": {
6+
"danielsiepmann/tracking": "*"
7+
},
8+
"extra": {
9+
"typo3/cms": {
10+
"extension-key": "recordview"
11+
}
12+
}
13+
}

Tests/Functional/Fixtures/Extensions/recordview/ext_emconf.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

Tests/Functional/PageviewTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ public function preventsTrackingOfUserAgents(string $userAgent): void
9999
self::assertCount(0, $this->getAllRecords('tx_tracking_pageview'));
100100
}
101101

102-
public static function possibleDeniedUserAgents(): array
102+
public static function possibleDeniedUserAgents(): iterable
103103
{
104-
return [
105-
'Uptime-Kuma' => [
106-
'userAgent' => 'Uptime-Kuma/1.21.2',
107-
],
104+
105+
yield 'Uptime-Kuma' => [
106+
'userAgent' => 'Uptime-Kuma/1.21.2',
108107
];
108+
109109
}
110110
}

Tests/Functional/Typo3FeaturesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function copyContainingRecords(): void
6868

6969
self::assertCount(0, $dataHandler->errorLog, 'Failed with errors: ' . implode(PHP_EOL, $dataHandler->errorLog));
7070
$this->assertCSVDataSet(
71-
'EXT:tracking/Tests/Functional/ExpectedResults/Typo3FeaturesTest/CopyPasteContainingRecords.csv'
71+
__DIR__ . '/ExpectedResults/Typo3FeaturesTest/CopyPasteContainingRecords.csv'
7272
);
7373
}
7474

@@ -89,7 +89,7 @@ public function copyCustomTablesViaDataHandler(): void
8989

9090
self::assertCount(0, $dataHandler->errorLog, 'Failed with errors: ' . implode(PHP_EOL, $dataHandler->errorLog));
9191
$this->assertCSVDataSet(
92-
'EXT:tracking/Tests/Functional/ExpectedResults/Typo3FeaturesTest/CopyPasteContainingRecords.csv'
92+
__DIR__ . '/ExpectedResults/Typo3FeaturesTest/CopyPasteContainingRecords.csv'
9393
);
9494
}
9595

0 commit comments

Comments
 (0)