Skip to content

Commit b620436

Browse files
committed
feat(test): start service of only targeted php versions
1 parent 6959559 commit b620436

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tests/bin/test

+13-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
__DIR__=`dirname "$0"`
44
ROOT_DIR="${__DIR__}/../.."
55

6+
PHP_VERSIONS_SUPPORTED_PATTERN='(php74|php8)'
7+
68
main ()
79
{
810
importEnvironmentVariablesFromDirectory "${ROOT_DIR}"
@@ -11,8 +13,6 @@ main ()
1113

1214
startDockerComposeServices
1315

14-
populatePHPVersions
15-
1616
runTests
1717
}
1818

@@ -28,7 +28,7 @@ Usage:
2828
2929
Options:
3030
--help Show this screen.
31-
--php-versions Select specific php versions. [default: ${PHP_VERSIONS}]
31+
--php-versions Select specific php versions. [default: '`echo ${PHP_VERSIONS}`']
3232
Examples:
3333
php53
3434
'php53 php54'
@@ -86,7 +86,7 @@ importEnvironmentVariablesFromDirectory ()
8686
startDockerComposeServices ()
8787
{
8888
echo "+ ${DOCKER_COMPOSE} build"
89-
${DOCKER_COMPOSE} up -d --build --remove-orphans > /dev/null
89+
${DOCKER_COMPOSE} up -d --build --remove-orphans ${PHP_VERSIONS} > /dev/null
9090
}
9191

9292
configureWithArguments ()
@@ -105,6 +105,8 @@ configureWithArguments ()
105105
PHP_TEST_RUNTIME='tests/run.php'
106106
hasHelpOption=false
107107

108+
populatePHPVersions
109+
108110
parseOperands ${1+"$@"}
109111

110112
if ${hasHelpOption}; then
@@ -141,13 +143,18 @@ hasTty ()
141143
populatePHPVersions ()
142144
{
143145
if test x'all' = x"${PHP_VERSIONS}"; then
144-
PHP_VERSIONS=`fetchAllPHPVersions`
146+
PHP_VERSIONS=`fetchSupportedPHPVersions`
145147
else :; fi
146148
}
147149

150+
fetchSupportedPHPVersions ()
151+
{
152+
fetchAllPHPVersions | grep -E "${PHP_VERSIONS_SUPPORTED_PATTERN}"
153+
}
154+
148155
fetchAllPHPVersions ()
149156
{
150-
${DOCKER_COMPOSE} 2>/dev/null ps --services --filter status=running \
157+
${DOCKER_COMPOSE} 2>/dev/null ps --services \
151158
| grep php \
152159
| sort
153160
}

0 commit comments

Comments
 (0)