使用Docker通过终端运行PHPUnit [英] Run PHPUnit by terminal with Docker
本文介绍了使用Docker通过终端运行PHPUnit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个项目,这里没有docker/docker-compose. 我想运行PHP脚本-通过终端运行PHPUnit.最好与PhpStorm合作.
I have project, where don't have docker/docker-compose. I want run PHP scripts - PHPUnit by terminal. Best would be working with PhpStorm.
#!/usr/bin/env bash
# echo "Current working directory: '"$(pwd)"'"
docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 php $@
结果
正在检查版本
运行此docker-phpez -v
,给我:
PHP 7.1.6 (cli) (built: Jun 12 2017 21:35:13) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.6, Copyright (c) 1999-2017, by Zend Technologies
with blackfire v1.17.1~linux-x64-non_zts71, https://blackfire.io, by SensioLabs
那么这是正确的.
然后,当我运行列表(修改文件)时,我会看到所有需要的文件.
When I run listing (modify files) then, I see all needed files.
当我尝试运行时,它在主文件夹中看到配置文件,但在路径中看不到引导文件:
When I try to run, it see config file in main folder, but won't see bootstrap file in path:
PHP Warning: include(/var/www/src/Tests/../../vendor/ezsystems/ezpublish-kernel/config.php): failed to open stream: No such file or directory in /var/www/src/Tests/bootstrap.php on line 3
问题:
- 当我看到容器中的PHP在
ls /var/www/src/Tests
内部运行时,为什么容器中的PHP没有看到此文件?
- why PHP inside container don't see this file, when I see this running inside
ls /var/www/src/Tests
?
docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 pwd
给予:
/var/www
运行ls
docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 ls
提供当前文件夹中所有文件/文件夹的列表.
give list of all files/folders in current folder.
docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 composer install
正确运行并安装所有数据.
run correctly and install all data.
推荐答案
此:
/var/www/src/Tests/../../vendor/ezsystems/ezpublish-kernel/config.php
被翻译为:
/var/www/vendor/ezsystems/ezpublish-kernel/config.php
由于../..
您不在那儿.
这篇关于使用Docker通过终端运行PHPUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文