Skip to content

Commit 79a7448

Browse files
authored
[TASK] Enable functional tests
2 parents c4be1e7 + 2cfacad commit 79a7448

File tree

14 files changed

+172
-119
lines changed

14 files changed

+172
-119
lines changed

.github/workflows/core13.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ jobs:
3030
- name: Unit Tests
3131
run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -s unit
3232

33-
# - name: Functional Tests with mariadb and mysqli
34-
# run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mariadb -a mysqli -s functional
35-
#
36-
# - name: Functional Tests with mariadb and pdo_mysql
37-
# run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mariadb -a pdo_mysql -s functional
38-
#
39-
# - name: Functional Tests with mysql and mysqli
40-
# run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mysql -a mysqli -s functional
41-
#
42-
# - name: Functional Tests with mysql and pdo_mysql
43-
# run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mysql -a pdo_mysql -s functional
44-
#
45-
# - name: Functional Tests with postgres
46-
# run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d postgres -s functional
33+
- name: Functional Tests with mariadb and mysqli
34+
run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mariadb -a mysqli -s functional
35+
36+
- name: Functional Tests with mariadb and pdo_mysql
37+
run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mariadb -a pdo_mysql -s functional
38+
39+
- name: Functional Tests with mysql and mysqli
40+
run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mysql -a mysqli -s functional
41+
42+
- name: Functional Tests with mysql and pdo_mysql
43+
run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mysql -a pdo_mysql -s functional
44+
45+
- name: Functional Tests with postgres
46+
run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d postgres -s functional
4747

4848
# @todo disabled, due cross dbmns issues in code. Should be fixed first
4949
# - name: Functional Tests with sqlite

.github/workflows/core14.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ jobs:
3030
- name: Unit Tests
3131
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s unit
3232

33-
# - name: Functional Tests with mariadb and mysqli
34-
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a mysqli -s functional
35-
#
36-
# - name: Functional Tests with mariadb and pdo_mysql
37-
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a pdo_mysql -s functional
38-
#
39-
# - name: Functional Tests with mysql and mysqli
40-
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a mysqli -s functional
41-
#
42-
# - name: Functional Tests with mysql and pdo_mysql
43-
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a pdo_mysql -s functional
44-
#
45-
# - name: Functional Tests with postgres
46-
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d postgres -s functional
33+
- name: Functional Tests with mariadb and mysqli
34+
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a mysqli -s functional
35+
36+
- name: Functional Tests with mariadb and pdo_mysql
37+
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a pdo_mysql -s functional
38+
39+
- name: Functional Tests with mysql and mysqli
40+
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a mysqli -s functional
41+
42+
- name: Functional Tests with mysql and pdo_mysql
43+
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a pdo_mysql -s functional
44+
45+
- name: Functional Tests with postgres
46+
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d postgres -s functional
4747

4848
# @todo disabled, due cross dbmns issues in code. Should be fixed first
4949
# - name: Functional Tests with sqlite

Build/Scripts/runTests.sh

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ Options:
170170
- composerInstallHighest: "composer update", handy if host has no PHP
171171
- coveralls: Generate coverage
172172
- docsGenerate: Renders the extension ReST documentation.
173+
- rector: Run rector
174+
- fractor: Run Fractor
173175
- functional: functional tests
174176
- lint: PHP linting
175177
- unit: PHP unit tests
@@ -222,20 +224,18 @@ Options:
222224
- 15 maintained until 2027-11-11
223225
- 16 maintained until 2028-11-09
224226
225-
-t <12|13|14>
227+
-t <13|14>
226228
Only with -s composerInstall|composerInstallMin|composerInstallMax
227229
Specifies the TYPO3 CORE Version to be used
228-
- 12: use TYPO3 v12 (default)
229-
- 13: use TYPO3 v13
230+
- 13: use TYPO3 v13 (default)
230231
- 14: use TYPO3 v14
231232
232-
-p <8.2|8.3|8.4>
233+
-p <8.2|8.3|8.4|8.5>
233234
Specifies the PHP minor version to be used
234-
- 8.0: use PHP 8.0 (default)
235-
- 8.1: use PHP 8.1
236235
- 8.2: use PHP 8.2
237236
- 8.3: use PHP 8.3
238237
- 8.4: use PHP 8.4
238+
- 8.5: use PHP 8.5
239239
240240
-e "<phpunit options>"
241241
Only with -s docsGenerate|functional|unit
@@ -260,7 +260,7 @@ Options:
260260
is not listening on default port.
261261
262262
-n
263-
Only with -s cgl|composerNormalize
263+
Only with -s cgl|composerNormalize|fractor
264264
Activate dry-run in CGL check that does not actively change files and only prints broken ones.
265265
266266
-u
@@ -272,14 +272,14 @@ Options:
272272
Show this help.
273273
274274
Examples:
275-
# Run all core unit tests using PHP 7.4
275+
# Run all core unit tests
276276
./Build/Scripts/runTests.sh -s unit
277277
278278
# Run all core units tests and enable xdebug (have a PhpStorm listening on port 9003!)
279279
./Build/Scripts/runTests.sh -x -s unit
280280
281-
# Run unit tests in phpunit verbose mode with xdebug on PHP 8.1 and filter for test canRetrieveValueWithGP
282-
./Build/Scripts/runTests.sh -x -p 8.1 -- --filter 'classCanBeRegistered'
281+
# Run unit tests in phpunit verbose mode with xdebug on PHP 8.2 and filter for test canRetrieveValueWithGP
282+
./Build/Scripts/runTests.sh -x -p 8.2 -- --filter 'classCanBeRegistered'
283283
284284
# Run functional tests in phpunit with a filtered test method name in a specified file
285285
# example will currently execute two tests, both of which start with the search term
@@ -309,22 +309,22 @@ ROOT_DIR="${PWD}"
309309
# Option defaults
310310
TEST_SUITE=""
311311
TYPO3_VERSION="13"
312-
DBMS="mysql"
312+
DBMS="sqlite"
313313
DBMS_VERSION=""
314314
PHP_VERSION="8.2"
315315
PHP_XDEBUG_ON=0
316316
PHP_XDEBUG_PORT=9003
317317
EXTRA_TEST_OPTIONS=""
318-
CGLCHECK_DRY_RUN=0
318+
DRY_RUN=0
319319
DATABASE_DRIVER=""
320320
CONTAINER_BIN=""
321-
COMPOSER_ROOT_VERSION="12.0.0-dev"
321+
COMPOSER_ROOT_VERSION="13.0.0-dev"
322322
CONTAINER_INTERACTIVE="-it --init"
323323
HOST_UID=$(id -u)
324324
HOST_PID=$(id -g)
325325
USERSET=""
326326
SUFFIX=$(echo $RANDOM)
327-
NETWORK="friendsoftypo3-tea-${SUFFIX}"
327+
NETWORK="friendsoftypo3-ttaddress-${SUFFIX}"
328328
CI_PARAMS="${CI_PARAMS:-}"
329329
CONTAINER_HOST="host.docker.internal"
330330
PHPSTAN_CONFIG_FILE="phpstan.neon"
@@ -358,7 +358,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do
358358
;;
359359
p)
360360
PHP_VERSION=${OPTARG}
361-
if ! [[ ${PHP_VERSION} =~ ^(8.1|8.2|8.3|8.4)$ ]]; then
361+
if ! [[ ${PHP_VERSION} =~ ^(8.2|8.3|8.4|8.5)$ ]]; then
362362
INVALID_OPTIONS+=("-p ${OPTARG}")
363363
fi
364364
;;
@@ -367,7 +367,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do
367367
;;
368368
t)
369369
TYPO3_VERSION=${OPTARG}
370-
if ! [[ ${TYPO3_VERSION} =~ ^(12|13|14)$ ]]; then
370+
if ! [[ ${TYPO3_VERSION} =~ ^(13|14)$ ]]; then
371371
INVALID_OPTIONS+=("-t ${OPTARG}")
372372
fi
373373
;;
@@ -378,7 +378,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do
378378
PHP_XDEBUG_PORT=${OPTARG}
379379
;;
380380
n)
381-
CGLCHECK_DRY_RUN=1
381+
DRY_RUN=1
382382
;;
383383
h)
384384
loadHelp
@@ -471,7 +471,7 @@ fi
471471
case ${TEST_SUITE} in
472472
cgl)
473473
DRY_RUN_OPTIONS=''
474-
if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then
474+
if [ "${DRY_RUN}" -eq 1 ]; then
475475
DRY_RUN_OPTIONS='--dry-run --diff'
476476
fi
477477
COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v ${DRY_RUN_OPTIONS} --config=Build/php-cs-fixer/php-cs-fixer.php --using-cache=no"
@@ -505,10 +505,6 @@ case ${TEST_SUITE} in
505505
cleanComposer
506506
stashComposerFiles
507507
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-highest-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/bash -c "
508-
if [ ${TYPO3_VERSION} -eq 12 ]; then
509-
composer require --no-ansi --no-interaction --no-progress --no-install \
510-
typo3/cms-core:^12.4.28 || exit 1
511-
fi
512508
if [ ${TYPO3_VERSION} -eq 13 ]; then
513509
composer require --no-ansi --no-interaction --no-progress --no-install \
514510
typo3/cms-core:^13.4 || exit 1
@@ -532,13 +528,9 @@ case ${TEST_SUITE} in
532528
cleanComposer
533529
stashComposerFiles
534530
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-lowest-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/bash -c "
535-
if [ ${TYPO3_VERSION} -eq 12 ]; then
536-
composer require --no-ansi --no-interaction --no-progress --no-install \
537-
typo3/cms-core:^12.4.28 || exit 1
538-
fi
539531
if [ ${TYPO3_VERSION} -eq 13 ]; then
540532
composer require --no-ansi --no-interaction --no-progress --no-install \
541-
typo3/cms-core:^13.4.17 || exit 1
533+
typo3/cms-core:^13.4.20 || exit 1
542534
fi
543535
if [ ${TYPO3_VERSION} -eq 14 ]; then
544536
composer config minimum-stability dev
@@ -607,6 +599,24 @@ case ${TEST_SUITE} in
607599
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-command-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/bash -c "${COMMAND}"
608600
SUITE_EXIT_CODE=$?
609601
;;
602+
rector)
603+
DRY_RUN_OPTIONS=''
604+
if [ "${DRY_RUN}" -eq 1 ]; then
605+
DRY_RUN_OPTIONS='--dry-run'
606+
fi
607+
COMMAND="php -dxdebug.mode=off .Build/bin/rector process ${DRY_RUN_OPTIONS} --config=Build/rector/rector.php --no-progress-bar --ansi"
608+
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-command-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c "${COMMAND}"
609+
SUITE_EXIT_CODE=$?
610+
;;
611+
fractor)
612+
DRY_RUN_OPTIONS=''
613+
if [ "${DRY_RUN}" -eq 1 ]; then
614+
DRY_RUN_OPTIONS='--dry-run'
615+
fi
616+
COMMAND="php -dxdebug.mode=off .Build/bin/fractor process ${DRY_RUN_OPTIONS} --config=Build/fractor/fractor.php --ansi"
617+
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-command-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c "${COMMAND}"
618+
SUITE_EXIT_CODE=$?
619+
;;
610620
unit)
611621
COMMAND=(.Build/bin/phpunit -c Build/phpunit/UnitTests.xml --exclude-group not-${DBMS} ${EXTRA_TEST_OPTIONS} "$@")
612622
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name unit-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_PHP} "${COMMAND[@]}"

Build/phpunit/FunctionalTestsBootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* The TYPO3 project - inspiring people to share!
1414
*/
1515

16+
use TYPO3\TestingFramework\Core\Testbase;
17+
1618
/**
1719
* Boilerplate for a functional test phpunit boostrap file.
1820
*
@@ -24,7 +26,7 @@
2426
* before instantiating the test suites.
2527
*/
2628
(static function () {
27-
$testbase = new \TYPO3\TestingFramework\Core\Testbase();
29+
$testbase = new Testbase();
2830
$testbase->defineOriginalRootPath();
2931
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/tests');
3032
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/transient');

Classes/Domain/Repository/AddressRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function createDemandQuery(Demand $demand): QueryInterface
5959
}
6060

6161
$constraints = [];
62-
$pages = $demand->getPages();
62+
$pages = array_map('intval', array_filter($demand->getPages(), 'is_numeric'));
6363
if (!empty($pages)) {
6464
$constraints['pages'] = $query->in('pid', $pages);
6565
}
@@ -109,7 +109,7 @@ public function getSqlQuery(Demand $demand): string
109109
$params = [];
110110
foreach ($queryParameters as $key => $value) {
111111
// prefix array keys with ':'
112-
$params[':' . $key] = (\is_numeric($value)) ? $value : "'" . $value . "'"; // all non numeric values have to be quoted
112+
$params[':' . $key] = "'" . $value . "'";
113113
unset($params[$key]);
114114
}
115115
// replace placeholders with real values

Classes/FormEngine/TtAddressPreviewRenderer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ protected function enrichRow(array $row): array
8080
$records = $this->getRecords($fieldConfiguration['table'], $settings['settings'][$fieldName]);
8181

8282
if ($fieldConfiguration['multiValue']) {
83-
$row['_computed'][$fieldName] = $records;
83+
$row['computed'][$fieldName] = $records;
8484
} else {
85-
$row['_computed'][$fieldName] = $records[0] ?: [];
85+
$row['computed'][$fieldName] = $records[0] ?: [];
8686
}
8787
}
8888
}
89-
$row['_computed']['lll'] = 'LLL:EXT:tt_address/Resources/Private/Language/ff/locallang_ff.xlf:pi1_flexform.';
89+
$row['computed']['lll'] = 'LLL:EXT:tt_address/Resources/Private/Language/ff/locallang_ff.xlf:pi1_flexform.';
9090
return $row;
9191
}
9292

@@ -108,7 +108,7 @@ protected function getRecords(string $table, string $idList): array
108108
->fetchAllAssociative();
109109

110110
foreach ($rows as &$row) {
111-
$row['_computed']['title'] = BackendUtility::getRecordTitle($table, $row);
111+
$row['computed']['title'] = BackendUtility::getRecordTitle($table, $row);
112112
}
113113
return $rows;
114114
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() >= 14) {
4+
unset($GLOBALS['TCA']['tt_address']['ctrl']['searchFields']);
5+
}

Configuration/TCA/Overrides/tt_content.php

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,35 @@
22

33
defined('TYPO3') or die;
44

5-
$pluginSignature = \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
6-
'tt_address',
7-
'ListView',
8-
'LLL:EXT:tt_address/Resources/Private/Language/db/locallang.xlf:extbase_title',
9-
'tt-address-plugin',
10-
'plugins',
11-
'LLL:EXT:tt_address/Resources/Private/Language/db/locallang.xlf:extbase_description'
12-
);
13-
14-
$GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['previewRenderer'] = \FriendsOfTYPO3\TtAddress\FormEngine\TtAddressPreviewRenderer::class;
5+
if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() >= 14) {
6+
$pluginSignature = \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
7+
'tt_address',
8+
'ListView',
9+
'LLL:EXT:tt_address/Resources/Private/Language/db/locallang.xlf:extbase_title',
10+
'tt-address-plugin',
11+
'plugins',
12+
'LLL:EXT:tt_address/Resources/Private/Language/db/locallang.xlf:extbase_description',
13+
'FILE:EXT:tt_address/Configuration/FlexForms/List.xml'
14+
);
15+
} else {
16+
$pluginSignature = \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
17+
'tt_address',
18+
'ListView',
19+
'LLL:EXT:tt_address/Resources/Private/Language/db/locallang.xlf:extbase_title',
20+
'tt-address-plugin',
21+
'plugins',
22+
'LLL:EXT:tt_address/Resources/Private/Language/db/locallang.xlf:extbase_description'
23+
);
24+
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('*', 'FILE:EXT:tt_address/Configuration/FlexForms/List.xml', $pluginSignature);
25+
}
1526

16-
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key,pages,recursive';
17-
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
18-
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('*', 'FILE:EXT:tt_address/Configuration/FlexForms/List.xml', $pluginSignature);
1927
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
2028
'tt_content',
2129
'--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin, pi_flexform',
2230
$pluginSignature,
2331
'after:palette:headers'
2432
);
33+
34+
$GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['previewRenderer'] = \FriendsOfTYPO3\TtAddress\FormEngine\TtAddressPreviewRenderer::class;
35+
2536
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToInsertRecords('tt_address');

0 commit comments

Comments
 (0)