php - Mockery\Exception\NoMatchingExpectationException:没有为 Mockery_1_::make 找到匹配的处理程序
问题描述
我编写了这个返回以下错误的测试:
Mockery\Exception\NoMatchingExpectationException:没有为 Mockery_1_My_Class::make(array('valid_until'=>'2020-03-04',)) 找到匹配的处理程序。该方法是意外的,或者它的参数与该方法的预期参数列表不匹配
现在我的测试中有这段代码:
$rateValidator->shouldReceive('make')->once()
->withArgs([$attributes])->andReturn(mockery::self());
$rateValidator->shouldReceive('addContext')
->withArgs(['update_rate_validity'])->andReturn(mockery::self());
这是这个测试正在测试的代码:
$attributes = [
'valid_until' => $command->validUntilDate
];
$validator = $this->rateValidator->make($attributes)->addContext('update_rate_validity');
我在这里做错了什么?对我来说,唯一的问题可能是该方法正在接收的arguments
( ),但我不知道那可能是什么?$attributes
make
解决方案
推荐阅读
- ssh - SSH works until 'sudo ssh' is used, then URL gets connection refused
- .net-core - How to host React App and Dot Net core webAPI with SignalR in AWS and Docker environment
- sql-server - Datagridview 使用 SQL Server 显示没有数据 vb.net
- reactjs - 这是什么模式在 React 中使用箭头函数?
- go - Go libstd.so with errors on Alpine
- jasper-reports - How to get sum of the XML repeated element values from a list in report?
- spring-boot - Jhipster 无法在登录前使用匿名用户
- swift - Backslash in string from standard input, no way to stripe it
- typoscript - TYPO3 Dynamic Localized Label in TypoScript
- javascript - 使用 jquery 根据“父”ID 选择“子”