docker 中的 PHPUnit:PowerShell 中没有颜色
PHPUnit in docker: no colors in PowerShell
当 运行在 Docker 容器中从 Windows PowerShell 中使用 PHPUnit 时如何获得彩色输出?
这是我的Docker文件:
FROM php:7.4.0-cli-alpine
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
COPY . /usr/myapp
WORKDIR /usr/myapp
RUN composer update
CMD [ "php", "./vendor/bin/phpunit", "--testsuite", "Default"]
phpunit.xml
<phpunit colors="true">
<testsuites>
<testsuite name="Default">
<file>tests/FooTest.php</file>
</testsuite>
</testsuites>
</phpunit>
当我 运行 来自 Powershell 的 docker 图像时,PHPUnit 仅输出纯白色文本,没有 red/green 条。
我将 Dockerfile CMD 更改为
CMD [ "php", "./vendor/bin/phpunit", "--colors=always", "--testsuite", "Default"]
... 成功了。由于某种原因,phpunit.xml 中的设置不适用于此环境。
当 运行在 Docker 容器中从 Windows PowerShell 中使用 PHPUnit 时如何获得彩色输出?
这是我的Docker文件:
FROM php:7.4.0-cli-alpine
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
COPY . /usr/myapp
WORKDIR /usr/myapp
RUN composer update
CMD [ "php", "./vendor/bin/phpunit", "--testsuite", "Default"]
phpunit.xml
<phpunit colors="true">
<testsuites>
<testsuite name="Default">
<file>tests/FooTest.php</file>
</testsuite>
</testsuites>
</phpunit>
当我 运行 来自 Powershell 的 docker 图像时,PHPUnit 仅输出纯白色文本,没有 red/green 条。
我将 Dockerfile CMD 更改为
CMD [ "php", "./vendor/bin/phpunit", "--colors=always", "--testsuite", "Default"]
... 成功了。由于某种原因,phpunit.xml 中的设置不适用于此环境。