【发布时间】:2018-08-02 09:34:16
【问题描述】:
我的单元测试文件中有这一行:
$this->object->drupal->shouldReceive('drupalSetMessage')->once();
但我遇到如下错误:
$ ./tests/phpunit -c tests/phpunit.xml
...
There was 1 error:
1) SessionTest::testFoo
Mockery\Exception\InvalidCountException: Method drupalSetMessage(<Any Arguments>) from Mockery_1_Drupal_Util_Drupal should be called
exactly 1 times but called 0 times.
tests/vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php:38
tests/vendor/mockery/mockery/library/Mockery/Expectation.php:309
tests/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php:119
tests/vendor/mockery/mockery/library/Mockery/Container.php:301
tests/vendor/mockery/mockery/library/Mockery/Container.php:286
tests/vendor/mockery/mockery/library/Mockery.php:165
如何调试以查看在测试期间调用该方法的参数是什么?
【问题讨论】: