我有两个运行相同堆栈的环境,它们提供不同的PHPUnit测试结果。
在我的基于流浪汉的环境中,我们的PHPUnit测试套件没有任何问题。
在我的基于VPS的环境中,我们看到以下php致命错误:
PHPUnit 5.5.1 by Sebastian Bergmann and contributors.
.......................................S.S.....PHP Fatal error:
Class Mock\Product\Promotion\DataProviderMock contains 5 abstract methods
and must therefore be declared abstract or implement the
remaining methods (Olive\Product\Promotion\DataProviderInterface::hasPromotion, Olive\Product\Promotion\DataProviderInterface::isSticky, Olive\Product\Promotion\DataProviderInterface::getValuePromotion, ...)
in /tmp/popeye/olive/tests/mock/Mock/Product/Promotion/ProviderMock.php on line 11
修复很简单(在类中实现方法),但在进行修复之前,我想了解为什么两种环境中的行为不同。
我认为这两种环境的区别在于我的PHP配置。
我已检查php-config
或php composer.phar show -t
之间的输出环境没有差异。
可能相关的php -i
输出之间存在一些差异。
这是左边的php -i
与流浪者环境(没有看到错误)的差异,右边是VPS环境(看到错误):
$ diff php-i.vagrant php-i.vps
4c4
< System => Linux vagrant-box 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64
---
> System => Linux staging-01 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64
109c108
< apc.shm_size => 32M => 32M
---
> apc.shm_size => 192M => 192M
112c111
< apc.ttl => 0 => 0
---
> apc.ttl => 86400 => 86400
144,145c143,144
< display_errors => STDOUT => STDOUT
< display_startup_errors => On => On
---
> display_errors => Off => Off
> display_startup_errors => Off => Off
154c153
< error_reporting => 32767 => 32767
---
> error_reporting => 22527 => 22527
746c745
< opcache.fast_shutdown => 0 => 0
---
> opcache.fast_shutdown => 1 => 1
754c753
< opcache.interned_strings_buffer => 4 => 4
---
> opcache.interned_strings_buffer => 16 => 16
757c756
< opcache.max_accelerated_files => 2000 => 2000
---
> opcache.max_accelerated_files => 16229 => 16229
760c759
< opcache.memory_consumption => 64 => 64
---
> opcache.memory_consumption => 192 => 192
771c770
< opcache.validate_timestamps => On => On
---
> opcache.validate_timestamps => Off => Off
793c792
是否有任何PHP大师在阅读此文章时可能能够解释为什么我们只在一个环境中看到此错误?
非常感谢!
答案 0 :(得分:0)
我怀疑这是因为其中一个设置与错误有关:
144,145c143,144
< display_errors => STDOUT => STDOUT
< display_startup_errors => On => On
---
> display_errors => Off => Off
> display_startup_errors => Off => Off
154c153
< error_reporting => 32767 => 32767
---
> error_reporting => 22527 => 22527