diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 293e12ce..626c9793 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -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 @@ -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} @@ -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 @@ -502,7 +523,12 @@ 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=$? ;; @@ -510,7 +536,12 @@ case ${TEST_SUITE} in ${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=$? ;; @@ -518,14 +549,24 @@ case ${TEST_SUITE} in ${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=$? ;; diff --git a/Build/phpstan-baseline-11-7.4.neon b/Build/phpstan-baseline-11-7.4.neon index 7abb344d..ca39e44e 100644 --- a/Build/phpstan-baseline-11-7.4.neon +++ b/Build/phpstan-baseline-11-7.4.neon @@ -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 diff --git a/Build/phpstan-baseline-11.neon b/Build/phpstan-baseline-11.neon index 6acd4ac7..89d06bde 100644 --- a/Build/phpstan-baseline-11.neon +++ b/Build/phpstan-baseline-11.neon @@ -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 diff --git a/Build/phpstan-baseline-12.neon b/Build/phpstan-baseline-12.neon index fccfb1af..075d14a6 100644 --- a/Build/phpstan-baseline-12.neon +++ b/Build/phpstan-baseline-12.neon @@ -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 diff --git a/Build/phpstan-baseline-13.neon b/Build/phpstan-baseline-13.neon index cef61e08..123b0cfc 100644 --- a/Build/phpstan-baseline-13.neon +++ b/Build/phpstan-baseline-13.neon @@ -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 diff --git a/Tests/Acceptance/Support/BackendTester.php b/Tests/Acceptance/Support/BackendTester.php index 6458f627..6a18e306 100644 --- a/Tests/Acceptance/Support/BackendTester.php +++ b/Tests/Acceptance/Support/BackendTester.php @@ -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', diff --git a/Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php b/Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php index 79c0f3a8..d903e375 100644 --- a/Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php +++ b/Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php @@ -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', @@ -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 = "get(\TYPO3\CMS\Backend\Http\Application::class)->run(); -});"; - $instancePath = ORIGINAL_ROOT . 'typo3temp/var/tests/acceptance'; - file_put_contents($instancePath . '/typo3/index.php', $content); - } } diff --git a/Tests/codeception.yml b/Tests/codeception.yml index 8ee4f031..0bb39cb1 100644 --- a/Tests/codeception.yml +++ b/Tests/codeception.yml @@ -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"] diff --git a/Tests/parameters.yml b/Tests/parameters.yml index f9f3cdc6..438ada0b 100644 --- a/Tests/parameters.yml +++ b/Tests/parameters.yml @@ -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/ \ No newline at end of file +typo3TestingAcceptanceBaseUrl: http://web:80 \ No newline at end of file diff --git a/composer.json b/composer.json index 70091fb3..0c39a16d 100644 --- a/composer.json +++ b/composer.json @@ -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",