Skip to content
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
55 changes: 48 additions & 7 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ USERSET=""
SUFFIX=$(echo $RANDOM)
NETWORK="b13-container-${SUFFIX}"
PHPUNIT_EXCLUDE_GROUPS="${PHPUNIT_EXCLUDE_GROUPS:-}"
# @todo Remove USE_APACHE option when TF7 has been dropped (along with TYPO3 v11 support).
USE_APACHE=0

# Option parsing updates above default vars
# Reset in case getopts has been used previously in the shell
Expand Down Expand Up @@ -338,6 +340,8 @@ while getopts "a:b:s:d:i:t:p:xy:o:nhug" OPT; do
if ! [[ ${TYPO3} =~ ^(11|12|13)$ ]]; then
INVALID_OPTIONS+=("${OPTARG}")
fi
# @todo Remove USE_APACHE option when TF7 has been dropped (along with TYPO3 v11 support).
[[ "${TYPO3}" -eq 13 ]] && USE_APACHE=1
;;
p)
PHP_VERSION=${OPTARG}
Expand Down Expand Up @@ -481,17 +485,34 @@ case ${TEST_SUITE} in
if [ "${ACCEPTANCE_HEADLESS}" -eq 0 ]; then
SELENIUM_GRID="-p 7900:7900 -e SE_VNC_NO_PASSWORD=1 -e VNC_NO_PASSWORD=1"
fi
APACHE_OPTIONS="-e APACHE_RUN_USER=#${HOST_UID} -e APACHE_RUN_SERVERNAME=web -e APACHE_RUN_GROUP=#${HOST_PID} -e APACHE_RUN_DOCROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e PHPFPM_HOST=phpfpm -e PHPFPM_PORT=9000 -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance"
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d ${SELENIUM_GRID} --name ac-chrome-${SUFFIX} --network ${NETWORK} --network-alias chrome --tmpfs /dev/shm:rw,nosuid,nodev,noexec ${IMAGE_SELENIUM} >/dev/null
if [ ${CONTAINER_BIN} = "docker" ]; then
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web --add-host "${CONTAINER_HOST}:host-gateway" ${USERSET} -v ${CORE_ROOT}:${CORE_ROOT} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance ${IMAGE_PHP} php -S web:8000 -t ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance >/dev/null
if [[ "${USE_APACHE}" -eq 1 ]]; then
${CONTAINER_BIN} run --rm -d --name ac-phpfpm-${SUFFIX} --network ${NETWORK} --network-alias phpfpm --add-host "${CONTAINER_HOST}:host-gateway" ${USERSET} -e PHPFPM_USER=${HOST_UID} -e PHPFPM_GROUP=${HOST_PID} -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -v ${CORE_ROOT}:${CORE_ROOT} ${IMAGE_PHP} php-fpm ${PHP_FPM_OPTIONS} >/dev/null
${CONTAINER_BIN} run --rm -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web --add-host "${CONTAINER_HOST}:host-gateway" -v ${CORE_ROOT}:${CORE_ROOT} ${APACHE_OPTIONS} ${IMAGE_APACHE} >/dev/null
else
# @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web --add-host "${CONTAINER_HOST}:host-gateway" ${USERSET} -v ${CORE_ROOT}:${CORE_ROOT} ${XDEBUG_MODE} -e typo3TestingAcceptanceBaseUrl=http://web:8000/ -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance ${IMAGE_PHP} php -S web:8000 -t ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance >/dev/null
fi
else
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web -v ${CORE_ROOT}:${CORE_ROOT} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance ${IMAGE_PHP} php -S web:8000 -t ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance >/dev/null
if [[ "${USE_APACHE}" -eq 1 ]]; then
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-phpfpm-${SUFFIX} --network ${NETWORK} --network-alias phpfpm ${USERSET} -e PHPFPM_USER=0 -e PHPFPM_GROUP=0 -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -v ${CORE_ROOT}:${CORE_ROOT} ${IMAGE_PHP} php-fpm -R ${PHP_FPM_OPTIONS} >/dev/null
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web -v ${CORE_ROOT}:${CORE_ROOT} ${APACHE_OPTIONS} ${IMAGE_APACHE} >/dev/null
else
# @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web -v ${CORE_ROOT}:${CORE_ROOT} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" -e typo3TestingAcceptanceBaseUrl=http://web:8000/ -e TYPO3_PATH_ROOT=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance ${IMAGE_PHP} php -S web:8000 -t ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance >/dev/null
fi
fi
waitFor chrome 4444
if [ "${ACCEPTANCE_HEADLESS}" -eq 0 ]; then
waitFor chrome 7900
fi
waitFor web 8000
if [[ "${USE_APACHE}" -eq 1 ]]; then
waitFor web 80
else
waitFor web 8000
fi
if [ "${ACCEPTANCE_HEADLESS}" -eq 0 ] && type "xdg-open" >/dev/null; then
xdg-open http://localhost:7900/?autoconnect=1 >/dev/null
elif [ "${ACCEPTANCE_HEADLESS}" -eq 0 ] && type "open" >/dev/null; then
Expand All @@ -502,30 +523,50 @@ case ${TEST_SUITE} in
${CONTAINER_BIN} run --rm ${CI_PARAMS} --name mariadb-ac-${SUFFIX} --network ${NETWORK} -d -e MYSQL_ROOT_PASSWORD=funcp --tmpfs /var/lib/mysql/:rw,noexec,nosuid ${IMAGE_MARIADB} >/dev/null
DATABASE_IP=$(${CONTAINER_BIN} inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb-ac-${SUFFIX})
waitFor mariadb-ac-${SUFFIX} 3306
CONTAINERPARAMS="-e typo3DatabaseName=func_test -e typo3DatabaseUsername=root -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP}"
if [[ "${USE_APACHE}" -eq 1 ]]; then
CONTAINERPARAMS="-e typo3DatabaseName=func_test -e typo3DatabaseUsername=root -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP}"
else
# @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
CONTAINERPARAMS="-e typo3DatabaseName=func_test -e typo3DatabaseUsername=root -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP} -e typo3TestingAcceptanceBaseUrl=http://web:8000"
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name ac-mariadb ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
;;
mysql)
${CONTAINER_BIN} run --rm ${CI_PARAMS} --name mysql-ac-${SUFFIX} --network ${NETWORK} -d -e MYSQL_ROOT_PASSWORD=funcp --tmpfs /var/lib/mysql/:rw,noexec,nosuid ${IMAGE_MYSQL} >/dev/null
DATABASE_IP=$(${CONTAINER_BIN} inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql-ac-${SUFFIX})
waitFor mysql-ac-${SUFFIX} 3306 2
CONTAINERPARAMS="-e typo3DatabaseName=func_test -e typo3DatabaseUsername=root -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP}"
if [[ "${USE_APACHE}" -eq 1 ]]; then
CONTAINERPARAMS="-e typo3DatabaseName=func_test -e typo3DatabaseUsername=root -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP}"
else
# @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
CONTAINERPARAMS="-e typo3DatabaseName=func_test -e typo3DatabaseUsername=root -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP} -e typo3TestingAcceptanceBaseUrl=http://web:8000"
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name ac-mysql ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
;;
postgres)
${CONTAINER_BIN} run --rm ${CI_PARAMS} --name postgres-ac-${SUFFIX} --network ${NETWORK} -d -e POSTGRES_PASSWORD=funcp -e POSTGRES_USER=funcu --tmpfs /var/lib/postgresql/data:rw,noexec,nosuid ${IMAGE_POSTGRES} >/dev/null
DATABASE_IP=$(${CONTAINER_BIN} inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' postgres-ac-${SUFFIX})
waitFor postgres-ac-${SUFFIX} 5432
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_pgsql -e typo3DatabaseName=func_test -e typo3DatabaseUsername=funcu -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP}"
if [[ "${USE_APACHE}" -eq 1 ]]; then
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_pgsql -e typo3DatabaseName=func_test -e typo3DatabaseUsername=funcu -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP}"
else
# @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_pgsql -e typo3DatabaseName=func_test -e typo3DatabaseUsername=funcu -e typo3DatabasePassword=funcp -e typo3DatabaseHost=${DATABASE_IP} -e typo3TestingAcceptanceBaseUrl=http://web:8000"
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name ac-postgres ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
;;
sqlite)
rm -rf "${CORE_ROOT}/typo3temp/var/tests/acceptance-sqlite-dbs/"
mkdir -p "${CORE_ROOT}/typo3temp/var/tests/acceptance-sqlite-dbs/"
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_sqlite"
if [[ "${USE_APACHE}" -eq 1 ]]; then
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_sqlite"
else
# @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_sqlite -e typo3TestingAcceptanceBaseUrl=http://web:8000"
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name ac-sqlite ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
;;
Expand Down
10 changes: 0 additions & 10 deletions Build/phpstan-baseline-11-7.4.neon
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ parameters:
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Call to an undefined static method TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Extension\\\\BackendEnvironment\\:\\:bootstrapTypo3Environment\\(\\)\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Constant ORIGINAL_ROOT not found\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
count: 1
Expand Down
10 changes: 0 additions & 10 deletions Build/phpstan-baseline-11.neon
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ parameters:
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Call to an undefined static method TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Extension\\\\BackendEnvironment\\:\\:bootstrapTypo3Environment\\(\\)\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Constant ORIGINAL_ROOT not found\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
count: 1
Expand Down
5 changes: 0 additions & 5 deletions Build/phpstan-baseline-12.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ parameters:
count: 1
path: ../Tests/Acceptance/Support/BackendTester.php

-
message: "#^Constant ORIGINAL_ROOT not found\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
count: 1
Expand Down
5 changes: 0 additions & 5 deletions Build/phpstan-baseline-13.neon
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ parameters:
count: 1
path: ../Tests/Acceptance/Support/BackendTester.php

-
message: "#^Constant ORIGINAL_ROOT not found\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
count: 1
Expand Down
6 changes: 3 additions & 3 deletions Tests/Acceptance/Support/BackendTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public function loginAs(string $username): void
{
$I = $this;
if ($I->loadSessionSnapshot($username . 'Login')) {
$I->amOnPage('/typo3/index.php');
$I->amOnPage('/typo3');
} else {
$I->amOnPage('/typo3/index.php');
$I->amOnPage('/typo3');
$I->waitForElement('body[data-typo3-login-ready]');
// logging in
$I->amOnPage('/typo3/index.php');
$I->amOnPage('/typo3');
$I->submitForm('#typo3-login-form', [
'username' => $username,
'p_field' => 'password',
Expand Down
28 changes: 5 additions & 23 deletions Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class BackendContainerEnvironment extends BackendEnvironment
'typo3conf/ext/container/Build/sites' => 'typo3conf/sites',
],
'testExtensionsToLoad' => [
'typo3conf/ext/container',
'typo3conf/ext/container_example',
'typo3conf/ext/content_defender',
'b13/container',
'b13/container-example',
'ichhabrecht/content-defender',
],
'csvDatabaseFixtures' => [
__DIR__ . '/../../Fixtures/be_users.csv',
Expand Down Expand Up @@ -72,28 +72,10 @@ public function _initialize(): void
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
if ($typo3Version->getMajorVersion() === 13) {
$this->localConfig['testExtensionsToLoad'] = [
'typo3conf/ext/container',
'typo3conf/ext/container_example',
'b13/container',
'b13/container-example',
];
}
parent::_initialize();
}

public function bootstrapTypo3Environment(SuiteEvent $suiteEvent): void
{
parent::bootstrapTypo3Environment($suiteEvent);
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
if ($typo3Version->getMajorVersion() < 13) {
return;
}
$content = "<?php

call_user_func(static function () {
\$classLoader = require __DIR__ . '/../../../../../..' . '/vendor/autoload.php';
\TYPO3\TestingFramework\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE);
\TYPO3\CMS\Core\Core\Bootstrap::init(\$classLoader)->get(\TYPO3\CMS\Backend\Http\Application::class)->run();
});";
$instancePath = ORIGINAL_ROOT . 'typo3temp/var/tests/acceptance';
file_put_contents($instancePath . '/typo3/index.php', $content);
}
}
2 changes: 1 addition & 1 deletion Tests/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ env:
config:
WebDriver:
path: /wd/hub
url: 'http://0.0.0.0:8888/'
url: 'http://0.0.0.0:80/'
capabilities:
goog:chromeOptions:
args: ["no-sandbox", "disable-gpu"]
Expand Down
3 changes: 1 addition & 2 deletions Tests/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
# These values can be overridden by environment variables,
# e.g. in Build/Scripts/runTest.sh
#
#typo3TestingAcceptanceBaseUrl: http://web:8000/typo3temp/var/tests/acceptance/
typo3TestingAcceptanceBaseUrl: http://web:8000/
typo3TestingAcceptanceBaseUrl: http://web:80
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"typo3/cms-fluid-styled-content": "^11.5 || ^12.4 || ^13.4",
"typo3/cms-info": "^11.5 || ^12.4 || ^13.4",
"typo3/cms-workspaces": "^11.5 || ^12.4 || ^13.4",
"typo3/testing-framework": "^7.0 || ^8.0",
"typo3/testing-framework": "^7.1.1 || ^8.2.7",
"phpstan/phpstan": "^1.10",
"typo3/coding-standards": "^0.5.5",
"friendsofphp/php-cs-fixer": "^3.51",
Expand Down