Skip to content

Commit

Permalink
[TASK] Run deprecated functional tests with phpunit 10
Browse files Browse the repository at this point in the history
Functional deprecated tests are quite easy to fix
for phpunit 10: Just some static data providers.

We do the same as with "casual" functional tests:
Temporarily allowing execution with phpunit 10
in runTests.sh in addition to phpunit 9, plus
CI addition.

Resolves: #100507
Related: #100249
Releases: main
Change-Id: I31e012c558214b55ba24cbd311f918ef54ab0111
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78513
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
lolli42 committed Apr 6, 2023
1 parent a56ff07 commit 579d89e
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Build/Scripts/runTests.sh
Expand Up @@ -806,6 +806,28 @@ case ${TEST_SUITE} in
esac
docker-compose down
;;
functionalDeprecated10)
handleDbmsAndDriverOptions
setUpDockerComposeDotEnv
case ${DBMS} in
sqlite)
# sqlite has a tmpfs as typo3temp/var/tests/functional-sqlite-dbs/
# Since docker is executed as root (yay!), the path to this dir is owned by
# root if docker creates it. Thank you, docker. We create the path beforehand
# to avoid permission issues on host filesystem after execution.
mkdir -p "${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/"
docker-compose run prepare_functional_sqlite
docker-compose run functional_deprecated_sqlite10
SUITE_EXIT_CODE=$?
;;
*)
echo "Deprecated functional tests don't run with DBMS ${DBMS}" >&2
echo >&2
echo "call \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
esac
docker-compose down
;;
lintPhp)
setUpDockerComposeDotEnv
docker-compose run lint_php
Expand Down
16 changes: 16 additions & 0 deletions Build/gitlab-ci/nightly/functional.yml
Expand Up @@ -224,3 +224,19 @@ functional sqlite php 8.1 phpunit 10:
script:
- Build/Scripts/runTests.sh -s composerInstall -p 8.1
- Build/Scripts/runTests.sh -s functional10 -d sqlite -p 8.1 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
functional deprecated sqlite php 8.2 phpunit 10:
stage: functional
needs: []
only:
- schedules
script:
- Build/Scripts/runTests.sh -s composerInstall -p 8.2
- Build/Scripts/runTests.sh -s functionalDeprecated10 -d sqlite -p 8.2
functional deprecated sqlite php 8.1 phpunit 10:
stage: functional
needs: []
only:
- schedules
script:
- Build/Scripts/runTests.sh -s composerInstall -p 8.1
- Build/Scripts/runTests.sh -s functionalDeprecated10 -d sqlite -p 8.1
10 changes: 10 additions & 0 deletions Build/gitlab-ci/pre-merge/functional.yml
Expand Up @@ -61,3 +61,13 @@ functional sqlite php 8.1 phpunit 10 pre-merge:
script:
- Build/Scripts/runTests.sh -s composerInstall -p 8.1
- Build/Scripts/runTests.sh -s functional10 -d sqlite -p 8.1 -c $CI_NODE_INDEX/$CI_NODE_TOTAL

functional deprecated sqlite 10 php 8.1 phpunit 10 pre-merge:
stage: main
except:
refs:
- schedules
- main
script:
- Build/Scripts/runTests.sh -s composerInstall -p 8.1
- Build/Scripts/runTests.sh -s functionalDeprecated10 -d sqlite -p 8.1
36 changes: 36 additions & 0 deletions Build/phpunit/FunctionalTestsDeprecated-10.xml
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!--
Functional test suite setup
Functional tests should extend \TYPO3\TestingFramework\Core\Tests\FunctionalTestCase,
take a look at this class for further documentation on how to run the suite.
TYPO3 CMS functional test suite also needs phpunit bootstrap code, the
file is located next to this .xml as FunctionalTestsBootstrap.php
The recommended way to execute the suite is "runTests.sh -s functional"
execute "Build/Scripts/runTests.sh -h" for more details.
-->
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
backupGlobals="true"
bootstrap="FunctionalTestsBootstrap.php"
cacheResult="false"
colors="true"
beStrictAboutTestsThatDoNotTestAnything="false"
failOnWarning="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Core tests">
<directory>../../typo3/sysext/*/Tests/FunctionalDeprecated/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="E_ALL"/>
<env name="TYPO3_CONTEXT" value="Testing"/>
</php>
</phpunit>
34 changes: 34 additions & 0 deletions Build/testing-docker/local/docker-compose.yml
Expand Up @@ -1202,6 +1202,40 @@ services:
fi
"
functional_deprecated_sqlite10:
image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest
user: "${HOST_UID}"
tmpfs:
- ${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid,uid=${HOST_UID}
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
environment:
COMPOSER_CACHE_DIR: ".cache/composer"
typo3DatabaseDriver: pdo_sqlite
typo3TestingRedisHost: redis4
typo3TestingMemcachedHost: memcached1-5
working_dir: ${CORE_ROOT}
extra_hosts:
- "host.docker.internal:host-gateway"
command: >
/bin/sh -c "
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
php -v | grep '^PHP'
composer req --dev --no-progress --no-interaction phpunit/phpunit:^10 -w
composer req --dev --no-progress --no-interaction typo3/testing-framework:dev-lolli-1
COMMAND=\"vendor/phpunit/phpunit/phpunit -c Build/phpunit/FunctionalTestsDeprecated-10.xml ${EXTRA_TEST_OPTIONS} --exclude-group not-sqlite ${TEST_FILE}\"
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
XDEBUG_MODE=\"off\" $${COMMAND};
else
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal\" \
$${COMMAND};
fi
"
lint_php:
image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest
user: "${HOST_UID}"
Expand Down
Expand Up @@ -355,7 +355,7 @@ public function usingTSFEInATestInBeContextIsAlwaysFalse(): void
self::assertFalse($subject->match('[getTSFE().id == 1]'));
}

public function determinePageIdFindIdFromQueryParametersDataProvider(): array
public static function determinePageIdFindIdFromQueryParametersDataProvider(): array
{
return [
'Page ID from "id" parameter' => [
Expand Down
Expand Up @@ -35,7 +35,7 @@ protected function setUp(): void
}
}

public function isRenderedDataProvider(): array
public static function isRenderedDataProvider(): array
{
return [
'#1' => [
Expand Down

0 comments on commit 579d89e

Please sign in to comment.