【发布时间】:2019-06-05 12:34:21
【问题描述】:
使用 Symfony 4.2、Windows 和 Git Bash,
当我运行此命令时,没关系,我的数据库bublemeet_test 已更新:
APP_ENV=test php bin/console doctrine:schema:update --force
在我的test/ 文件夹中,我有bootstrap.php 文件:
<?php
require __DIR__.'/../config/bootstrap.php';
if (isset($_ENV['APP_ENV'])) {
passthru(sprintf(
'APP_ENV=%s php "%s/../bin/console" cache:clear --no-warmup',
$_ENV['APP_ENV'],
__DIR__
));
}
但是当我运行这个命令时:
./bin/phpunit
我有这个错误:
'APP_ENV' n'est pas reconnu en tant que commande interne ou externe, un program executable ou un fichier de commandes。
为什么APP_ENV在我执行./bin/phpunit命令时不被识别,但在我更新数据库时被识别?
【问题讨论】:
-
我认为 passthru 正在运行“cmd”,而不是 bash。试试
bash -c "APP_ENV=bla bla bla"之类的(注意引号) -
非常感谢,很好! :)