Skip to content

Commit

Permalink
[TASK] Adjust tests and update runTests.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ochorocho committed Nov 26, 2024
1 parent a9d19a4 commit 6ffe965
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 44 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- cron: '30 3 * * *'

jobs:

tests:
name: All tests
runs-on: ubuntu-20.04
Expand Down
44 changes: 22 additions & 22 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

# Function to write a .env file in Build/testing-docker
# This is read by docker-compose and vars defined here are
# This is read by "docker compose" and vars defined here are
# used in Build/testing-docker/docker-compose.yml
setUpDockerComposeDotEnv() {
# Delete possibly existing local .env file if exists
Expand All @@ -14,7 +14,7 @@ setUpDockerComposeDotEnv() {
{
echo "COMPOSE_PROJECT_NAME=local"
# To prevent access rights of files created by the testing, the docker image later
# runs with the same user that is currently executing the script. docker-compose can't
# runs with the same user that is currently executing the script. "docker compose" can't
# use $UID directly itself since it is a shell variable and not an env variable, so
# we have to set it explicitly here.
echo "HOST_UID=`id -u`"
Expand Down Expand Up @@ -115,8 +115,8 @@ Examples:
EOF

# Test if docker-compose exists, else exit out with error
if ! type "docker-compose" > /dev/null; then
echo "This script relies on docker and docker-compose. Please install" >&2
if ! type "docker" > /dev/null; then
echo "This script relies on docker. Please install" >&2
exit 1
fi

Expand Down Expand Up @@ -233,46 +233,46 @@ fi
case ${TEST_SUITE} in
acceptance)
setUpDockerComposeDotEnv
docker-compose run acceptance_backend_mariadb10
docker compose run acceptance_backend_mariadb10
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
cgl)
# Active dry-run for cgl needs not "-n" but specific options
if [ -n "${CGLCHECK_DRY_RUN}" ]; then
CGLCHECK_DRY_RUN="--dry-run --diff"
fi
setUpDockerComposeDotEnv
docker-compose run cgl
docker compose run cgl
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
composerUpdate)
setUpDockerComposeDotEnv
docker-compose run composer_update
docker compose run composer_update
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
composerValidate)
setUpDockerComposeDotEnv
docker-compose run composer_validate
docker compose run composer_validate
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
functional)
setUpDockerComposeDotEnv
case ${DBMS} in
mariadb)
docker-compose run functional_mariadb10
docker compose run functional_mariadb10
SUITE_EXIT_CODE=$?
;;
postgres)
docker-compose run functional_postgres10
docker compose run functional_postgres10
SUITE_EXIT_CODE=$?
;;
sqlite)
mkdir -p ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/functional-sqlite-dbs/
docker-compose run functional_sqlite
docker compose run functional_sqlite
SUITE_EXIT_CODE=$?
;;
*)
Expand All @@ -281,25 +281,25 @@ case ${TEST_SUITE} in
echo "${HELP}" >&2
exit 1
esac
docker-compose down
docker compose down
;;
lint)
setUpDockerComposeDotEnv
docker-compose run lint
docker compose run lint
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
phpstan)
setUpDockerComposeDotEnv
docker-compose run phpstan
docker compose run phpstan
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
unit)
setUpDockerComposeDotEnv
docker-compose run unit
docker compose run unit
SUITE_EXIT_CODE=$?
docker-compose down
docker compose down
;;
update)
# pull typo3/core-testing-*:latest versions of those ones that exist locally
Expand Down
57 changes: 57 additions & 0 deletions Build/php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,61 @@

$config = \TYPO3\CodingStandards\CsFixerConfig::create();
$config->getFinder()->in('./')->exclude(['var', '.Build']);

$config->setRules([
'@DoctrineAnnotation' => true,
'@PER-CS' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
'type_declaration_spaces' => true,
'lowercase_cast' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'modernize_strpos' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_parentheses' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_nullsafe_operator' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
'single_trait_insert_per_statement' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
]);

return $config;
16 changes: 1 addition & 15 deletions Build/testing-docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2.3'
services:
chrome:
# Image for Mac M1
Expand Down Expand Up @@ -106,25 +105,12 @@ services:
set -x
fi
php -v | grep '^PHP';
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
php -dxdebug.mode=off \
.Build/bin/php-cs-fixer fix \
-v \
${CGLCHECK_DRY_RUN} \
--config=Build/php-cs-fixer.php \
--using-cache=no .
else
DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'`
XDEBUG_MODE=\"debug,develop\" \
XDEBUG_TRIGGER=\"foo\" \
XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \
PHP_CS_FIXER_ALLOW_XDEBUG=1 \
.Build/bin/php-cs-fixer fix \
-v \
${CGLCHECK_DRY_RUN} \
--config=Build/php-cs-fixer.php \
--using-cache=no .
fi
.Build/bin/php-cs-fixer fix -v --config=Build/php-cs-fixer.php --using-cache=no .
"
composer_update:
Expand Down
5 changes: 2 additions & 3 deletions Tests/Acceptance/Backend/PluginFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ public function seeOverrideTemplateOptions(BackendTester $I): void

$I->amGoingTo('See a list of expected email template pages in select of form plugin override');
$actual = $I->grabMultiple('//label[contains(text(),"Select email template")]/following-sibling::div//select//option');
$I->assertStringContainsString('Default', $actual[0]);
$I->assertStringContainsString('Contact template', $actual[1]);
$I->assertStringContainsString('Shopping cart template', $actual[2]);
$I->assertStringContainsString('Contact template', $actual[0]);
$I->assertStringContainsString('Shopping cart template', $actual[1]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class BackendFormCustomTemplatesEnvironment extends BackendEnvironment
],
],
'pathsToLinkInTestInstance' => [
'typo3conf/ext/form_custom_templates/Tests/Acceptance/Fixtures/sites' =>
'typo3conf/sites',
'typo3conf/ext/form_custom_templates/Tests/Acceptance/Fixtures/sites' =>
'typo3conf/sites',
],
];

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typo3/cms-frontend": "^11.5 || ^12.3",
"typo3/cms-install": "^11.5 || ^12.3",
"typo3/cms-filelist": "^11.5 || ^12.3",
"typo3/cms-core": "^11.5 || ^12.3"
"typo3/cms-core": "^12.4"
},
"require-dev": {
"codeception/codeception": "^5.1",
Expand Down

0 comments on commit 6ffe965

Please sign in to comment.