Skip to content

Commit 1df82fd

Browse files
committed
fix test command
1 parent 47ab852 commit 1df82fd

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ test-setup:
2121

2222
test-%:
2323
cd tests; \
24-
DEW_PHP_VERSION="$*" composer run test
24+
DEW_PHP_VERSION="$*" \
25+
DOCKER_REGISTRY="$(DOCKER_REGISTRY)" \
26+
DOCKER_IMAGE="$(DOCKER_IMAGE)" \
27+
composer run test
2528

2629
test: test-setup $(addprefix test-,$(VARIANTS))
2730

tests/phpunit.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
</testsuites>
1919
<php>
2020
<env name="DEW_PHP_VERSION" value=""/>
21+
<env name="DOCKER_REGISTRY" value="ghcr.io"/>
22+
<env name="DOCKER_IMAGE" value="dew-serverless/php"/>
2123
</php>
2224
</phpunit>

tests/tests/FeatureTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,24 @@ private function execute(string $command): array
3131
$exit = null;
3232

3333
$version = $_ENV['DEW_PHP_VERSION'];
34+
$registry = $_ENV['DOCKER_REGISTRY'];
35+
$image = $_ENV['DOCKER_IMAGE'];
3436

3537
if ($version === '') {
3638
$this->markTestSkipped('The environment variable "DEW_PHP_VERSION" is missing.');
3739
}
3840

41+
if ($registry === '') {
42+
$this->markTestSkipped('The environment variable "DOCKER_REGISTRY" is missing.');
43+
}
44+
45+
if ($image === '') {
46+
$this->markTestSkipped('The environment variable "DOCKER_IMAGE" is missing.');
47+
}
48+
49+
$tag = str_replace('php', '', $version);
3950
$cmd = preg_replace(
40-
'/^php /', "docker run --rm dew/{$version} ", $command
51+
'/^php /', sprintf('docker run --rm %s/%s:%s ', $registry, $image, $tag), $command
4152
);
4253

4354
exec($cmd, $output, $exit);

0 commit comments

Comments
 (0)