Skip to content

Commit a7a3943

Browse files
committed
[TASK] v14 functional tests
1 parent 4c48a03 commit a7a3943

File tree

10 files changed

+176
-32
lines changed

10 files changed

+176
-32
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional
5151
if: matrix.TYPO3 != '14'
5252

53+
- name: Functional Tests 14
54+
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional -- --exclude-group content_defender
55+
if: matrix.TYPO3 == '14'
56+
5357
- name: Acceptance Tests
5458
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast
5559
if: matrix.TYPO3 != '14'

Build/Scripts/runTests.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,10 +641,7 @@ case ${TEST_SUITE} in
641641
mv composer.json.orig composer.json
642642
;;
643643
functional)
644-
PHPUNIT_EXCLUDE_GROUPS+=",not-${DBMS}"
645-
PHPUNIT_EXCLUDE_GROUPS="${PHPUNIT_EXCLUDE_GROUPS#,}"
646-
PHPUNIT_EXCLUDE_GROUPS="${PHPUNIT_EXCLUDE_GROUPS%,}"
647-
COMMAND=(.Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group ${PHPUNIT_EXCLUDE_GROUPS} "$@")
644+
COMMAND=(.Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-${DBMS} "$@")
648645
case ${DBMS} in
649646
mariadb)
650647
echo "Using driver: ${DATABASE_DRIVER}"

Build/phpstan-baseline-11-7.4.neon

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,23 @@ parameters:
7171
-
7272
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#"
7373
count: 1
74-
path: ../Classes/Backend/Grid/ContainerGridColumnItem.php
74+
path: ../Classes/Backend/Grid/ContainerGridColumnItem.php
75+
-
76+
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 2 required\\.$#"
77+
count: 1
78+
path: ../Tests/Functional/Integrity/IntegrityTest.php
79+
80+
-
81+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#"
82+
count: 1
83+
path: ../Tests/Functional/Integrity/IntegrityTest.php
84+
85+
-
86+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#"
87+
count: 1
88+
path: ../Tests/Functional/Integrity/IntegrityTest.php
89+
90+
-
91+
message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#"
92+
count: 1
93+
path: ../Tests/Functional/Integrity/IntegrityTest.php

Build/phpstan-baseline-11.neon

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,23 @@ parameters:
8181
-
8282
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#"
8383
count: 1
84-
path: ../Classes/Backend/Grid/ContainerGridColumnItem.php
84+
path: ../Classes/Backend/Grid/ContainerGridColumnItem.php
85+
-
86+
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 2 required\\.$#"
87+
count: 1
88+
path: ../Tests/Functional/Integrity/IntegrityTest.php
89+
90+
-
91+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#"
92+
count: 1
93+
path: ../Tests/Functional/Integrity/IntegrityTest.php
94+
95+
-
96+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#"
97+
count: 1
98+
path: ../Tests/Functional/Integrity/IntegrityTest.php
99+
100+
-
101+
message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#"
102+
count: 1
103+
path: ../Tests/Functional/Integrity/IntegrityTest.php

Build/phpstan-baseline-12.neon

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,23 @@ parameters:
8181
-
8282
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#"
8383
count: 1
84-
path: ../Classes/Backend/Grid/ContainerGridColumnItem.php
84+
path: ../Classes/Backend/Grid/ContainerGridColumnItem.php
85+
-
86+
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 2 required\\.$#"
87+
count: 1
88+
path: ../Tests/Functional/Integrity/IntegrityTest.php
89+
90+
-
91+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#"
92+
count: 1
93+
path: ../Tests/Functional/Integrity/IntegrityTest.php
94+
95+
-
96+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#"
97+
count: 1
98+
path: ../Tests/Functional/Integrity/IntegrityTest.php
99+
100+
-
101+
message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#"
102+
count: 1
103+
path: ../Tests/Functional/Integrity/IntegrityTest.php

Build/phpstan-baseline-13.neon

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,32 @@ parameters:
4949
message: "#^Cannot call method toArray\\(\\) on array\\.$#"
5050
count: 1
5151
path: ../Classes/Listener/PageContentPreviewRendering.php
52+
-
53+
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 5 required\\.$#"
54+
count: 1
55+
path: ../Tests/Functional/Integrity/IntegrityTest.php
56+
57+
-
58+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#"
59+
count: 1
60+
path: ../Tests/Functional/Integrity/IntegrityTest.php
61+
62+
-
63+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#"
64+
count: 1
65+
path: ../Tests/Functional/Integrity/IntegrityTest.php
66+
67+
-
68+
message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#"
69+
count: 1
70+
path: ../Tests/Functional/Integrity/IntegrityTest.php
71+
72+
-
73+
message: "#^Parameter \\#3 \\$site of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\Entity\\\\SiteInterface, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Backend\\\\View\\\\Drawing\\\\DrawingConfiguration given\\.$#"
74+
count: 1
75+
path: ../Tests/Functional/Integrity/IntegrityTest.php
76+
77+
-
78+
message: "#^Parameter \\#4 \\$drawingConfiguration of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects TYPO3\\\\CMS\\\\Backend\\\\View\\\\Drawing\\\\DrawingConfiguration, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Core\\\\Http\\\\ServerRequest given\\.$#"
79+
count: 1
80+
path: ../Tests/Functional/Integrity/IntegrityTest.php

Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public static function localizeKeepsSortingDataProvider(): array
2727
4 => ['copyToLanguage' => 1],
2828
1 => ['copyToLanguage' => 1],
2929
],
30-
], 'Dataset1'],
30+
], 'dataset' => 'Dataset1'],
3131
['cmdmap' => [
3232
'tt_content' => [
3333
1 => ['copyToLanguage' => 1],
3434
4 => ['copyToLanguage' => 1],
3535
],
36-
], 'Dataset2'],
36+
], 'dataset' => 'Dataset2'],
3737
];
3838
}
3939

Tests/Functional/Datahandler/Localization/LocalizeTest.php

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,24 @@ public function localizeChildKeepsRelationsIfContainerIsInConnectedMode(): void
212212
public static function localizeTwoContainerKeepsParentIndependedOnOrderDataProvider(): array
213213
{
214214
return [
215-
['cmdmap' => [
216-
'tt_content' => [
217-
91 => ['localize' => 1],
218-
1 => ['localize' => 1],
215+
[
216+
'cmdmap' => [
217+
'tt_content' => [
218+
91 => ['localize' => 1],
219+
1 => ['localize' => 1],
220+
],
219221
],
220-
], 'Dataset1'],
221-
['cmdmap' => [
222-
'tt_content' => [
223-
1 => ['localize' => 1],
224-
91 => ['localize' => 1],
222+
'dataset' => 'Dataset1',
223+
],
224+
[
225+
'cmdmap' => [
226+
'tt_content' => [
227+
1 => ['localize' => 1],
228+
91 => ['localize' => 1],
229+
],
225230
],
226-
], 'Dataset2'],
231+
'dataset' => 'Dataset2',
232+
],
227233
];
228234
}
229235

@@ -245,18 +251,24 @@ public function localizeTwoContainerKeepsParentIndependedOnOrder(array $cmdmap,
245251
public static function localizeWithCopyTwoContainerChangeParentIndependedOnOrderDataProvider(): array
246252
{
247253
return [
248-
['cmdmap' => [
249-
'tt_content' => [
250-
91 => ['copyToLanguage' => 1],
251-
1 => ['copyToLanguage' => 1],
254+
[
255+
'cmdmap' => [
256+
'tt_content' => [
257+
91 => ['copyToLanguage' => 1],
258+
1 => ['copyToLanguage' => 1],
259+
],
252260
],
253-
], 'Dataset1'],
254-
['cmdmap' => [
255-
'tt_content' => [
256-
1 => ['copyToLanguage' => 1],
257-
91 => ['copyToLanguage' => 1],
261+
'dataset' => 'Dataset1',
262+
],
263+
[
264+
'cmdmap' => [
265+
'tt_content' => [
266+
1 => ['copyToLanguage' => 1],
267+
91 => ['copyToLanguage' => 1],
268+
],
258269
],
259-
], 'Dataset2'],
270+
'dataset' => 'Dataset2',
271+
],
260272
];
261273
}
262274

Tests/Functional/Frontend/AbstractFrontend.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,25 @@
1111
*/
1212

1313
use Psr\Http\Message\ResponseInterface;
14+
use TYPO3\CMS\Core\Cache\Backend\NullBackend;
1415
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
1516
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext;
1617
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
1718

1819
abstract class AbstractFrontend extends FunctionalTestCase
1920
{
21+
protected array $configurationToUseInTestInstance = [
22+
'SYS' => [
23+
'caching' => [
24+
'cacheConfigurations' => [
25+
'fluid_template' => [
26+
'backend' => NullBackend::class,
27+
],
28+
],
29+
],
30+
],
31+
];
32+
2033
/**
2134
* @var non-empty-string[]
2235
*/

Tests/Functional/Integrity/IntegrityTest.php

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use B13\Container\Integrity\Error\WrongPidError;
1616
use B13\Container\Integrity\Integrity;
1717
use B13\Container\Integrity\IntegrityFix;
18+
use TYPO3\CMS\Backend\Context\PageContext;
19+
use TYPO3\CMS\Backend\Domain\Model\Language\PageLanguageInformation;
1820
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout;
1921
use TYPO3\CMS\Backend\View\BackendLayout\ContentFetcher;
2022
use TYPO3\CMS\Backend\View\Drawing\DrawingConfiguration;
@@ -25,6 +27,7 @@
2527
use TYPO3\CMS\Core\Information\Typo3Version;
2628
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
2729
use TYPO3\CMS\Core\Site\Entity\Site;
30+
use TYPO3\CMS\Core\Type\Bitmask\Permission;
2831
use TYPO3\CMS\Core\Utility\GeneralUtility;
2932
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
3033

@@ -86,14 +89,43 @@ public function wrongPidErrorElementsAreShownAsUnusedElements(): void
8689
->fetchAssociative();
8790
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 12) {
8891
$pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout);
92+
$contentFetcher = new ContentFetcher($pageLayoutContext);
93+
$unusedRecords = $contentFetcher->getUnusedRecords();
8994
} else {
9095
$site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
9196
$drawingConfiguration = $this->getMockBuilder(DrawingConfiguration::class)->disableOriginalConstructor()->getMock();
9297
$serverRequest = $this->getMockBuilder(ServerRequest::class)->disableOriginalConstructor()->getMock();
93-
$pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest);
98+
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 14) {
99+
$pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest);
100+
$contentFetcher = new ContentFetcher($pageLayoutContext);
101+
$unusedRecords = $contentFetcher->getUnusedRecords();
102+
} else {
103+
$pageLanguageInformation = new PageLanguageInformation(
104+
$pageRecord['uid'],
105+
[],
106+
[],
107+
[],
108+
[0],
109+
false,
110+
[]
111+
);
112+
$pageContext = new PageContext(
113+
$pageRecord['uid'],
114+
$pageRecord,
115+
$site,
116+
[],
117+
[],
118+
[],
119+
$pageLanguageInformation,
120+
new Permission()
121+
);
122+
$pageLayoutContext = new PageLayoutContext($pageContext, $backendLayout, $drawingConfiguration, $serverRequest);
123+
$container = $this->get('service_container');
124+
$contentFetcher = $container->get(ContentFetcher::class);
125+
$unusedRecords = $contentFetcher->getUnusedRecords($pageLayoutContext);
126+
}
94127
}
95-
$contentFetcher = new ContentFetcher($pageLayoutContext);
96-
$unusedRecords = $contentFetcher->getUnusedRecords();
128+
97129
$unusedRecordsArr = [];
98130
foreach ($unusedRecords as $unusedRecord) {
99131
$unusedRecordsArr[] = $unusedRecord;

0 commit comments

Comments
 (0)