【发布时间】:2013-10-01 12:51:21
【问题描述】:
我有一个方法应该使用它以某种方式获得的数组,然后为每个元素调用另一个方法(我们称之为 fooBar),将元素作为参数传递给该方法。
这是我目前拥有并且有效的代码:
foreach ( $names as $index => $name ) {
$parser->expects( $this->at( $index ) )
->method( 'setFunctionHook' )
->with(
$this->equalTo( $name ),
$this->isType( 'callable' )
);
}
虽然这很冗长。有没有更短的方法?
【问题讨论】:
标签: unit-testing testing mocking phpunit assertions