dongreng9864 2016-02-08 19:07
浏览 132
已采纳

更改phpunit.xml中的php.ini配置选项

I'm trying to run PHPUnit tests, and need to change the short_open_tag php.ini setting to On.

Following the PHPUnit Manual, I have this in my phpunit.xml config file:

<phpunit>
    <php>
        <ini name='short_open_tag' value='On' />
    </php>

    ...
</phpunit>

But this doesn't override the setting in the php.ini file being used (which is set to 'Off'). If I go into that file and manually change the value to 'On', it works. But, I'd like to leave that setting alone and only change it for the PHPUnit tests.

My best guess: My application (and phpunit.xml file) is on a VM, but it appears that PHPUnit is referencing the php.ini file on my local machine, so setting the configuration option from the phpunit.xml is affecting the php.ini file in the VM and not on my local machine. But I'm not sure how to change that.

Where have I gone wrong?

  • 写回答

1条回答 默认 最新

  • dongxing9219 2016-02-09 09:15
    关注

    You cannot change the short_open_tag setting at runtime (which is what the configuration in phpunit.xml is doing).

    If you look at the documentation, short_open_tag is in the PHP_INI_PERDIR group.

    It means it can only be set in php.ini, .htaccess, httpd.conf or .user.ini.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 qt+ffmpeg报错non-existing PPS 0 referenced
  • ¥15 FOC simulink
  • ¥15 咨询一下有关于王者荣耀赢藏战绩
  • ¥50 MacOS 使用虚拟机安装k8s
  • ¥500 亚马逊 COOKIE我如何才能实现 登录一个亚马逊账户 下发新 COOKIE ..我使用下发新COOKIE 导入ADS 指纹浏览器登录,我把账户密码 修改过后,原来下发新COOKIE 不会失效的方式
  • ¥20 玩游戏gpu和cpu利用率特别低,玩游戏卡顿
  • ¥25 oracle中的正则匹配
  • ¥15 关于#vscode#的问题:把软件卸载不会再出现蓝屏
  • ¥15 vimplus出现的错误
  • ¥30 怎么使用AVL fire ESE软件自带的优化模式来优化设计Soot和NOx?