php – 如何返回模拟方法的参数?
发布时间:2020-12-13 22:05:20 所属栏目:PHP教程 来源:网络整理
导读:大家好我怎么能在 PHPUnit中做到这一点,一个模拟方法返回它传递的参数? 例如: $redirector-expects( $this-once() )-method('gotoUrl')-will( $this-returnValue($argument) ); 解决方法 根据 PHPUnit manual: $stub-expects($this-any()) -method('doSom
大家好我怎么能在
PHPUnit中做到这一点,一个模拟方法返回它传递的参数?
例如: $redirector->expects( $this->once() )->method('gotoUrl')->will( $this->returnValue($argument) ); 解决方法
根据
PHPUnit manual:
$stub->expects($this->any()) ->method('doSomething') ->will($this->returnArgument(0)); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |